mirror of
https://gitee.com/milvus-io/milvus.git
synced 2025-12-06 09:08:43 +08:00
fix: Add save field schema log for kv_catalog.AlterCollection (#41242)
Related to #41241 --------- Signed-off-by: Congqi Xia <congqi.xia@zilliz.com>
This commit is contained in:
parent
6a12304d1e
commit
a53f3024cf
@ -655,8 +655,21 @@ func (kc *Catalog) alterModifyCollection(ctx context.Context, oldColl *model.Col
|
||||
return err
|
||||
}
|
||||
saves := map[string]string{newKey: string(value)}
|
||||
// no default aliases will be created.
|
||||
// save fields info to new path.
|
||||
for _, field := range newColl.Fields {
|
||||
k := BuildFieldKey(newColl.CollectionID, field.FieldID)
|
||||
fieldInfo := model.MarshalFieldModel(field)
|
||||
v, err := proto.Marshal(fieldInfo)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
saves[k] = string(v)
|
||||
}
|
||||
if oldKey == newKey {
|
||||
return kc.Snapshot.Save(ctx, newKey, string(value), ts)
|
||||
return etcd.SaveByBatchWithLimit(saves, util.MaxEtcdTxnNum/2, func(partialKvs map[string]string) error {
|
||||
return kc.Snapshot.MultiSave(ctx, partialKvs, ts)
|
||||
})
|
||||
}
|
||||
return kc.Snapshot.MultiSaveAndRemove(ctx, saves, []string{oldKey}, ts)
|
||||
}
|
||||
|
||||
@ -1036,6 +1036,12 @@ func TestCatalog_AlterCollection(t *testing.T) {
|
||||
kvs[key] = value
|
||||
return nil
|
||||
}
|
||||
snapshot.MultiSaveFunc = func(ctx context.Context, saveKvs map[string]string, _ typeutil.Timestamp) error {
|
||||
for k, v := range saveKvs {
|
||||
kvs[k] = v
|
||||
}
|
||||
return nil
|
||||
}
|
||||
kc := NewCatalog(nil, snapshot).(*Catalog)
|
||||
ctx := context.Background()
|
||||
var collectionID int64 = 1
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user