carbondata-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ravipesala <...@git.apache.org>
Subject [GitHub] carbondata pull request #1377: [CARBONDATA-1504] Fixed refresh of segments i...
Date Thu, 28 Sep 2017 05:22:10 GMT
Github user ravipesala commented on a diff in the pull request:

    https://github.com/apache/carbondata/pull/1377#discussion_r141528239
  
    --- Diff: core/src/main/java/org/apache/carbondata/core/indexstore/blockletindex/BlockletDataMapFactory.java
---
    @@ -120,15 +121,17 @@ public void clear(String segmentId) {
         if (blockIndexes != null) {
           for (TableBlockIndexUniqueIdentifier blockIndex : blockIndexes) {
             DataMap dataMap = cache.getIfPresent(blockIndex);
    -        dataMap.clear();
    -        cache.invalidate(blockIndex);
    +        if (dataMap != null) {
    +          cache.invalidate(blockIndex);
    +          dataMap.clear();
    +        }
           }
         }
       }
     
       @Override
       public void clear() {
    -    for (String segmentId: segmentMap.keySet()) {
    +    for (String segmentId: segmentMap.keySet().toArray(new String[segmentMap.size()]))
{
    --- End diff --
    
    It is needed as we cannot we cannot iterate on set and remove an entry at the same time.
So here it is converted to array so that we can remove an entry from map in clear method


---

Mime
View raw message