diff --git a/core/backup_meta.go b/core/backup_meta.go index c9462e04..d4aaa2d0 100644 --- a/core/backup_meta.go +++ b/core/backup_meta.go @@ -286,7 +286,7 @@ func SimpleBackupResponse(input *backuppb.BackupInfoResponse) *backuppb.BackupIn // clone and remove PartitionBackups, avoid updating here every time we add a field in CollectionBackupInfo clonedCollectionBackup := proto.Clone(coll).(*backuppb.CollectionBackupInfo) clonedCollectionBackup.PartitionBackups = nil - clonedCollectionBackup.Schema = nil + // clonedCollectionBackup.Schema = nil // schema is needed by cloud collections = append(collections, clonedCollectionBackup) } simpleBackupInfo := proto.Clone(backup).(*backuppb.BackupInfo) diff --git a/core/backup_meta_manager.go b/core/backup_meta_manager.go index ef5a2cb3..07a50c34 100644 --- a/core/backup_meta_manager.go +++ b/core/backup_meta_manager.go @@ -487,14 +487,12 @@ func (meta *MetaManager) GetFullMeta(id string) *backuppb.BackupInfo { cloneBackup.Size = cloneBackup.Size + collectionBackup.Size } cloneBackup.CollectionBackups = collectionBackups - cloneBackup.Progress = 1 if totalSize != 0 { cloneBackup.Progress = int32(backupedSize * 100 / (totalSize)) } else { cloneBackup.Progress = 100 } - log.Info("backup progress", zap.Int64("backupedSize", backupedSize), zap.Int64("totalSize", totalSize), zap.Int32("progress", cloneBackup.Progress)) - + log.Info("Get backup progress", zap.Int64("backupedSize", backupedSize), zap.Int64("totalSize", totalSize), zap.Int32("progress", cloneBackup.Progress)) return cloneBackup } diff --git a/core/proto/backuppb/backup.pb.go b/core/proto/backuppb/backup.pb.go index 07e72a14..f0a10e3f 100644 --- a/core/proto/backuppb/backup.pb.go +++ b/core/proto/backuppb/backup.pb.go @@ -334,11 +334,11 @@ func (m *IndexInfo) GetParams() map[string]string { // lite version of Collection info type CollectionBackupInfo struct { Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` - StateCode BackupTaskStateCode `protobuf:"varint,2,opt,name=state_code,json=stateCode,proto3,enum=milvus.proto.backup.BackupTaskStateCode" json:"state_code,omitempty"` + StateCode BackupTaskStateCode `protobuf:"varint,2,opt,name=state_code,json=stateCode,proto3,enum=milvus.proto.backup.BackupTaskStateCode" json:"state_code"` ErrorMessage string `protobuf:"bytes,3,opt,name=errorMessage,proto3" json:"errorMessage,omitempty"` StartTime int64 `protobuf:"varint,4,opt,name=start_time,json=startTime,proto3" json:"start_time,omitempty"` EndTime int64 `protobuf:"varint,5,opt,name=end_time,json=endTime,proto3" json:"end_time,omitempty"` - Progress int32 `protobuf:"varint,6,opt,name=progress,proto3" json:"progress,omitempty"` + Progress int32 `protobuf:"varint,6,opt,name=progress,proto3" json:"progress"` CollectionId int64 `protobuf:"varint,7,opt,name=collection_id,json=collectionId,proto3" json:"collection_id,omitempty"` DbName string `protobuf:"bytes,8,opt,name=db_name,json=dbName,proto3" json:"db_name,omitempty"` CollectionName string `protobuf:"bytes,9,opt,name=collection_name,json=collectionName,proto3" json:"collection_name,omitempty"` @@ -741,11 +741,11 @@ func (m *SegmentBackupInfo) GetIsL0() bool { // root of backup type BackupInfo struct { Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` - StateCode BackupTaskStateCode `protobuf:"varint,2,opt,name=state_code,json=stateCode,proto3,enum=milvus.proto.backup.BackupTaskStateCode" json:"state_code,omitempty"` + StateCode BackupTaskStateCode `protobuf:"varint,2,opt,name=state_code,json=stateCode,proto3,enum=milvus.proto.backup.BackupTaskStateCode" json:"state_code"` ErrorMessage string `protobuf:"bytes,3,opt,name=errorMessage,proto3" json:"errorMessage,omitempty"` StartTime int64 `protobuf:"varint,4,opt,name=start_time,json=startTime,proto3" json:"start_time,omitempty"` EndTime int64 `protobuf:"varint,5,opt,name=end_time,json=endTime,proto3" json:"end_time,omitempty"` - Progress int32 `protobuf:"varint,6,opt,name=progress,proto3" json:"progress,omitempty"` + Progress int32 `protobuf:"varint,6,opt,name=progress,proto3" json:"progress"` Name string `protobuf:"bytes,7,opt,name=name,proto3" json:"name,omitempty"` // backup timestamp BackupTimestamp uint64 `protobuf:"varint,8,opt,name=backup_timestamp,json=backupTimestamp,proto3" json:"backup_timestamp,omitempty"` @@ -1661,11 +1661,11 @@ func (m *RestoreBackupRequest) GetId() string { type RestorePartitionTask struct { Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` - StateCode RestoreTaskStateCode `protobuf:"varint,2,opt,name=state_code,json=stateCode,proto3,enum=milvus.proto.backup.RestoreTaskStateCode" json:"state_code,omitempty"` + StateCode RestoreTaskStateCode `protobuf:"varint,2,opt,name=state_code,json=stateCode,proto3,enum=milvus.proto.backup.RestoreTaskStateCode" json:"state_code"` ErrorMessage string `protobuf:"bytes,3,opt,name=errorMessage,proto3" json:"errorMessage,omitempty"` StartTime int64 `protobuf:"varint,4,opt,name=start_time,json=startTime,proto3" json:"start_time,omitempty"` EndTime int64 `protobuf:"varint,5,opt,name=end_time,json=endTime,proto3" json:"end_time,omitempty"` - Progress int32 `protobuf:"varint,6,opt,name=progress,proto3" json:"progress,omitempty"` + Progress int32 `protobuf:"varint,6,opt,name=progress,proto3" json:"progress"` PartBackup *PartitionBackupInfo `protobuf:"bytes,7,opt,name=part_backup,json=partBackup,proto3" json:"part_backup,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` @@ -1748,7 +1748,7 @@ func (m *RestorePartitionTask) GetPartBackup() *PartitionBackupInfo { type RestoreCollectionTask struct { Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` - StateCode RestoreTaskStateCode `protobuf:"varint,2,opt,name=state_code,json=stateCode,proto3,enum=milvus.proto.backup.RestoreTaskStateCode" json:"state_code,omitempty"` + StateCode RestoreTaskStateCode `protobuf:"varint,2,opt,name=state_code,json=stateCode,proto3,enum=milvus.proto.backup.RestoreTaskStateCode" json:"state_code"` ErrorMessage string `protobuf:"bytes,3,opt,name=errorMessage,proto3" json:"errorMessage,omitempty"` StartTime int64 `protobuf:"varint,4,opt,name=start_time,json=startTime,proto3" json:"start_time,omitempty"` EndTime int64 `protobuf:"varint,5,opt,name=end_time,json=endTime,proto3" json:"end_time,omitempty"` @@ -1757,7 +1757,7 @@ type RestoreCollectionTask struct { PartitionRestoreTasks []*RestorePartitionTask `protobuf:"bytes,8,rep,name=partition_restore_tasks,json=partitionRestoreTasks,proto3" json:"partition_restore_tasks,omitempty"` RestoredSize int64 `protobuf:"varint,9,opt,name=restored_size,json=restoredSize,proto3" json:"restored_size"` ToRestoreSize int64 `protobuf:"varint,10,opt,name=to_restore_size,json=toRestoreSize,proto3" json:"to_restore_size"` - Progress int32 `protobuf:"varint,11,opt,name=progress,proto3" json:"progress,omitempty"` + Progress int32 `protobuf:"varint,11,opt,name=progress,proto3" json:"progress"` TargetDbName string `protobuf:"bytes,12,opt,name=target_db_name,json=targetDbName,proto3" json:"target_db_name,omitempty"` // if true only restore meta MetaOnly bool `protobuf:"varint,13,opt,name=metaOnly,proto3" json:"metaOnly,omitempty"` @@ -1929,14 +1929,14 @@ func (m *RestoreCollectionTask) GetSkipCreateCollection() bool { type RestoreBackupTask struct { Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` - StateCode RestoreTaskStateCode `protobuf:"varint,2,opt,name=state_code,json=stateCode,proto3,enum=milvus.proto.backup.RestoreTaskStateCode" json:"state_code,omitempty"` + StateCode RestoreTaskStateCode `protobuf:"varint,2,opt,name=state_code,json=stateCode,proto3,enum=milvus.proto.backup.RestoreTaskStateCode" json:"state_code"` ErrorMessage string `protobuf:"bytes,3,opt,name=errorMessage,proto3" json:"errorMessage,omitempty"` StartTime int64 `protobuf:"varint,4,opt,name=start_time,json=startTime,proto3" json:"start_time,omitempty"` EndTime int64 `protobuf:"varint,5,opt,name=end_time,json=endTime,proto3" json:"end_time,omitempty"` CollectionRestoreTasks []*RestoreCollectionTask `protobuf:"bytes,6,rep,name=collection_restore_tasks,json=collectionRestoreTasks,proto3" json:"collection_restore_tasks,omitempty"` RestoredSize int64 `protobuf:"varint,7,opt,name=restored_size,json=restoredSize,proto3" json:"restored_size"` ToRestoreSize int64 `protobuf:"varint,8,opt,name=to_restore_size,json=toRestoreSize,proto3" json:"to_restore_size"` - Progress int32 `protobuf:"varint,9,opt,name=progress,proto3" json:"progress,omitempty"` + Progress int32 `protobuf:"varint,9,opt,name=progress,proto3" json:"progress"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` diff --git a/gen_proto.sh b/gen_proto.sh index dea44c17..bcbd1127 100755 --- a/gen_proto.sh +++ b/gen_proto.sh @@ -33,6 +33,10 @@ sed -i "" -e "s/has_index,omitempty/has_index/g" ./backuppb/backup.pb.go sed -i "" -e "s/data,omitempty/data/g" ./backuppb/backup.pb.go # remove size omitempty sed -i "" -e "s/size,omitempty/size/g" ./backuppb/backup.pb.go +# remove progress omitempty +sed -i "" -e "s/progress,omitempty/progress/g" ./backuppb/backup.pb.go +# remove state_code omitempty +sed -i "" -e "s/state_code,omitempty/state_code/g" ./backuppb/backup.pb.go # to make db_collections field compatible to both json and string #sed -i "" -e "s/*_struct.Value/interface{}/g" ./backuppb/backup.pb.go diff --git a/gen_swag.sh b/gen_swag.sh index 16a7d113..6d704f61 100755 --- a/gen_swag.sh +++ b/gen_swag.sh @@ -36,6 +36,10 @@ sed -i "" -e "s/has_index,omitempty/has_index/g" ./backuppb/backup.pb.go sed -i "" -e "s/data,omitempty/data/g" ./backuppb/backup.pb.go # remove size omitempty sed -i "" -e "s/size,omitempty/size/g" ./backuppb/backup.pb.go +# remove progress omitempty +sed -i "" -e "s/progress,omitempty/progress/g" ./backuppb/backup.pb.go +# remove state_code omitempty +sed -i "" -e "s/state_code,omitempty/state_code/g" ./backuppb/backup.pb.go popd diff --git a/tests/api/milvus_backup.py b/tests/api/milvus_backup.py index 4ef74ce3..8f8a2c8f 100644 --- a/tests/api/milvus_backup.py +++ b/tests/api/milvus_backup.py @@ -151,7 +151,7 @@ def wait_create_backup_complete(self, backup_name, timeout=120): res = self.get_backup(backup_name) while not ready and (end_time - start_time < timeout): state_code = res["data"].get("state_code", 1) - if state_code == 1: + if state_code == 1 or state_code == 0: time.sleep(5) res = self.get_backup(backup_name) end_time = time.time() @@ -173,7 +173,7 @@ def wait_restore_complete(self, id, timeout=120): res = self.get_restore(id) while not ready and end_time - start_time < timeout: state_code = res["data"].get("state_code", 1) - if state_code == 1: + if state_code == 1 or state_code == 0: time.sleep(5) res = self.get_restore(id) end_time = time.time()