carbondata-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jack...@apache.org
Subject carbondata git commit: [CARBONDATA-2702][BloomDatamap] Fix bugs in clear bloom datamap concurrently
Date Wed, 11 Jul 2018 07:12:03 GMT
Repository: carbondata
Updated Branches:
  refs/heads/master 438b4421e -> 641ec098f


[CARBONDATA-2702][BloomDatamap] Fix bugs in clear bloom datamap concurrently

add synchronization for clearing bloom datamap, this implementation
refers to BlockletDataMapFactory in PR2324 for CARBONDATA-2496

This closes #2457


Project: http://git-wip-us.apache.org/repos/asf/carbondata/repo
Commit: http://git-wip-us.apache.org/repos/asf/carbondata/commit/641ec098
Tree: http://git-wip-us.apache.org/repos/asf/carbondata/tree/641ec098
Diff: http://git-wip-us.apache.org/repos/asf/carbondata/diff/641ec098

Branch: refs/heads/master
Commit: 641ec098fe52c7824d585f3214b78911931ea384
Parents: 438b442
Author: xuchuanyin <xuchuanyin@hust.edu.cn>
Authored: Fri Jul 6 14:26:09 2018 +0800
Committer: Jacky Li <jacky.likun@qq.com>
Committed: Wed Jul 11 15:11:46 2018 +0800

----------------------------------------------------------------------
 .../datamap/bloom/BloomCoarseGrainDataMapFactory.java        | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/carbondata/blob/641ec098/datamap/bloom/src/main/java/org/apache/carbondata/datamap/bloom/BloomCoarseGrainDataMapFactory.java
----------------------------------------------------------------------
diff --git a/datamap/bloom/src/main/java/org/apache/carbondata/datamap/bloom/BloomCoarseGrainDataMapFactory.java
b/datamap/bloom/src/main/java/org/apache/carbondata/datamap/bloom/BloomCoarseGrainDataMapFactory.java
index aa6c5e1..bf56043 100644
--- a/datamap/bloom/src/main/java/org/apache/carbondata/datamap/bloom/BloomCoarseGrainDataMapFactory.java
+++ b/datamap/bloom/src/main/java/org/apache/carbondata/datamap/bloom/BloomCoarseGrainDataMapFactory.java
@@ -18,6 +18,7 @@ package org.apache.carbondata.datamap.bloom;
 
 import java.io.IOException;
 import java.util.*;
+import java.util.concurrent.ConcurrentHashMap;
 
 import org.apache.carbondata.common.annotations.InterfaceAudience;
 import org.apache.carbondata.common.exceptions.sql.MalformedDataMapCommandException;
@@ -94,7 +95,7 @@ public class BloomCoarseGrainDataMapFactory extends DataMapFactory<CoarseGrainDa
   private boolean bloomCompress;
   private Cache<BloomCacheKeyValue.CacheKey, BloomCacheKeyValue.CacheValue> cache;
   // segmentId -> list of index file
-  private Map<String, Set<String>> segmentMap = new HashMap<>();
+  private Map<String, Set<String>> segmentMap = new ConcurrentHashMap<>();
 
   public BloomCoarseGrainDataMapFactory(CarbonTable carbonTable, DataMapSchema dataMapSchema)
       throws MalformedDataMapCommandException {
@@ -336,9 +337,10 @@ public class BloomCoarseGrainDataMapFactory extends DataMapFactory<CoarseGrainDa
   }
 
   @Override
-  public void clear() {
+  public synchronized void clear() {
     if (segmentMap.size() > 0) {
-      for (String segmentId : segmentMap.keySet().toArray(new String[segmentMap.size()]))
{
+      List<String> segments = new ArrayList<>(segmentMap.keySet());
+      for (String segmentId : segments) {
         clear(new Segment(segmentId, null, null));
       }
     }


Mime
View raw message