Add CBT interfaces for block data mover#9716
Conversation
7a42c44 to
874e505
Compare
874e505 to
617024f
Compare
e91e12c to
afcb864
Compare
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
Signed-off-by: Lyndon-Li <lyonghui@vmware.com>
afcb864 to
97ffb9e
Compare
bad491a to
cbcd437
Compare
|
@kaovilai Please help to take another look, I made some adjustments. |
| GetAllocatedBlocks(ctx context.Context, snapshot string, record func([]Range) error) error | ||
|
|
||
| // GetChangedBlocks enumerates the changed blocks of the snapshot since PIT of changeID and call the record callback | ||
| GetChangedBlocks(ctx context.Context, snapshot string, changeID string, record func([]Range) error) error |
There was a problem hiding this comment.
To maintain consistency with the SnapshotMetadataService specification, should we align the input parameters of GetChangedBlocks with GetMetadataDeltaRequest, which contain "base_snapshot_id", "target_snapshot_name", "starting_offset", etc?
Same for the method "GetAllocatedBlocks".
There was a problem hiding this comment.
This was covered in the design perhaps to be abstract just in case.
ChangeId
ChangeId identifies the base that CBT is generated from, it must strictly map to the parent snapshot in the repository. Otherwise, there will be data corruption in the incremental backup.
Therefore, ChangeId is saved together with the repository snapshot.
The data mover always queries parent snapshot from Unified Repo together with the ChangeId. In this way, no mismatch would happen.
Inside the uploader, the upper layer (DataUpload controller) could also provide the ChangeId as a mechanism of double confirmation. The received ChangeId would be re-evaluated against the one in the provided snapshot.For Kubernetes API, changeId is represented by
BaseSnapshotId.
changeId retrieval is storage specific, generally, it is retrieved from theSnapshotHandleof the VolumeSnapshotContent object; however, storages may also refer to other places to retrieve the changeId.
That is,SnapshotHandleand changeId may be two different values, in this case, the both values need to be preserved.
There was a problem hiding this comment.
This is an abstraction provided by Velero, as the design shared by @kaovilai, this abstraction is for the below purpose:
- Support both Kubernetes native CBT service (SnapshotMetadataService) and the possible customized CBT service
- It is used by the uploader to translate the entire allocated/changed blocks into the CBT bitmap
Because of 1, the abstraction just purposefully avoids to use the primatives from Kubernetes upstream, e.g., in the upstream target_snapshot_name means the name of the VolumeSnapshot, however, for customized CBT service, it could not be the name of VolumeSnapshot or even not a name (e.g., a snapshot ID instead).
Because of 2, it means it is a special/compacted version when comparing to the upstream primitives, e.g., starting_offset is not required since the uploader always expects to translates the entire CBT, from the begining to end.
cbcd437 to
f8de21a
Compare
EunbiZhang
left a comment
There was a problem hiding this comment.
Looks good to me as far as I can tell. Thanks for working on the change Lyndon!
Signed-off-by: Lyndon-Li <lyonghui@vmware.com>
f8de21a to
2ca4e46
Compare
|
@kaovilai @EunbiZhang For the same PVC, the underlying volumes may be changed, but the CBT associates to the a specific volume only. So the |
Fix issue #9709, add interfaces for CBT service and CBT bitmap