swamirishi commented on code in PR #9328:
URL: https://github.com/apache/ozone/pull/9328#discussion_r2558124608
##########
hadoop-ozone/ozone-manager/src/test/java/org/apache/hadoop/ozone/om/response/snapshot/TestOMSnapshotMoveTableKeysResponse.java:
##########
@@ -163,10 +164,18 @@ public void testMoveTableKeysToNextSnapshot(boolean
nextSnapshotExists) throws E
.setCmdType(OzoneManagerProtocolProtos.Type.SnapshotMoveTableKeys).build(),
snapshotInfo1, nextSnapshotExists ? snapshotInfo2 : null,
omBucketInfo.getObjectID(), deletedTable,
deletedDirTable, renamedTable);
- try (BatchOperation batchOperation =
getOmMetadataManager().getStore().initBatchOperation()) {
- response.addToDBBatch(getOmMetadataManager(), batchOperation);
- getOmMetadataManager().getStore().commitBatchOperation(batchOperation);
- }
+ CompletableFuture<Void> future = new CompletableFuture<>();
+ CompletableFuture.runAsync(() -> {
+ try (BatchOperation batchOperation =
getOmMetadataManager().getStore().initBatchOperation()) {
+ response.addToDBBatch(getOmMetadataManager(), batchOperation);
+
getOmMetadataManager().getStore().commitBatchOperation(batchOperation);
+ } catch (IOException e) {
+ future.completeExceptionally(e);
+ return;
+ }
+ future.complete(null);
+ });
+ future.get();
Review Comment:
oh this is because the now the lock acquisition can only happen in a
different thread. The test thread currently holds lock for snapshot which would
hold Snapshot_DB_LOCK and now that we are preventing SNAPSHOT_CONTENT_LOCK to
be acquired while SNAPSHOT_DB_LOCK is held by the same thread the test thread
cannot flush the response. Separate thread would be able to run it.
--
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]