[GitHub] [hadoop-ozone] dineshchitlangia commented on a change in pull request #942: HDDS-2556. Handle InterruptedException in BlockOutputStream

2020-05-21 Thread GitBox


dineshchitlangia commented on a change in pull request #942:
URL: https://github.com/apache/hadoop-ozone/pull/942#discussion_r428942398



##
File path: 
hadoop-hdds/client/src/main/java/org/apache/hadoop/hdds/scm/storage/BlockOutputStream.java
##
@@ -654,4 +662,34 @@ private void writeChunkToContainer(ChunkBuffer chunk) 
throws IOException {
   public void setXceiverClient(XceiverClientSpi xceiverClient) {
 this.xceiverClient = xceiverClient;
   }
+
+  /**
+   * Handles InterruptedExecution.
+   *
+   * @param ex
+   * @param skipExecutionException is optional, if passed as TRUE, then
+   * handle ExecutionException else skip it.
+   * @throws IOException
+   */
+  private void handleInterruptedException(Exception ex,
+  boolean skipExecutionException)
+  throws IOException {
+LOG.error("Command execution was interrupted.");
+if(skipExecutionException) {

Review comment:
   Addressed in latest commit.





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.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



-
To unsubscribe, e-mail: ozone-issues-unsubscr...@hadoop.apache.org
For additional commands, e-mail: ozone-issues-h...@hadoop.apache.org



[GitHub] [hadoop-ozone] dineshchitlangia commented on a change in pull request #942: HDDS-2556. Handle InterruptedException in BlockOutputStream

2020-05-20 Thread GitBox


dineshchitlangia commented on a change in pull request #942:
URL: https://github.com/apache/hadoop-ozone/pull/942#discussion_r428424600



##
File path: 
hadoop-hdds/client/src/main/java/org/apache/hadoop/hdds/scm/storage/BlockOutputStream.java
##
@@ -317,10 +317,16 @@ private void handleFullBuffer() throws IOException {
   if (!commitWatcher.getFutureMap().isEmpty()) {
 waitOnFlushFutures();
   }
-} catch (InterruptedException | ExecutionException e) {
+} catch (ExecutionException e) {
   setIoException(e);
   adjustBuffersOnException();
   throw getIoException();
+} catch (InterruptedException ex) {
+  LOG.error("Command execution was interrupted.");
+  Thread.currentThread().interrupt();
+  setIoException(ex);
+  adjustBuffersOnException();

Review comment:
   @bharatviswa504  I have tried to move the duplicate lines to separate 
method and also perform other cleanups. 
   At the very least, the thread interrupt must be done in the catch block and 
not in a separate method being called from the catch block. So, the 
thread.interrupt() is the only line that cannot be avoided from being 
duplicated.





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.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



-
To unsubscribe, e-mail: ozone-issues-unsubscr...@hadoop.apache.org
For additional commands, e-mail: ozone-issues-h...@hadoop.apache.org