You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@rocketmq.apache.org by GitBox <gi...@apache.org> on 2018/01/17 13:29:07 UTC

[GitHub] zhouxinyu commented on a change in pull request #220: [ROCKETMQ-332] MappedFileQueue#findMappedFileByOffset is not thread safe, which will cause message loss.

zhouxinyu commented on a change in pull request #220: [ROCKETMQ-332] MappedFileQueue#findMappedFileByOffset is not thread safe, which will cause message loss.
URL: https://github.com/apache/rocketmq/pull/220#discussion_r162049616
 
 

 ##########
 File path: store/src/main/java/org/apache/rocketmq/store/MappedFileQueue.java
 ##########
 @@ -461,26 +461,38 @@ public boolean commit(final int commitLeastPages) {
      */
     public MappedFile findMappedFileByOffset(final long offset, final boolean returnFirstOnNotFound) {
         try {
-            MappedFile mappedFile = this.getFirstMappedFile();
-            if (mappedFile != null) {
-                int index = (int) ((offset / this.mappedFileSize) - (mappedFile.getFileFromOffset() / this.mappedFileSize));
+            MappedFile firstMappedFile = this.getFirstMappedFile();
 
 Review comment:
   Thanks, I missed this case, please help review again -:)

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on 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