Junegunn Choi created HBASE-29474:
-------------------------------------
Summary: RegionSplitter.rollingSplit is broken
Key: HBASE-29474
URL: https://issues.apache.org/jira/browse/HBASE-29474
Project: HBase
Issue Type: Bug
Reporter: Junegunn Choi
h2. Problem
The method {{RegionSplitter.rollingSplit}} was not properly covered by unit
tests until HBASE-29472. While the new test passes with a single regionserver,
it fails immediately when a second regionserver is added to the cluster,
throwing a {{java.util.ConcurrentModificationException}}.
{code}
java.util.ConcurrentModificationException
at
java.base/java.util.TreeMap$PrivateEntryIterator.nextEntry(TreeMap.java:1486)
at java.base/java.util.TreeMap$EntryIterator.next(TreeMap.java:1522)
at java.base/java.util.TreeMap$EntryIterator.next(TreeMap.java:1517)
at
org.apache.hadoop.hbase.util.RegionSplitter.rollingSplit(RegionSplitter.java:466)
at
org.apache.hadoop.hbase.util.TestRegionSplitter.rollingSplitAndVerify(TestRegionSplitter.java:426)
at
org.apache.hadoop.hbase.util.TestRegionSplitter.testSplitPresplitTable(TestRegionSplitter.java:138)
at
org.apache.hadoop.hbase.util.TestRegionSplitter.testSplitPresplitTable(TestRegionSplitter.java:118)
{code}
This happens because the underlying {{TreeMap}} is modified during iteration:
https://github.com/apache/hbase/blob/f88a1ce52583fc02ad3d421ccf32bd7f38c3f0b3/hbase-server/src/main/java/org/apache/hadoop/hbase/util/RegionSplitter.java#L513-L515
h2. Solution
Avoid concurrent modification by iterating over a snapshot of the keys instead.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)