You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hudi.apache.org by GitBox <gi...@apache.org> on 2020/09/26 04:29:06 UTC

[GitHub] [hudi] dugenkui03 opened a new pull request #2115: [MINOR] Mark started and shutdownRequested with volatile.

dugenkui03 opened a new pull request #2115:
URL: https://github.com/apache/hudi/pull/2115


   Mark `started` and `shutdownRequested` with volatile.
   
   Add getter method for `started`.


----------------------------------------------------------------
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:
users@infra.apache.org



[GitHub] [hudi] dugenkui03 commented on a change in pull request #2115: [MINOR] Mark started and shutdownRequested with volatile.

Posted by GitBox <gi...@apache.org>.
dugenkui03 commented on a change in pull request #2115:
URL: https://github.com/apache/hudi/pull/2115#discussion_r497315599



##########
File path: hudi-client/src/main/java/org/apache/hudi/async/AbstractAsyncService.java
##########
@@ -39,9 +39,9 @@
   private static final Logger LOG = LogManager.getLogger(AbstractAsyncService.class);
 
   // Flag to track if the service is started.
-  private boolean started;
+  private volatile boolean started;

Review comment:
       I think `started ` will be read by multiple thread, so it is necessary to guarantee the visibility of `start`. As well as `shutdownRequested `.
   
   May be I misunderstand the usage scenario of them.
   
   I convert this PR to draft for the moment.




----------------------------------------------------------------
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:
users@infra.apache.org



[GitHub] [hudi] leesf commented on a change in pull request #2115: [MINOR] Mark started and shutdownRequested with volatile.

Posted by GitBox <gi...@apache.org>.
leesf commented on a change in pull request #2115:
URL: https://github.com/apache/hudi/pull/2115#discussion_r495452858



##########
File path: hudi-client/src/main/java/org/apache/hudi/async/AbstractAsyncService.java
##########
@@ -39,9 +39,9 @@
   private static final Logger LOG = LogManager.getLogger(AbstractAsyncService.class);
 
   // Flag to track if the service is started.
-  private boolean started;
+  private volatile boolean started;

Review comment:
       Sorry, I don't get the point here, would you please describe it in more details why need this change?




----------------------------------------------------------------
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:
users@infra.apache.org



[GitHub] [hudi] dugenkui03 commented on a change in pull request #2115: [MINOR] Mark started and shutdownRequested with volatile.

Posted by GitBox <gi...@apache.org>.
dugenkui03 commented on a change in pull request #2115:
URL: https://github.com/apache/hudi/pull/2115#discussion_r495459478



##########
File path: hudi-client/src/main/java/org/apache/hudi/async/AbstractAsyncService.java
##########
@@ -39,9 +39,9 @@
   private static final Logger LOG = LogManager.getLogger(AbstractAsyncService.class);
 
   // Flag to track if the service is started.
-  private boolean started;
+  private volatile boolean started;

Review comment:
       The purpose of this change is ensure the visibility of `started` and `shutdownRequested`.
   
   The getter method `isStarted()` provide a way to read the service status.




----------------------------------------------------------------
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:
users@infra.apache.org



[GitHub] [hudi] vinothchandar commented on a change in pull request #2115: [MINOR] Mark started and shutdownRequested with volatile.

Posted by GitBox <gi...@apache.org>.
vinothchandar commented on a change in pull request #2115:
URL: https://github.com/apache/hudi/pull/2115#discussion_r499304240



##########
File path: hudi-client/src/main/java/org/apache/hudi/async/AbstractAsyncService.java
##########
@@ -39,9 +39,9 @@
   private static final Logger LOG = LogManager.getLogger(AbstractAsyncService.class);
 
   // Flag to track if the service is started.
-  private boolean started;
+  private volatile boolean started;

Review comment:
       I think it makes sense to do this. `volatile` will ensure the other thread sees the update right away 




----------------------------------------------------------------
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:
users@infra.apache.org



[GitHub] [hudi] dugenkui03 commented on a change in pull request #2115: [MINOR] Mark started and shutdownRequested with volatile.

Posted by GitBox <gi...@apache.org>.
dugenkui03 commented on a change in pull request #2115:
URL: https://github.com/apache/hudi/pull/2115#discussion_r495459478



##########
File path: hudi-client/src/main/java/org/apache/hudi/async/AbstractAsyncService.java
##########
@@ -39,9 +39,9 @@
   private static final Logger LOG = LogManager.getLogger(AbstractAsyncService.class);
 
   // Flag to track if the service is started.
