adoroszlai commented on code in PR #9261:
URL: https://github.com/apache/ozone/pull/9261#discussion_r2503153105
##########
hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/ozone/client/rpc/OzoneRpcClientTests.java:
##########
@@ -4637,52 +4637,35 @@ private void createRequiredForVersioningTest(String
volumeName,
private void checkExceptedResultForVersioningTest(String volumeName,
String bucketName, String keyName, int expectedCount) throws Exception {
- // Get actual bucket layout from the bucket itself to avoid mismatch
- String bucketKey = cluster.getOzoneManager().getMetadataManager()
- .getBucketKey(volumeName, bucketName);
- BucketLayout actualLayout = cluster.getOzoneManager().getMetadataManager()
- .getBucketTable().get(bucketKey).getBucketLayout();
-
- OmKeyInfo omKeyInfo = cluster.getOzoneManager().getMetadataManager()
- .getKeyTable(actualLayout).get(
- cluster.getOzoneManager().getMetadataManager()
- .getOzoneKey(volumeName, bucketName, keyName));
+ OMMetadataManager metadataManager =
cluster.getOzoneManager().getMetadataManager();
+ String ozoneKey = metadataManager.getOzoneKey(volumeName, bucketName,
keyName);
+
+ OmKeyInfo omKeyInfo =
metadataManager.getKeyTable(getBucketLayout()).get(ozoneKey);
Review Comment:
The part of the change related to `getBucketLayout()` should not be
reverted, because this test uses a different layout:
https://github.com/apache/ozone/blob/c6d7bd1f79fd151066c652ea87f27e7a0725e80f/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/ozone/client/rpc/OzoneRpcClientTests.java#L4608-L4609
vs.
https://github.com/apache/ozone/blob/c6d7bd1f79fd151066c652ea87f27e7a0725e80f/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/ozone/client/rpc/OzoneRpcClientTests.java#L4623-L4627
To simplify things, maybe we should add a constant referencing
`OBJECT_STORE`, and use it in both `createRequiredForVersioningTest` and
`checkExceptedResultForVersioningTest`.
##########
hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/ozone/client/rpc/OzoneRpcClientTests.java:
##########
@@ -4637,52 +4637,35 @@ private void createRequiredForVersioningTest(String
volumeName,
private void checkExceptedResultForVersioningTest(String volumeName,
String bucketName, String keyName, int expectedCount) throws Exception {
- // Get actual bucket layout from the bucket itself to avoid mismatch
- String bucketKey = cluster.getOzoneManager().getMetadataManager()
- .getBucketKey(volumeName, bucketName);
- BucketLayout actualLayout = cluster.getOzoneManager().getMetadataManager()
- .getBucketTable().get(bucketKey).getBucketLayout();
-
- OmKeyInfo omKeyInfo = cluster.getOzoneManager().getMetadataManager()
- .getKeyTable(actualLayout).get(
- cluster.getOzoneManager().getMetadataManager()
- .getOzoneKey(volumeName, bucketName, keyName));
+ OMMetadataManager metadataManager =
cluster.getOzoneManager().getMetadataManager();
+ String ozoneKey = metadataManager.getOzoneKey(volumeName, bucketName,
keyName);
+
+ OmKeyInfo omKeyInfo =
metadataManager.getKeyTable(getBucketLayout()).get(ozoneKey);
assertNotNull(omKeyInfo);
- assertEquals(expectedCount,
- omKeyInfo.getKeyLocationVersions().size());
+ assertEquals(expectedCount, omKeyInfo.getKeyLocationVersions().size());
+ // Suspend KeyDeletingService to prevent it from purging entries from
deleted table
+ cluster.getOzoneManager().getKeyManager().getDeletingService().suspend();
// ensure flush double buffer for deleted Table
cluster.getOzoneManager().awaitDoubleBufferFlush();
if (expectedCount == 1) {
- // Wait for deleted key to become visible in deletedTable
- String ozoneKey = cluster.getOzoneManager().getMetadataManager()
- .getOzoneKey(volumeName, bucketName, keyName);
- GenericTestUtils.waitFor((CheckedSupplier<Boolean, IOException>) () -> {
- List<? extends Table.KeyValue<String, RepeatedOmKeyInfo>> rangeKVs
- = cluster.getOzoneManager().getMetadataManager().getDeletedTable()
- .getRangeKVs(null, 100, ozoneKey);
- return !rangeKVs.isEmpty();
- }, 100, 60000);
-
List<? extends Table.KeyValue<String, RepeatedOmKeyInfo>> rangeKVs
- = cluster.getOzoneManager().getMetadataManager().getDeletedTable()
- .getRangeKVs(null, 100, ozoneKey);
+ = metadataManager.getDeletedTable().getRangeKVs(null, 100, ozoneKey);
- assertThat(rangeKVs).isNotEmpty();
+ assertThat(rangeKVs.size()).isGreaterThan(0);
Review Comment:
Let's also keep `isNotEmpty()`.
--
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]