mirror of
https://gitee.com/milvus-io/milvus.git
synced 2025-12-06 17:18:35 +08:00
fix: wrong update timetick of collection info (#45471)
issue: #45397, #45403, #45463 pr: #45461 also pick pr: #45447 - fix alter collection with alias failed with collection not found - fix the Nightly E2E failures. - fix the wrong update timetick of altering collection to fix the related load failure. --------- Signed-off-by: sijie-ni-0214 <sijie.ni@zilliz.com> Signed-off-by: chyezh <chyezh@outlook.com> Co-authored-by: sijie-ni-0214 <sijie.ni@zilliz.com>
This commit is contained in:
parent
2f6940253d
commit
1cfb9f6881
@ -226,19 +226,19 @@ func (c *Core) broadcastAlterCollectionForAlterDynamicField(ctx context.Context,
|
||||
}
|
||||
|
||||
// getCacheExpireForCollection gets the cache expirations for collection.
|
||||
func (c *Core) getCacheExpireForCollection(ctx context.Context, dbName string, collectionName string) (*message.CacheExpirations, error) {
|
||||
coll, err := c.meta.GetCollectionByName(ctx, dbName, collectionName, typeutil.MaxTimestamp)
|
||||
func (c *Core) getCacheExpireForCollection(ctx context.Context, dbName string, collectionNameOrAlias string) (*message.CacheExpirations, error) {
|
||||
coll, err := c.meta.GetCollectionByName(ctx, dbName, collectionNameOrAlias, typeutil.MaxTimestamp)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
aliases, err := c.meta.ListAliases(ctx, dbName, collectionName, typeutil.MaxTimestamp)
|
||||
aliases, err := c.meta.ListAliases(ctx, dbName, coll.Name, typeutil.MaxTimestamp)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
builder := ce.NewBuilder()
|
||||
builder.WithLegacyProxyCollectionMetaCache(
|
||||
ce.OptLPCMDBName(dbName),
|
||||
ce.OptLPCMCollectionName(collectionName),
|
||||
ce.OptLPCMCollectionName(coll.Name),
|
||||
ce.OptLPCMCollectionID(coll.CollectionID),
|
||||
ce.OptLPCMMsgType(commonpb.MsgType_AlterCollection),
|
||||
)
|
||||
|
||||
@ -957,7 +957,7 @@ func (mt *MetaTable) AlterCollection(ctx context.Context, result message.Broadca
|
||||
dbChanged = true
|
||||
}
|
||||
}
|
||||
newColl.UpdateTimestamp = result.GetControlChannelResult().TimeTick
|
||||
newColl.UpdateTimestamp = result.GetMaxTimeTick()
|
||||
|
||||
ctx1 := contextutil.WithTenantID(ctx, Params.CommonCfg.ClusterName.GetValue())
|
||||
if !dbChanged {
|
||||
|
||||
@ -33,6 +33,17 @@ type BroadcastResult[H proto.Message, B proto.Message] struct {
|
||||
Results map[string]*AppendResult
|
||||
}
|
||||
|
||||
// GetMaxTimeTick returns the max time tick of the broadcast result.
|
||||
func (br *BroadcastResult[H, B]) GetMaxTimeTick() uint64 {
|
||||
maxTimeTick := uint64(0)
|
||||
for _, result := range br.Results {
|
||||
if result.TimeTick > maxTimeTick {
|
||||
maxTimeTick = result.TimeTick
|
||||
}
|
||||
}
|
||||
return maxTimeTick
|
||||
}
|
||||
|
||||
// GetControlChannelResult returns the append result of the control channel.
|
||||
// Return nil if the control channel is not found.
|
||||
func (br *BroadcastResult[H, B]) GetControlChannelResult() *AppendResult {
|
||||
|
||||
@ -12,12 +12,13 @@ func TestBroadcastResult(t *testing.T) {
|
||||
r := BroadcastResult[*CreateDatabaseMessageHeader, *CreateDatabaseMessageBody]{
|
||||
Message: nil,
|
||||
Results: map[string]*AppendResult{
|
||||
"v1": {},
|
||||
"v2": {},
|
||||
"abc" + funcutil.ControlChannelSuffix: {},
|
||||
"v1": {TimeTick: 1},
|
||||
"v2": {TimeTick: 2},
|
||||
"abc" + funcutil.ControlChannelSuffix: {TimeTick: 3},
|
||||
},
|
||||
}
|
||||
|
||||
assert.ElementsMatch(t, []string{"v1", "v2"}, r.GetVChannelsWithoutControlChannel())
|
||||
assert.NotNil(t, r.GetControlChannelResult())
|
||||
assert.Equal(t, uint64(3), r.GetMaxTimeTick())
|
||||
}
|
||||
|
||||
@ -3055,7 +3055,7 @@ class TestMilvusClientDescribeCollectionValid(TestMilvusClientV2Base):
|
||||
'functions': [],
|
||||
'aliases': [],
|
||||
'consistency_level': 0,
|
||||
'properties': {'collection.timezone': 'UTC'},
|
||||
'properties': {'timezone': 'UTC'},
|
||||
'num_partitions': 1,
|
||||
'enable_dynamic_field': True
|
||||
}
|
||||
@ -3345,8 +3345,7 @@ class TestMilvusClientRenameCollectionInValid(TestMilvusClientV2Base):
|
||||
collection_name = cf.gen_unique_str(prefix)
|
||||
# 1. create collection
|
||||
self.create_collection(client, collection_name, default_dim)
|
||||
error = {ct.err_code: 65535, ct.err_msg: f"duplicated new collection name {collection_name} in database "
|
||||
f"default with other collection name or alias"}
|
||||
error = {ct.err_code: 1100, ct.err_msg: f"collection name or database name should be different"}
|
||||
self.rename_collection(client, collection_name, collection_name,
|
||||
check_task=CheckTasks.err_res, check_items=error)
|
||||
|
||||
@ -3529,8 +3528,7 @@ class TestMilvusClientCollectionPropertiesInvalid(TestMilvusClientV2Base):
|
||||
check_items={"collection_name": collection_name,
|
||||
"dim": default_dim,
|
||||
"consistency_level": 0})
|
||||
error = {ct.err_code: 65535, ct.err_msg: f"alter collection with empty properties and "
|
||||
f"delete keys, expect to set either properties or delete keys"}
|
||||
error = {ct.err_code: 1100, ct.err_msg: f"no properties or delete keys provided"}
|
||||
self.drop_collection_properties(client, collection_name, property_keys,
|
||||
check_task=CheckTasks.err_res,
|
||||
check_items=error)
|
||||
|
||||
1026
tests/python_client/milvus_client/test_milvus_client_timestamptz.py
Normal file
1026
tests/python_client/milvus_client/test_milvus_client_timestamptz.py
Normal file
File diff suppressed because it is too large
Load Diff
@ -512,8 +512,7 @@ class TestUtilityParams(TestcaseBase):
|
||||
self.utility_wrap.rename_collection(old_collection_name, new_collection_name,
|
||||
check_task=CheckTasks.err_res,
|
||||
check_items={"err_code": 100,
|
||||
"err_msg": "collection not found in database, collection: {}"
|
||||
", database: default".format(old_collection_name)})
|
||||
"err_msg": "collection not found"})
|
||||
|
||||
@pytest.mark.tags(CaseLabel.L1)
|
||||
def test_rename_collection_existed_collection_name(self):
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user