>From Ritik Raj <[email protected]>:

Ritik Raj has uploaded this change for review. ( 
https://asterix-gerrit.ics.uci.edu/c/asterixdb/+/19528 )


Change subject: [ASTERIXDB-3582][COMP] Fix ConcurrentModificationException in 
Subplan Map during Filter Pushdown
......................................................................

[ASTERIXDB-3582][COMP] Fix ConcurrentModificationException in Subplan Map 
during Filter Pushdown

- user model changes: no
- storage format changes: no
- interface changes: no

Details:
The issue occurs due to the presence of nested subplans. While iterating
over the subplan map to identify filters that can be pushed down, we
encounter new subplans that consume the output of the current subplan.
To account for these new subplans, we attempt to add them to the map
during iteration.

However, since the current implementation uses a regular HashMap, which
does not allow modifications while iterating, this results in a
ConcurrentModificationException.

The fix replaces HashMap with ConcurrentHashMap, which allows safe
modifications during iteration. Given that we do not expect a large number
of entries in the subplan map, this change does not introduce
significant overhead.

Ext-ref: MB-65792
Change-Id: I636ed79ffd1de8ce8fd0729cf22867835527ff9a
---
M 
asterixdb/asterix-algebra/src/main/java/org/apache/asterix/optimizer/rules/pushdown/processor/AbstractFilterPushdownProcessor.java
1 file changed, 32 insertions(+), 2 deletions(-)



  git pull ssh://asterix-gerrit.ics.uci.edu:29418/asterixdb 
refs/changes/28/19528/1

diff --git 
a/asterixdb/asterix-algebra/src/main/java/org/apache/asterix/optimizer/rules/pushdown/processor/AbstractFilterPushdownProcessor.java
 
b/asterixdb/asterix-algebra/src/main/java/org/apache/asterix/optimizer/rules/pushdown/processor/AbstractFilterPushdownProcessor.java
index 6134d63..986fefa 100644
--- 
a/asterixdb/asterix-algebra/src/main/java/org/apache/asterix/optimizer/rules/pushdown/processor/AbstractFilterPushdownProcessor.java
+++ 
b/asterixdb/asterix-algebra/src/main/java/org/apache/asterix/optimizer/rules/pushdown/processor/AbstractFilterPushdownProcessor.java
@@ -26,12 +26,12 @@
 import static 
org.apache.asterix.metadata.utils.PushdownUtil.isSupportedFilterAggregateFunction;

 import java.util.ArrayList;
-import java.util.HashMap;
 import java.util.HashSet;
 import java.util.Iterator;
 import java.util.List;
 import java.util.Map;
 import java.util.Set;
+import java.util.concurrent.ConcurrentHashMap;

 import org.apache.asterix.om.base.IAObject;
 import org.apache.asterix.optimizer.rules.pushdown.PushdownContext;
@@ -59,7 +59,7 @@
     public AbstractFilterPushdownProcessor(PushdownContext pushdownContext, 
IOptimizationContext context) {
         super(pushdownContext, context);
         visitedOperators = new HashSet<>();
-        subplanSelects = new HashMap<>();
+        subplanSelects = new ConcurrentHashMap<>();
         scanCandidateFilters = new ArrayList<>();
         subplanProducedVariables = new HashSet<>();
     }

-- 
To view, visit https://asterix-gerrit.ics.uci.edu/c/asterixdb/+/19528
To unsubscribe, or for help writing mail filters, visit 
https://asterix-gerrit.ics.uci.edu/settings

Gerrit-Project: asterixdb
Gerrit-Branch: ionic
Gerrit-Change-Id: I636ed79ffd1de8ce8fd0729cf22867835527ff9a
Gerrit-Change-Number: 19528
Gerrit-PatchSet: 1
Gerrit-Owner: Ritik Raj <[email protected]>
Gerrit-MessageType: newchange

Reply via email to