You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@ozone.apache.org by GitBox <gi...@apache.org> on 2019/12/06 01:16:54 UTC

[GitHub] [hadoop-ozone] mukul1987 commented on a change in pull request #310: HDDS-2542: Race condition between read and write stateMachineData.

mukul1987 commented on a change in pull request #310: HDDS-2542: Race condition between read and write stateMachineData.
URL: https://github.com/apache/hadoop-ozone/pull/310#discussion_r354409598
 
 

 ##########
 File path: hadoop-hdds/container-service/src/main/java/org/apache/hadoop/ozone/container/common/transport/server/ratis/ContainerStateMachine.java
 ##########
 @@ -588,10 +593,14 @@ private ByteString readStateMachineData(
   /**
    * Reads the Entry from the Cache or loads it back by reading from disk.
    */
-  private ByteString getCachedStateMachineData(Long logIndex, long term,
-      ContainerCommandRequestProto requestProto) throws ExecutionException {
-    return stateMachineDataCache.get(logIndex,
-        () -> readStateMachineData(requestProto, term, logIndex));
+  private ByteString getStateMachineData(Long logIndex, long term,
+      ContainerCommandRequestProto requestProto)
+      throws IOException {
+    ByteString data = stateMachineDataMap.get(logIndex);
+    if (data == null) {
+      data = readStateMachineData(requestProto, term, logIndex);
 
 Review comment:
   lets not read from the tmp chunk file, as with this patch in, we should never read from the tmp file.

----------------------------------------------------------------
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


With regards,
Apache Git Services

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