This is an automated email from the ASF dual-hosted git repository.
dataroaring pushed a commit to branch branch-2.1
in repository https://gitbox.apache.org/repos/asf/doris.git
The following commit(s) were added to refs/heads/branch-2.1 by this push:
new 0051832f91c [fix](statistics)Use ConcurrentHashMap to avoid
ConcurrentModificationException (#36452) (#36950)
0051832f91c is described below
commit 0051832f91c1a42eae2096d94b2c28ead2b773ac
Author: Jibing-Li <[email protected]>
AuthorDate: Thu Jun 27 23:06:03 2024 +0800
[fix](statistics)Use ConcurrentHashMap to avoid
ConcurrentModificationException (#36452) (#36950)
OlapTable idToPartition Map should use ConcurrentHashMap to avoid
ConcurrentModificationException.
backport: https://github.com/apache/doris/pull/36452
---
fe/fe-core/src/main/java/org/apache/doris/catalog/OlapTable.java | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/fe/fe-core/src/main/java/org/apache/doris/catalog/OlapTable.java
b/fe/fe-core/src/main/java/org/apache/doris/catalog/OlapTable.java
index fa6425c72af..0164c311974 100644
--- a/fe/fe-core/src/main/java/org/apache/doris/catalog/OlapTable.java
+++ b/fe/fe-core/src/main/java/org/apache/doris/catalog/OlapTable.java
@@ -99,6 +99,7 @@ import java.util.Map.Entry;
import java.util.Objects;
import java.util.Optional;
import java.util.Set;
+import java.util.concurrent.ConcurrentHashMap;
import java.util.stream.Collectors;
/**
@@ -140,7 +141,7 @@ public class OlapTable extends Table implements
MTMVRelatedTableIf {
@SerializedName("partitionInfo")
private PartitionInfo partitionInfo;
@SerializedName("idToPartition")
- private Map<Long, Partition> idToPartition = new HashMap<>();
+ private ConcurrentHashMap<Long, Partition> idToPartition = new
ConcurrentHashMap<>();
private Map<String, Partition> nameToPartition = Maps.newTreeMap();
@SerializedName(value = "distributionInfo")
@@ -611,7 +612,7 @@ public class OlapTable extends Table implements
MTMVRelatedTableIf {
// reset partition info and idToPartition map
Map<Long, Long> partitionMap = Maps.newHashMap();
Map<Long, Partition> origIdToPartition = idToPartition;
- idToPartition = Maps.newHashMap();
+ idToPartition = new ConcurrentHashMap<>();
for (Map.Entry<String, Long> entry : origPartNameToId.entrySet()) {
long newPartId = env.getNextId();
idToPartition.put(newPartId,
origIdToPartition.get(entry.getValue()));
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]