Skip to content

Commit

Permalink
fix: [10kcp] Fix init rootcoord meta timeout (#38249)
Browse files Browse the repository at this point in the history
issue: #37630

pr: #38248

Signed-off-by: bigsheeper <[email protected]>
  • Loading branch information
bigsheeper authored Dec 5, 2024
1 parent 99279e0 commit df100e5
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 8 deletions.
1 change: 1 addition & 0 deletions internal/metastore/kv/rootcoord/kv_catalog.go
Original file line number Diff line number Diff line change
Expand Up @@ -440,6 +440,7 @@ func (kc *Catalog) appendPartitionAndFieldsInfo(ctx context.Context, collMeta *p
return collection, nil
}

// TODO: This function will be invoked many times if there are many databases, leading to significant overhead.
func (kc *Catalog) batchAppendPartitionAndFieldsInfo(ctx context.Context, collMeta []*pb.CollectionInfo,
ts typeutil.Timestamp,
) ([]*model.Collection, error) {
Expand Down
18 changes: 10 additions & 8 deletions internal/metastore/kv/rootcoord/suffix_snapshot.go
Original file line number Diff line number Diff line change
Expand Up @@ -434,18 +434,20 @@ func (ss *SuffixSnapshot) generateSaveExecute(kvs map[string]string, ts typeutil
func (ss *SuffixSnapshot) LoadWithPrefix(key string, ts typeutil.Timestamp) ([]string, []string, error) {
// ts 0 case shall be treated as fetch latest/current value
if ts == 0 || ts == typeutil.MaxTimestamp {
keys, values, err := ss.MetaKv.LoadWithPrefix(key)
fks := keys[:0] // make([]string, 0, len(keys))
fvs := values[:0] // make([]string, 0, len(values))
fks := make([]string, 0)
fvs := make([]string, 0)
// hide rootPrefix from return value
for i, k := range keys {
applyFn := func(key []byte, value []byte) error {
// filters tombstone
if ss.isTombstone(values[i]) {
continue
if ss.isTombstone(string(value)) {
return nil
}
fks = append(fks, ss.hideRootPrefix(k))
fvs = append(fvs, values[i])
fks = append(fks, ss.hideRootPrefix(string(key)))
fvs = append(fvs, string(value))
return nil
}

err := ss.MetaKv.WalkWithPrefix(key, PaginationSize, applyFn)
return fks, fvs, err
}
ss.Lock()
Expand Down

0 comments on commit df100e5

Please sign in to comment.