fix: wrong update timetick of collection meta info (#45461)

issue: #45403, #45463

- fix the Nightly E2E failures.
- fix the wrong update timetick of altering collection to fix the
related load failure.

Signed-off-by: chyezh <chyezh@outlook.com>
This commit is contained in:
Zhen Ye 2025-11-11 16:01:36 +08:00 committed by GitHub
parent e3c1673191
commit 4797bb6ab2
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
6 changed files with 21 additions and 12 deletions

View File

@ -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 {

View File

@ -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 {

View File

@ -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())
}

View File

@ -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)

View File

@ -446,7 +446,7 @@ class TestMilvusClientTimestamptzValid(TestMilvusClientV2Base):
consistency_level="Strong", index_params=index_params)
# step 2: alter collection properties
self.alter_collection_properties(client, collection_name, properties={"collection.timezone": "Asia/Shanghai"})
self.alter_collection_properties(client, collection_name, properties={"timezone": "Asia/Shanghai"})
rows = cf.gen_row_data_by_schema(nb=default_nb, schema=schema)
self.insert(client, collection_name, rows)

View File

@ -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):