mirror of
https://gitee.com/milvus-io/milvus.git
synced 2026-01-07 19:31:51 +08:00
fix: Upgrade from 2.2 should update CollectionLoadInfo (#29443)
milvus branch 2.3 add `loadType` in CollectionLoadInfo, so for collection meta upgrade from 2.2, we should add `loadType` to CollectionLoadInfo. This PR update CollectionLoadInfo with `loadType` when meet a old version CollectionLoadInfo Signed-off-by: Wei Liu <wei.liu@zilliz.com>
This commit is contained in:
parent
b8318fcd7d
commit
2ffde52f8a
@ -188,9 +188,9 @@ func (m *CollectionManager) Recover(broker Broker) error {
|
||||
|
||||
// upgradeRecover recovers from old version <= 2.2.x for compatibility.
|
||||
func (m *CollectionManager) upgradeRecover(broker Broker) error {
|
||||
// for loaded collection from 2.2, it only save a old version CollectionLoadInfo without LoadType.
|
||||
// we should update the CollectionLoadInfo and save all PartitionLoadInfo to meta store
|
||||
for _, collection := range m.GetAllCollections() {
|
||||
// It's a workaround to check if it is old CollectionLoadInfo because there's no
|
||||
// loadType in old version, maybe we should use version instead.
|
||||
if collection.GetLoadType() == querypb.LoadType_UnKnownType {
|
||||
partitionIDs, err := broker.GetPartitions(context.Background(), collection.GetCollectionID())
|
||||
if err != nil {
|
||||
@ -212,8 +212,18 @@ func (m *CollectionManager) upgradeRecover(broker Broker) error {
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
newInfo := collection.Clone()
|
||||
newInfo.LoadType = querypb.LoadType_LoadCollection
|
||||
err = m.putCollection(true, newInfo)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// for loaded partition from 2.2, it only save load PartitionLoadInfo.
|
||||
// we should save it's CollectionLoadInfo to meta store
|
||||
for _, partition := range m.GetAllPartitions() {
|
||||
// In old version, collection would NOT be stored if the partition existed.
|
||||
if _, ok := m.collections[partition.GetCollectionID()]; !ok {
|
||||
|
||||
@ -501,6 +501,11 @@ func (suite *CollectionManagerSuite) TestUpgradeRecover() {
|
||||
err := mgr.Recover(suite.broker)
|
||||
suite.NoError(err)
|
||||
suite.checkLoadResult()
|
||||
|
||||
for i, collection := range suite.collections {
|
||||
newColl := mgr.GetCollection(collection)
|
||||
suite.Equal(suite.loadTypes[i], newColl.GetLoadType())
|
||||
}
|
||||
}
|
||||
|
||||
func (suite *CollectionManagerSuite) loadAll() {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user