Github user animeshtrivedi commented on a diff in the pull request:
https://github.com/apache/incubator-crail/pull/8#discussion_r171178979
--- 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 --
@patrickstuedi can you please indent it properly :)
may be you also don't need these two explicit variables, they are just used
once. But I understand for clarity it is fine.
Also - just that I understand, the file names are enumerated with proper
name/offset. Because before you had lba+=mappedBuffer.capacity() logic.
Otherwise looks good to me.
---