prashantpogde commented on code in PR #7200:
URL: https://github.com/apache/ozone/pull/7200#discussion_r1767412520
##########
hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/ozone/om/snapshot/TestSnapshotDeletingService.java:
##########
@@ -482,70 +683,143 @@ private void createSnapshotDataForBucket1() throws
Exception {
OmMetadataManagerImpl metadataManager = (OmMetadataManagerImpl)
om.getMetadataManager();
- TestDataUtil.createKey(bucket1, "bucket1key0", ReplicationFactor.THREE,
+ TestDataUtil.createKey(bucket, bucket.getName() + "key0",
ReplicationFactor.THREE,
ReplicationType.RATIS, CONTENT);
- TestDataUtil.createKey(bucket1, "bucket1key1", ReplicationFactor.THREE,
+ TestDataUtil.createKey(bucket, bucket.getName() + "key1",
ReplicationFactor.THREE,
ReplicationType.RATIS, CONTENT);
assertTableRowCount(keyTable, 2);
// Create Snapshot 1.
- client.getProxy().createSnapshot(VOLUME_NAME, BUCKET_NAME_ONE,
- "bucket1snap1");
+ client.getProxy().createSnapshot(bucket.getVolumeName(), bucket.getName(),
+ bucket.getName() + "snap1");
assertTableRowCount(snapshotInfoTable, 1);
// Overwrite bucket1key0, This is a newer version of the key which should
// reclaimed as this is a different version of the key.
- TestDataUtil.createKey(bucket1, "bucket1key0", ReplicationFactor.THREE,
+ TestDataUtil.createKey(bucket, bucket.getName() + "key0",
ReplicationFactor.THREE,
ReplicationType.RATIS, CONTENT);
- TestDataUtil.createKey(bucket1, "bucket1key2", ReplicationFactor.THREE,
+ TestDataUtil.createKey(bucket, bucket.getName() + "key2",
ReplicationFactor.THREE,
ReplicationType.RATIS, CONTENT);
// Key 1 cannot be reclaimed as it is still referenced by Snapshot 1.
- client.getProxy().deleteKey(VOLUME_NAME, BUCKET_NAME_ONE,
- "bucket1key1", false);
+ client.getProxy().deleteKey(bucket.getVolumeName(), bucket.getName(),
+ bucket.getName() + "key1", false);
// Key 2 is deleted here, which will be reclaimed here as
// it is not being referenced by previous snapshot.
- client.getProxy().deleteKey(VOLUME_NAME, BUCKET_NAME_ONE,
- "bucket1key2", false);
- client.getProxy().deleteKey(VOLUME_NAME, BUCKET_NAME_ONE,
- "bucket1key0", false);
+ client.getProxy().deleteKey(bucket.getVolumeName(), bucket.getName(),
+ bucket.getName() + "key2", false);
+ client.getProxy().deleteKey(bucket.getVolumeName(), bucket.getName(),
+ bucket.getName() + "key0", false);
assertTableRowCount(keyTable, 0);
// one copy of bucket1key0 should also be reclaimed as it not same
// but original deleted key created during overwrite should not be deleted
assertTableRowCount(deletedTable, 2);
// Create Snapshot 2.
- client.getProxy().createSnapshot(VOLUME_NAME, BUCKET_NAME_ONE,
- "bucket1snap2");
+ client.getProxy().createSnapshot(bucket.getVolumeName(), bucket.getName(),
+ bucket.getName() + "snap2");
assertTableRowCount(snapshotInfoTable, 2);
// Key 2 is removed from the active Db's
// deletedTable when Snapshot 2 is taken.
assertTableRowCount(deletedTable, 0);
- TestDataUtil.createKey(bucket1, "bucket1key3", ReplicationFactor.THREE,
+ TestDataUtil.createKey(bucket, bucket.getName() + "key3",
ReplicationFactor.THREE,
ReplicationType.RATIS, CONTENT);
- TestDataUtil.createKey(bucket1, "bucket1key4", ReplicationFactor.THREE,
+ TestDataUtil.createKey(bucket, bucket.getName() + "key4",
ReplicationFactor.THREE,
ReplicationType.RATIS, CONTENT);
- client.getProxy().deleteKey(VOLUME_NAME, BUCKET_NAME_ONE,
- "bucket1key4", false);
+ client.getProxy().deleteKey(bucket.getVolumeName(), bucket.getName(),
+ bucket.getName() + "key4", false);
assertTableRowCount(keyTable, 1);
assertTableRowCount(deletedTable, 0);
// Create Snapshot 3.
- client.getProxy().createSnapshot(VOLUME_NAME, BUCKET_NAME_ONE,
- "bucket1snap3");
+ client.getProxy().createSnapshot(bucket.getVolumeName(), bucket.getName(),
+ bucket.getName() + "snap3");
assertTableRowCount(snapshotInfoTable, 3);
SnapshotInfo snapshotInfo = metadataManager.getSnapshotInfoTable()
- .get("/vol1/bucket1/bucket1snap2");
+ .get(String.format("/%s/%s/%ssnap2", bucket.getVolumeName(),
bucket.getName(), bucket.getName()));
// Delete Snapshot 2.
- client.getProxy().deleteSnapshot(VOLUME_NAME, BUCKET_NAME_ONE,
- "bucket1snap2");
+ client.getProxy().deleteSnapshot(bucket.getVolumeName(), bucket.getName(),
+ bucket.getName() + "snap2");
assertTableRowCount(snapshotInfoTable, 2);
- verifySnapshotChain(snapshotInfo, "/vol1/bucket1/bucket1snap3");
+ verifySnapshotChain(snapshotInfo, String.format("/%s/%s/%ssnap3",
bucket.getVolumeName(), bucket.getName(),
+ bucket.getName()));
}
+
Review Comment:
Can we have a test case where we have a type snapshot chain such that some
keys are reclaimable, some keys are getting renamed multiple times between
snapshots, and some of those keys are also common with delete table? Then we
let the snapshot deletion service run on this chain and make sure that AOS has
the correct merge of all these keys. These asserts at various deletion stages
would make a one comprehensive test case.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]