sumitagrawl commented on code in PR #8022:
URL: https://github.com/apache/ozone/pull/8022#discussion_r1988438813
##########
hadoop-hdds/container-service/src/main/java/org/apache/hadoop/ozone/container/common/transport/server/ratis/ContainerStateMachine.java:
##########
@@ -564,79 +604,111 @@ private CompletableFuture<Message> writeStateMachineData(
.setContainer2BCSIDMap(container2BCSIDMap)
.build();
CompletableFuture<Message> raftFuture = new CompletableFuture<>();
- // ensure the write chunk happens asynchronously in writeChunkExecutor pool
- // thread.
- CompletableFuture<ContainerCommandResponseProto> writeChunkFuture =
- CompletableFuture.supplyAsync(() -> {
- try {
- try {
- checkContainerHealthy(write.getBlockID().getContainerID(), true);
- } catch (StorageContainerException e) {
- return ContainerUtils.logAndReturnError(LOG, e, requestProto);
- }
- metrics.recordWriteStateMachineQueueingLatencyNs(
- Time.monotonicNowNanos() - startTime);
- return dispatchCommand(requestProto, context);
- } catch (Exception e) {
- LOG.error("{}: writeChunk writeStateMachineData failed: blockId" +
+ // ensure the write chunk happens asynchronously in writeChunkExecutor
pool thread.
+ Future<ContainerCommandResponseProto> future =
getChunkExecutor(requestProto.getWriteChunk()).submit(() -> {
Review Comment:
CompetableFuture do not support cancel() operation to interrupt running
thread. Tested same and it was not working, so replaced with Future as
suggeted. below is reference as used...
https://stackoverflow.com/questions/29013831/how-to-interrupt-underlying-execution-of-completablefuture
`
Since (unlike FutureTask) this class has no direct control over the
computation that causes it to be completed, cancellation is treated as just
another form of exceptional completion. Method cancel has the same effect as
completeExceptionally(new CancellationException()).
`
--
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]