-
Notifications
You must be signed in to change notification settings - Fork 3.4k
HBASE-29363: CompactSplit should not attempt to split secondary region replicas #7048
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -36,6 +36,7 @@ | |
| import java.util.concurrent.atomic.AtomicInteger; | ||
| import java.util.function.IntSupplier; | ||
| import org.apache.hadoop.conf.Configuration; | ||
| import org.apache.hadoop.hbase.client.RegionInfo; | ||
| import org.apache.hadoop.hbase.conf.ConfigurationManager; | ||
| import org.apache.hadoop.hbase.conf.PropagatingConfigurationObserver; | ||
| import org.apache.hadoop.hbase.quotas.RegionServerSpaceQuotaManager; | ||
|
|
@@ -205,7 +206,7 @@ public synchronized boolean requestSplit(final Region r) { | |
| // continuously growing, as well as the number of store files, see HBASE-26242. | ||
| HRegion hr = (HRegion) r; | ||
| try { | ||
| if (shouldSplitRegion() && hr.getCompactPriority() >= PRIORITY_USER) { | ||
| if (shouldSplitRegion(r.getRegionInfo()) && hr.getCompactPriority() >= PRIORITY_USER) { | ||
| byte[] midKey = hr.checkSplit().orElse(null); | ||
| if (midKey != null) { | ||
| requestSplit(r, midKey); | ||
|
|
@@ -503,12 +504,15 @@ public int getSplitQueueSize() { | |
| return splits.getQueue().size(); | ||
| } | ||
|
|
||
| private boolean shouldSplitRegion() { | ||
| private boolean shouldSplitRegion(RegionInfo ri) { | ||
| if (server.getNumberOfOnlineRegions() > 0.9 * regionSplitLimit) { | ||
| LOG.warn("Total number of regions is approaching the upper limit " + regionSplitLimit + ". " | ||
| + "Please consider taking a look at http://hbase.apache.org/book.html#ops.regionmgt"); | ||
| } | ||
| return (regionSplitLimit > server.getNumberOfOnlineRegions()); | ||
| return (regionSplitLimit > server.getNumberOfOnlineRegions() | ||
| // Do not attempt to split secondary region replicas, as this is not allowed and our request | ||
| // to do so will be rejected | ||
| && ri.getReplicaId() == RegionInfo.DEFAULT_REPLICA_ID); | ||
|
||
| } | ||
|
|
||
| /** Returns the regionSplitLimit */ | ||
|
|
@@ -807,6 +811,11 @@ protected int getSplitThreadNum() { | |
| return this.splits.getCorePoolSize(); | ||
| } | ||
|
|
||
| /** Exposed for unit testing */ | ||
| long getSubmittedSplitsCount() { | ||
| return this.splits.getTaskCount(); | ||
| } | ||
|
|
||
| /** | ||
| * {@inheritDoc} | ||
| */ | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is the key change, every other part of this PR is just unit testing