This is an automated email from the ASF dual-hosted git repository.
snlee pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/pinot.git
The following commit(s) were added to refs/heads/master by this push:
new 52a2e40 Fix the issue with concurrent modification for segment
lineage (#7343)
52a2e40 is described below
commit 52a2e40857ce276ec519f92f6c06c53b7c5a016d
Author: Seunghyun Lee <[email protected]>
AuthorDate: Fri Aug 20 11:16:26 2021 -0700
Fix the issue with concurrent modification for segment lineage (#7343)
There has been a minor bug with the segment lineage where we
iterate the lineage entries using `.keySet()` and we call
`map.remove()` to delete the entry. This causes to throw
`ConcurrentModificationException` and this pr addresses the issue.
---
.../main/java/org/apache/pinot/common/lineage/SegmentLineage.java | 3 ++-
.../java/org/apache/pinot/common/lineage/SegmentLineageTest.java | 6 ++++++
2 files changed, 8 insertions(+), 1 deletion(-)
diff --git
a/pinot-common/src/main/java/org/apache/pinot/common/lineage/SegmentLineage.java
b/pinot-common/src/main/java/org/apache/pinot/common/lineage/SegmentLineage.java
index 98eb1ae..e35d690 100644
---
a/pinot-common/src/main/java/org/apache/pinot/common/lineage/SegmentLineage.java
+++
b/pinot-common/src/main/java/org/apache/pinot/common/lineage/SegmentLineage.java
@@ -21,6 +21,7 @@ package org.apache.pinot.common.lineage;
import com.google.common.base.Preconditions;
import java.util.Arrays;
import java.util.HashMap;
+import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
@@ -95,7 +96,7 @@ public class SegmentLineage {
* @return lineage entry ids
*/
public Set<String> getLineageEntryIds() {
- return _lineageEntries.keySet();
+ return new HashSet<>(_lineageEntries.keySet());
}
/**
diff --git
a/pinot-common/src/test/java/org/apache/pinot/common/lineage/SegmentLineageTest.java
b/pinot-common/src/test/java/org/apache/pinot/common/lineage/SegmentLineageTest.java
index 37a3d99..d027f6f 100644
---
a/pinot-common/src/test/java/org/apache/pinot/common/lineage/SegmentLineageTest.java
+++
b/pinot-common/src/test/java/org/apache/pinot/common/lineage/SegmentLineageTest.java
@@ -101,5 +101,11 @@ public class SegmentLineageTest {
Assert.assertEquals(segmentLineageFromZNRecord.getLineageEntry(id2),
lineageEntry2);
Assert.assertEquals(segmentLineageFromZNRecord.getLineageEntry(id3),
lineageEntry3);
Assert.assertEquals(segmentLineageFromZNRecord.getLineageEntry(id4),
lineageEntry4);
+
+ // Try to delete by iterating through the lineage entry ids
+ for (String lineageId : segmentLineage.getLineageEntryIds()) {
+ segmentLineage.deleteLineageEntry(lineageId);
+ }
+ Assert.assertEquals(segmentLineage.getLineageEntryIds().size(), 0);
}
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]