Skip to content

Commit 071c280

Browse files
authored
Merge pull request #95 from wayblink/update-ts
Add physical timestamp
2 parents 0de7e70 + 3352dd8 commit 071c280

File tree

7 files changed

+216
-185
lines changed

7 files changed

+216
-185
lines changed

core/backup_context.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -471,6 +471,7 @@ func (b BackupContext) executeCreateBackup(ctx context.Context, request *backupp
471471
zap.Int64s("flushedSegmentIDs", flushedSegmentIDs),
472472
zap.Int64("timeOfSeal", timeOfSeal))
473473
collection.BackupTimestamp = utils.ComposeTS(timeOfSeal, 0)
474+
collection.BackupPhysicalTimestamp = uint64(timeOfSeal)
474475

475476
flushSegments := append(newSealedSegmentIDs, flushedSegmentIDs...)
476477
segmentEntities, err := b.milvusClient.GetPersistentSegmentInfo(ctx, collection.GetCollectionName())

core/backup_meta.go

Lines changed: 23 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -49,17 +49,18 @@ func treeToLevel(backup *backuppb.BackupInfo) (LeveledBackupInfo, error) {
4949

5050
for _, collectionBack := range backup.GetCollectionBackups() {
5151
cloneCollectionBackup := &backuppb.CollectionBackupInfo{
52-
CollectionId: collectionBack.GetCollectionId(),
53-
DbName: collectionBack.GetDbName(),
54-
CollectionName: collectionBack.GetCollectionName(),
55-
Schema: collectionBack.GetSchema(),
56-
ShardsNum: collectionBack.GetShardsNum(),
57-
ConsistencyLevel: collectionBack.GetConsistencyLevel(),
58-
BackupTimestamp: collectionBack.GetBackupTimestamp(),
59-
Size: collectionBack.GetSize(),
60-
HasIndex: collectionBack.GetHasIndex(),
61-
IndexInfos: collectionBack.GetIndexInfos(),
62-
LoadState: collectionBack.GetLoadState(),
52+
CollectionId: collectionBack.GetCollectionId(),
53+
DbName: collectionBack.GetDbName(),
54+
CollectionName: collectionBack.GetCollectionName(),
55+
Schema: collectionBack.GetSchema(),
56+
ShardsNum: collectionBack.GetShardsNum(),
57+
ConsistencyLevel: collectionBack.GetConsistencyLevel(),
58+
BackupTimestamp: collectionBack.GetBackupTimestamp(),
59+
Size: collectionBack.GetSize(),
60+
HasIndex: collectionBack.GetHasIndex(),
61+
IndexInfos: collectionBack.GetIndexInfos(),
62+
LoadState: collectionBack.GetLoadState(),
63+
BackupPhysicalTimestamp: collectionBack.GetBackupPhysicalTimestamp(),
6364
}
6465
collections = append(collections, cloneCollectionBackup)
6566

@@ -257,16 +258,17 @@ func SimpleBackupResponse(input *backuppb.BackupInfoResponse) *backuppb.BackupIn
257258
collections := make([]*backuppb.CollectionBackupInfo, 0)
258259
for _, coll := range backup.GetCollectionBackups() {
259260
collections = append(collections, &backuppb.CollectionBackupInfo{
260-
StateCode: coll.GetStateCode(),
261-
ErrorMessage: coll.GetErrorMessage(),
262-
CollectionName: coll.GetCollectionName(),
263-
BackupTimestamp: coll.GetBackupTimestamp(),
264-
HasIndex: coll.GetHasIndex(),
265-
IndexInfos: coll.GetIndexInfos(),
266-
LoadState: coll.GetLoadState(),
267-
Schema: coll.GetSchema(),
268-
Size: coll.GetSize(),
269-
Progress: coll.GetProgress(),
261+
StateCode: coll.GetStateCode(),
262+
ErrorMessage: coll.GetErrorMessage(),
263+
CollectionName: coll.GetCollectionName(),
264+
BackupTimestamp: coll.GetBackupTimestamp(),
265+
HasIndex: coll.GetHasIndex(),
266+
IndexInfos: coll.GetIndexInfos(),
267+
LoadState: coll.GetLoadState(),
268+
Schema: coll.GetSchema(),
269+
Size: coll.GetSize(),
270+
Progress: coll.GetProgress(),
271+
BackupPhysicalTimestamp: coll.GetBackupPhysicalTimestamp(),
270272
})
271273
}
272274
simpleBackupInfo := &backuppb.BackupInfo{

core/proto/backup.proto

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,11 +51,14 @@ message CollectionBackupInfo {
5151
int32 shards_num = 11;
5252
ConsistencyLevel consistency_level = 12;
5353
repeated PartitionBackupInfo partition_backups = 13;
54+
// logical time of backup, used for restore
5455
uint64 backup_timestamp = 14;
5556
int64 size = 15;
5657
bool has_index = 16;
5758
repeated IndexInfo index_infos = 17;
5859
string load_state = 18;
60+
// physical unix time of backup
61+
uint64 backup_physical_timestamp = 19;
5962
}
6063

6164
message PartitionBackupInfo {

0 commit comments

Comments
 (0)