Skip to content

Commit

Permalink
Add a full_meta.json store the complete metadata
Browse files Browse the repository at this point in the history
Signed-off-by: wayblink <anyang.wang@zilliz.com>
  • Loading branch information
wayblink committed Jul 19, 2023
1 parent 6011511 commit e4d81e5
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 1 deletion.
1 change: 1 addition & 0 deletions core/backup_impl_create_backup.go
Original file line number Diff line number Diff line change
Expand Up @@ -570,6 +570,7 @@ func (b BackupContext) executeCreateBackup(ctx context.Context, request *backupp
b.getStorageClient().Write(ctx, b.backupBucketName, CollectionMetaPath(b.backupRootPath, backupInfo.GetName()), output.CollectionMetaBytes)
b.getStorageClient().Write(ctx, b.backupBucketName, PartitionMetaPath(b.backupRootPath, backupInfo.GetName()), output.PartitionMetaBytes)
b.getStorageClient().Write(ctx, b.backupBucketName, SegmentMetaPath(b.backupRootPath, backupInfo.GetName()), output.SegmentMetaBytes)
b.getStorageClient().Write(ctx, b.backupBucketName, FullMetaPath(b.backupRootPath, backupInfo.GetName()), output.FullMetaBytes)

log.Info("finish executeCreateBackup",
zap.String("requestId", request.GetRequestId()),
Expand Down
11 changes: 11 additions & 0 deletions core/backup_meta.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ const (
COLLECTION_META_FILE = "collection_meta.json"
PARTITION_META_FILE = "partition_meta.json"
SEGMENT_META_FILE = "segment_meta.json"
FULL_META_FILE = "full_meta.json"
SEPERATOR = "/"

BINGLOG_DIR = "binlogs"
Expand All @@ -32,6 +33,7 @@ type BackupMetaBytes struct {
CollectionMetaBytes []byte
PartitionMetaBytes []byte
SegmentMetaBytes []byte
FullMetaBytes []byte
}

type LeveledBackupInfo struct {
Expand Down Expand Up @@ -130,12 +132,17 @@ func serialize(backup *backuppb.BackupInfo) (*BackupMetaBytes, error) {
if err != nil {
return nil, err
}
fullMetaBytes, err := json.Marshal(backup)
if err != nil {
return nil, err
}

return &BackupMetaBytes{
BackupMetaBytes: backupMetaBytes,
CollectionMetaBytes: collectionBackupMetaBytes,
PartitionMetaBytes: partitionBackupMetaBytes,
SegmentMetaBytes: segmentBackupMetaBytes,
FullMetaBytes: fullMetaBytes,
}, nil
}

Expand Down Expand Up @@ -229,6 +236,10 @@ func SegmentMetaPath(backupRootPath, backupName string) string {
return BackupMetaDirPath(backupRootPath, backupName) + SEPERATOR + SEGMENT_META_FILE
}

func FullMetaPath(backupRootPath, backupName string) string {
return BackupMetaDirPath(backupRootPath, backupName) + SEPERATOR + FULL_META_FILE
}

func BackupBinlogDirPath(backupRootPath, backupName string) string {
return backupRootPath + SEPERATOR + backupName + SEPERATOR + BINGLOG_DIR
}
Expand Down
2 changes: 1 addition & 1 deletion example/db_support/prepare_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@
insert_result2 = hello_milvus2.insert(entities2)
hello_milvus2.flush()

index_params2 = {"index_type": "TRIE"}
index_params2 = {"index_type": "Trie"}
hello_milvus2.create_index("var", index_params2)

print(f"Number of entities in hello_milvus2: {hello_milvus2.num_entities}") # check the num_entites
Expand Down

0 comments on commit e4d81e5

Please sign in to comment.