Github user patrickstuedi commented on a diff in the pull request:
https://github.com/apache/incubator-crail/pull/8#discussion_r171187581
--- 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 --
before the hashtable index was a byte offset, now it's just an int index.
We could move back to the byte offset by multiplying the lba with the capacity,
and then also multiple the aligneLba with the capacity, but that's unnecessary
in my mind.
---