Github user manishgupta88 commented on a diff in the pull request:
https://github.com/apache/carbondata/pull/2134#discussion_r178722797
--- Diff:
core/src/main/java/org/apache/carbondata/core/indexstore/BlockletDataMapIndexStore.java
---
@@ -206,6 +206,31 @@ public void invalidate(TableBlockIndexUniqueIdentifier
tableSegmentUniqueIdentif
lruCache.remove(tableSegmentUniqueIdentifier.getUniqueTableSegmentIdentifier());
}
+ @Override public void put(TableBlockIndexUniqueIdentifier
tableBlockIndexUniqueIdentifier,
+ BlockletDataMap blockletDataMap) throws IOException, MemoryException
{
+ String uniqueTableSegmentIdentifier =
+ tableBlockIndexUniqueIdentifier.getUniqueTableSegmentIdentifier();
+ Object lock = segmentLockMap.get(uniqueTableSegmentIdentifier);
+ if (lock == null) {
+ lock = addAndGetSegmentLock(uniqueTableSegmentIdentifier);
+ }
+ if (null == getIfPresent(tableBlockIndexUniqueIdentifier)) {
--- End diff --
add a comment why getIfPresent Check is required -
Reason: As dataMap will use unsafe memory, it is not recommended to
overwrite an existing entry as in that case clearing unsafe memory need to be
taken card. If at all datamap entry in the cache need to be overwritten then
use the invalidate interface and then use the put interface
---