Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(snapshot): snapshot tree query optimization #1566

Merged
merged 1 commit into from
Feb 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions io-engine/src/core/snapshot.rs
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,9 @@ pub trait SnapshotOps {
fn list_snapshot_by_snapshot_uuid(&self) -> Vec<VolumeSnapshotDescriptor>;

/// List All Snapshot.
fn list_all_snapshots() -> Vec<VolumeSnapshotDescriptor>;
fn list_all_snapshots(
parent_lvol: Option<&Lvol>,
) -> Vec<VolumeSnapshotDescriptor>;

/// Create snapshot clone.
async fn create_clone(
Expand Down Expand Up @@ -350,13 +352,11 @@ pub trait SnapshotOps {
total_ancestor_snap_size: u64,
) -> Option<u64>;

/// When snapshot is destroyed, reset the parent lvol usage cache and its
/// successor snapshot and clone usage cache.
fn reset_snapshot_parent_successor_usage_cache(&self);

/// When snapshot is destroyed, reset cache of successor snapshots and
/// clones based on snapshot parent uuid.
fn reset_successor_lvol_usage_cache(&self, snapshot_parent_uuid: String);
/// Reset snapshot tree usage cache. if the lvol is replica, then reset
/// cache will be based on replica uuid, which is parent uuid for all
/// snapshots created from the replica. if the lvol is not replica, then
/// reset cache will be judge based on lvol tree present in the system.
fn reset_snapshot_tree_usage_cache(&self, is_replica: bool);
}

/// Traits gives the Snapshots Related Parameters.
Expand Down
6 changes: 4 additions & 2 deletions io-engine/src/grpc/v1/replica.rs
Original file line number Diff line number Diff line change
Expand Up @@ -118,8 +118,10 @@ impl From<LvolSpaceUsage> for ReplicaSpaceUsage {
impl From<Lvol> for Replica {
fn from(l: Lvol) -> Self {
let usage = l.usage();
let source_uuid =
Lvol::get_blob_xattr(&l, CloneXattrs::SourceUuid.name());
let source_uuid = Lvol::get_blob_xattr(
l.blob_checked(),
CloneXattrs::SourceUuid.name(),
);
Self {
name: l.name(),
uuid: l.uuid(),
Expand Down
2 changes: 1 addition & 1 deletion io-engine/src/grpc/v1/snapshot.rs
Original file line number Diff line number Diff line change
Expand Up @@ -510,7 +510,7 @@ impl SnapshotRpc for SnapshotService {
} else {
// if source_uuid is not input, list all snapshot
// present in system
snapshots = Lvol::list_all_snapshots()
snapshots = Lvol::list_all_snapshots(None)
.into_iter()
.map(SnapshotInfo::from)
.collect();
Expand Down
Loading
Loading