From a6deb04696cc94450a326abb308dc01ca2bbcafa Mon Sep 17 00:00:00 2001 From: "wenhui.zhang" Date: Mon, 19 Aug 2024 20:57:42 +0800 Subject: [PATCH] Support migrate description --- README_2X.md | 15 ++++++++++++++- .../milvus2x/convert/milvus2x_convert.go | 7 ++++++- 2 files changed, 20 insertions(+), 2 deletions(-) diff --git a/README_2X.md b/README_2X.md index 223a346..55251f4 100644 --- a/README_2X.md +++ b/README_2X.md @@ -132,4 +132,17 @@ meta: ... writeMode: upsert ... -``` \ No newline at end of file +``` + +If want batch migrate multi-collections, now batch migration can be achieved by passing collection name parameters through script execution in a loop (It will replace the collection name in the yaml configuration file), script like below: +```bash +#!/bin/bash + +collections=("collection1" "collection2" "collection3") + +for collection in "${collections[@]}"; do +echo "BatchMigration==> $collection" +./milvus-migration start -t="$collection" -c=/{YourConfigPath}/migration.yml +done +``` +[BatchCollectionMigration Script](https://github.com/zilliztech/milvus-migration/blob/main/testfiles/milvus2x/batch_collection_migration.sh) \ No newline at end of file diff --git a/core/transform/milvus2x/convert/milvus2x_convert.go b/core/transform/milvus2x/convert/milvus2x_convert.go index d5c8a97..960ad5a 100644 --- a/core/transform/milvus2x/convert/milvus2x_convert.go +++ b/core/transform/milvus2x/convert/milvus2x_convert.go @@ -29,6 +29,10 @@ func ToMilvusParam(ctx context.Context, collCfg *milvus2xtype.CollectionCfg, mil log.Error("milvus2x transform to custom Milvus field type error", zap.Error(err)) return nil, err } + Description := srcCollEntity.Schema.Description + if Description == "" { + Description = "Migration from Milvus2x" + } //collCfg.MilvusCfg.AutoId = srcCollEntity.Schema.AutoID //log.Info("milvus2x transform to custom Milvus", zap.Any("milvusCfg AutoId", collCfg.MilvusCfg.AutoId)) //log.Info("milvus2x transform to custom Milvus", zap.Any("srcColl AutoId", srcCollEntity.Schema.AutoID)) @@ -37,7 +41,8 @@ func ToMilvusParam(ctx context.Context, collCfg *milvus2xtype.CollectionCfg, mil ShardsNum: ToShardNum(collCfg.MilvusCfg.ShardNum, srcCollEntity), EnableDynamicField: !collCfg.MilvusCfg.CloseDynamicField, AutoId: collCfg.MilvusCfg.AutoId, - Description: "Migration from Milvus2x", + //Description: "Migration from Milvus2x", + Description: Description, } param.ConsistencyLevel, err = GetMilvusConsistencyLevel(collCfg, srcCollEntity) if err != nil {