-  private boolean started;
+  private volatile boolean started;

Review comment:
       The purpose of `volatile` is to ensure the visibility of `started` and `shutdownRequested`.
   
   The getter method `isStarted()` provide a way to read the service status.




----------------------------------------------------------------
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:
users@infra.apache.org



[GitHub] [hudi] dugenkui03 commented on a change in pull request #2115: [MINOR] Mark started and shutdownRequested with volatile.

Posted by GitBox <gi...@apache.org>.
dugenkui03 commented on a change in pull request #2115:
URL: https://github.com/apache/hudi/pull/2115#discussion_r495459478



##########
File path: hudi-client/src/main/java/org/apache/hudi/async/AbstractAsyncService.java
##########
@@ -39,9 +39,9 @@
   private static final Logger LOG = LogManager.getLogger(AbstractAsyncService.class);
 
   // Flag to track if the service is started.
-  private boolean started;
+  private volatile boolean started;

Review comment:
       The purpose of `volatile` is ensure the visibility of `started` and `shutdownRequested`.
   
   The getter method `isStarted()` provide a way to read the service status.




----------------------------------------------------------------
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:
users@infra.apache.org



[GitHub] [hudi] dugenkui03 commented on a change in pull request #2115: [MINOR] Mark started and shutdownRequested with volatile.

Posted by GitBox <gi...@apache.org>.
dugenkui03 commented on a change in pull request #2115:
URL: https://github.com/apache/hudi/pull/2115#discussion_r497315599



##########
File path: hudi-client/src/main/java/org/apache/hudi/async/AbstractAsyncService.java
##########
@@ -39,9 +39,9 @@
   private static final Logger LOG = LogManager.getLogger(AbstractAsyncService.class);
 
   // Flag to track if the service is started.
-  private boolean started;
+  private volatile boolean started;

Review comment:
       I think `started ` will be read by multiple thread, so it is necessary to guarantee the visibility of `start`. As well as `shutdownRequested `.
   
   May be I misunderstand the usage scenario of them. I convert this PR to draft for the moment, until i make sure that this change is necessary or not.




----------------------------------------------------------------
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:
users@infra.apache.org



[GitHub] [hudi] leesf commented on a change in pull request #2115: [MINOR] Mark started and shutdownRequested with volatile.

Posted by GitBox <gi...@apache.org>.
leesf commented on a change in pull request #2115:
URL: https://github.com/apache/hudi/pull/2115#discussion_r497482755



##########
File path: hudi-client/src/main/java/org/apache/hudi/async/AbstractAsyncService.java
##########
@@ -39,9 +39,9 @@
   private static final Logger LOG = LogManager.getLogger(AbstractAsyncService.class);
 
   // Flag to track if the service is started.
-  private boolean started;
+  private volatile boolean started;

Review comment:
       > I think `started ` will be read by multiple thread, so it is necessary to guarantee the visibility of `start`. As well as `shutdownRequested `.
   > 
   > May be I misunderstand the usage scenario of them. I convert this PR to draft for the moment, until i make sure that this change is necessary or not.
   
   OK




----------------------------------------------------------------
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:
users@infra.apache.org



[GitHub] [hudi] leesf commented on a change in pull request #2115: [MINOR] Mark started and shutdownRequested with volatile.

Posted by GitBox <gi...@apache.org>.
leesf commented on a change in pull request #2115:
URL: https://github.com/apache/hudi/pull/2115#discussion_r496810222



##########
File path: hudi-client/src/main/java/org/apache/hudi/async/AbstractAsyncService.java
##########
@@ -39,9 +39,9 @@
   private static final Logger LOG = LogManager.getLogger(AbstractAsyncService.class);
 
   // Flag to track if the service is started.
-  private boolean started;
+  private volatile boolean started;

Review comment:
       @dugenkui03 hi, sorry for the late reply. Is it necessary to change to volatile and what's the problem of current approach?




----------------------------------------------------------------
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:
users@infra.apache.org



[GitHub] [hudi] vinothchandar closed pull request #2115: [MINOR] Mark started and shutdownRequested with volatile.

Posted by GitBox <gi...@apache.org>.
vinothchandar closed pull request #2115:
URL: https://github.com/apache/hudi/pull/2115


   


----------------------------------------------------------------
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:
users@infra.apache.org