mirror of
https://gitee.com/milvus-io/milvus.git
synced 2025-12-07 09:38:39 +08:00
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:
parent
e3c1673191
commit
4797bb6ab2
@ -957,7 +957,7 @@ func (mt *MetaTable) AlterCollection(ctx context.Context, result message.Broadca
|
|||||||
dbChanged = true
|
dbChanged = true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
newColl.UpdateTimestamp = result.GetControlChannelResult().TimeTick
|
newColl.UpdateTimestamp = result.GetMaxTimeTick()
|
||||||
|
|
||||||
ctx1 := contextutil.WithTenantID(ctx, Params.CommonCfg.ClusterName.GetValue())
|
ctx1 := contextutil.WithTenantID(ctx, Params.CommonCfg.ClusterName.GetValue())
|
||||||
if !dbChanged {
|
if !dbChanged {
|
||||||
|
|||||||
@ -33,6 +33,17 @@ type BroadcastResult[H proto.Message, B proto.Message] struct {
|
|||||||
Results map[string]*AppendResult
|
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.
|
// GetControlChannelResult returns the append result of the control channel.
|
||||||
// Return nil if the control channel is not found.
|
// Return nil if the control channel is not found.
|
||||||
func (br *BroadcastResult[H, B]) GetControlChannelResult() *AppendResult {
|
func (br *BroadcastResult[H, B]) GetControlChannelResult() *AppendResult {
|
||||||
|
|||||||
@ -12,12 +12,13 @@ func TestBroadcastResult(t *testing.T) {
|
|||||||
r := BroadcastResult[*CreateDatabaseMessageHeader, *CreateDatabaseMessageBody]{
|
r := BroadcastResult[*CreateDatabaseMessageHeader, *CreateDatabaseMessageBody]{
|
||||||
Message: nil,
|
Message: nil,
|
||||||
Results: map[string]*AppendResult{
|
Results: map[string]*AppendResult{
|
||||||
"v1": {},
|
"v1": {TimeTick: 1},
|
||||||
"v2": {},
|
"v2": {TimeTick: 2},
|
||||||
"abc" + funcutil.ControlChannelSuffix: {},
|
"abc" + funcutil.ControlChannelSuffix: {TimeTick: 3},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
assert.ElementsMatch(t, []string{"v1", "v2"}, r.GetVChannelsWithoutControlChannel())
|
assert.ElementsMatch(t, []string{"v1", "v2"}, r.GetVChannelsWithoutControlChannel())
|
||||||
assert.NotNil(t, r.GetControlChannelResult())
|
assert.NotNil(t, r.GetControlChannelResult())
|
||||||
|
assert.Equal(t, uint64(3), r.GetMaxTimeTick())
|
||||||
}
|
}
|
||||||
|
|||||||
@ -3055,7 +3055,7 @@ class TestMilvusClientDescribeCollectionValid(TestMilvusClientV2Base):
|
|||||||
'functions': [],
|
'functions': [],
|
||||||
'aliases': [],
|
'aliases': [],
|
||||||
'consistency_level': 0,
|
'consistency_level': 0,
|
||||||
'properties': {'collection.timezone': 'UTC'},
|
'properties': {'timezone': 'UTC'},
|
||||||
'num_partitions': 1,
|
'num_partitions': 1,
|
||||||
'enable_dynamic_field': True
|
'enable_dynamic_field': True
|
||||||
}
|
}
|
||||||
@ -3345,8 +3345,7 @@ class TestMilvusClientRenameCollectionInValid(TestMilvusClientV2Base):
|
|||||||
collection_name = cf.gen_unique_str(prefix)
|
collection_name = cf.gen_unique_str(prefix)
|
||||||
# 1. create collection
|
# 1. create collection
|
||||||
self.create_collection(client, collection_name, default_dim)
|
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 "
|
error = {ct.err_code: 1100, ct.err_msg: f"collection name or database name should be different"}
|
||||||
f"default with other collection name or alias"}
|
|
||||||
self.rename_collection(client, collection_name, collection_name,
|
self.rename_collection(client, collection_name, collection_name,
|
||||||
check_task=CheckTasks.err_res, check_items=error)
|
check_task=CheckTasks.err_res, check_items=error)
|
||||||
|
|
||||||
@ -3529,8 +3528,7 @@ class TestMilvusClientCollectionPropertiesInvalid(TestMilvusClientV2Base):
|
|||||||
check_items={"collection_name": collection_name,
|
check_items={"collection_name": collection_name,
|
||||||
"dim": default_dim,
|
"dim": default_dim,
|
||||||
"consistency_level": 0})
|
"consistency_level": 0})
|
||||||
error = {ct.err_code: 65535, ct.err_msg: f"alter collection with empty properties and "
|
error = {ct.err_code: 1100, ct.err_msg: f"no properties or delete keys provided"}
|
||||||
f"delete keys, expect to set either properties or delete keys"}
|
|
||||||
self.drop_collection_properties(client, collection_name, property_keys,
|
self.drop_collection_properties(client, collection_name, property_keys,
|
||||||
check_task=CheckTasks.err_res,
|
check_task=CheckTasks.err_res,
|
||||||
check_items=error)
|
check_items=error)
|
||||||
|
|||||||
@ -446,7 +446,7 @@ class TestMilvusClientTimestamptzValid(TestMilvusClientV2Base):
|
|||||||
consistency_level="Strong", index_params=index_params)
|
consistency_level="Strong", index_params=index_params)
|
||||||
|
|
||||||
# step 2: alter collection properties
|
# 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)
|
rows = cf.gen_row_data_by_schema(nb=default_nb, schema=schema)
|
||||||
self.insert(client, collection_name, rows)
|
self.insert(client, collection_name, rows)
|
||||||
|
|
||||||
|
|||||||
@ -512,8 +512,7 @@ class TestUtilityParams(TestcaseBase):
|
|||||||
self.utility_wrap.rename_collection(old_collection_name, new_collection_name,
|
self.utility_wrap.rename_collection(old_collection_name, new_collection_name,
|
||||||
check_task=CheckTasks.err_res,
|
check_task=CheckTasks.err_res,
|
||||||
check_items={"err_code": 100,
|
check_items={"err_code": 100,
|
||||||
"err_msg": "collection not found in database, collection: {}"
|
"err_msg": "collection not found"})
|
||||||
", database: default".format(old_collection_name)})
|
|
||||||
|
|
||||||
@pytest.mark.tags(CaseLabel.L1)
|
@pytest.mark.tags(CaseLabel.L1)
|
||||||
def test_rename_collection_existed_collection_name(self):
|
def test_rename_collection_existed_collection_name(self):
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user