Github user patrickstuedi commented on a diff in the pull request:

    https://github.com/apache/incubator-crail/pull/8#discussion_r171191426
  
    --- Diff: 
storage-rdma/src/main/java/org/apache/crail/storage/rdma/client/RdmaStorageLocalEndpoint.java
 ---
    @@ -61,11 +61,10 @@ public RdmaStorageLocalEndpoint(InetSocketAddress 
datanodeAddr) throws Exception
                this.address = datanodeAddr;
                this.bufferMap = new ConcurrentHashMap<Long, CrailBuffer>();
                this.unsafe = getUnsafe();
    -           long lba = 0;
                for (File dataFile : dataDir.listFiles()) {
    -                   MappedByteBuffer mappedBuffer = mmap(dataFile);
    -                   bufferMap.put(lba, OffHeapBuffer.wrap(mappedBuffer));
    -                   lba += mappedBuffer.capacity();
    +                   long lba = Long.parseLong(dataFile.getName());
    +                   OffHeapBuffer offHeapBuffer = 
OffHeapBuffer.wrap(mmap(dataFile));
    --- End diff --
    
    the actual problem with the previous code was that the lba was created 
based on the ordering provided by the Java directory iterator which of course 
doesn't respect the ordering of the filenames with integer based names..there 
no guaranteed ordering at all. 


---

Reply via email to