-
Notifications
You must be signed in to change notification settings - Fork 3.4k
HBASE-27362 CompactSplit.requestCompactionInternal may bypass compact… #4768
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 1 commit
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 |
|---|---|---|
|
|
@@ -229,8 +229,10 @@ private synchronized void requestSplit(final Region r, byte[] midKey) { | |
| */ | ||
| private synchronized void requestSplit(final Region r, byte[] midKey, User user) { | ||
| if (midKey == null) { | ||
| LOG.debug("Region " + r.getRegionInfo().getRegionNameAsString() | ||
| + " not splittable because midkey=null"); | ||
| if (LOG.isDebugEnabled()) { | ||
| LOG.debug("Region " + r.getRegionInfo().getRegionNameAsString() | ||
| + " not splittable because midkey=null"); | ||
| } | ||
| return; | ||
| } | ||
| try { | ||
|
|
@@ -239,7 +241,9 @@ private synchronized void requestSplit(final Region r, byte[] midKey, User user) | |
| LOG.debug("Splitting " + r + ", " + this); | ||
| } | ||
| } catch (RejectedExecutionException ree) { | ||
| LOG.info("Could not execute split for " + r, ree); | ||
| if (LOG.isInfoEnabled()) { | ||
| LOG.info("Could not execute split for " + r, ree); | ||
| } | ||
| } | ||
| } | ||
|
|
||
|
|
@@ -312,14 +316,20 @@ public void switchCompaction(boolean onOrOff) { | |
| if (onOrOff) { | ||
| // re-create executor pool if compactions are disabled. | ||
| if (!isCompactionsEnabled()) { | ||
| LOG.info("Re-Initializing compactions because user switched on compactions"); | ||
| if (LOG.isInfoEnabled()) { | ||
|
||
| LOG.info("Re-Initializing compactions because user switched on compactions"); | ||
| } | ||
| reInitializeCompactionsExecutors(); | ||
| } | ||
| } else { | ||
| LOG.info("Interrupting running compactions because user switched off compactions"); | ||
| interrupt(); | ||
| setCompactionsEnabled(onOrOff); | ||
Apache9 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| return; | ||
| } | ||
|
|
||
| setCompactionsEnabled(onOrOff); | ||
| if (LOG.isInfoEnabled()) { | ||
| LOG.info("Interrupting running compactions because user switched off compactions"); | ||
| } | ||
| interrupt(); | ||
| } | ||
|
|
||
| private void requestCompactionInternal(HRegion region, String why, int priority, | ||
|
|
@@ -336,6 +346,13 @@ private void requestCompactionInternal(HRegion region, String why, int priority, | |
| protected void requestCompactionInternal(HRegion region, HStore store, String why, int priority, | ||
| boolean selectNow, CompactionLifeCycleTracker tracker, | ||
| CompactionCompleteTracker completeTracker, User user) throws IOException { | ||
| if (!this.isCompactionsEnabled()) { | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. So this is the actual fix?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. yes, it is the actual fix. |
||
| if (LOG.isInfoEnabled()) { | ||
| LOG.info("Ignoring compaction request for " + region + ",because compaction is disabled."); | ||
| } | ||
| return; | ||
| } | ||
|
|
||
| if ( | ||
| this.server.isStopped() || (region.getTableDescriptor() != null | ||
| && !region.getTableDescriptor().isCompactionEnabled()) | ||
|
|
@@ -355,7 +372,9 @@ protected void requestCompactionInternal(HRegion region, HStore store, String wh | |
| + " as an active space quota violation " + " policy disallows compactions."; | ||
| tracker.notExecuted(store, reason); | ||
| completeTracker.completed(store); | ||
| LOG.debug(reason); | ||
| if (LOG.isDebugEnabled()) { | ||
| LOG.debug(reason); | ||
| } | ||
| return; | ||
| } | ||
|
|
||
|
|
@@ -418,8 +437,10 @@ public void requestSystemCompaction(HRegion region, HStore store, String why) th | |
| public synchronized void requestSystemCompaction(HRegion region, HStore store, String why, | ||
| boolean giveUpIfRequestedOrCompacting) throws IOException { | ||
| if (giveUpIfRequestedOrCompacting && isUnderCompaction(store)) { | ||
| LOG.debug("Region {} store {} is under compaction now, skip to request compaction", region, | ||
| store.getColumnFamilyName()); | ||
| if (LOG.isDebugEnabled()) { | ||
| LOG.debug("Region {} store {} is under compaction now, skip to request compaction", region, | ||
| store.getColumnFamilyName()); | ||
| } | ||
| return; | ||
| } | ||
| requestCompactionInternal(region, store, why, NO_PRIORITY, false, | ||
|
|
@@ -431,7 +452,9 @@ private Optional<CompactionContext> selectCompaction(HRegion region, HStore stor | |
| throws IOException { | ||
| // don't even select for compaction if disableCompactions is set to true | ||
| if (!isCompactionsEnabled()) { | ||
| LOG.info(String.format("User has disabled compactions")); | ||
| if (LOG.isInfoEnabled()) { | ||
| LOG.info(String.format("User has disabled compactions")); | ||
| } | ||
| return Optional.empty(); | ||
| } | ||
| Optional<CompactionContext> compaction = store.requestCompaction(priority, tracker, user); | ||
|
|
@@ -459,7 +482,9 @@ private void waitFor(ThreadPoolExecutor t, String name) { | |
| while (!done) { | ||
| try { | ||
| done = t.awaitTermination(60, TimeUnit.SECONDS); | ||
| LOG.info("Waiting for " + name + " to finish..."); | ||
| if (LOG.isInfoEnabled()) { | ||
| LOG.info("Waiting for " + name + " to finish..."); | ||
| } | ||
| if (!done) { | ||
| t.shutdownNow(); | ||
| } | ||
|
|
@@ -739,8 +764,10 @@ public void onConfigurationChange(Configuration newConf) { | |
| int largeThreads = | ||
| Math.max(1, newConf.getInt(LARGE_COMPACTION_THREADS, LARGE_COMPACTION_THREADS_DEFAULT)); | ||
| if (this.longCompactions.getCorePoolSize() != largeThreads) { | ||
| LOG.info("Changing the value of " + LARGE_COMPACTION_THREADS + " from " | ||
| + this.longCompactions.getCorePoolSize() + " to " + largeThreads); | ||
| if (LOG.isInfoEnabled()) { | ||
| LOG.info("Changing the value of " + LARGE_COMPACTION_THREADS + " from " | ||
| + this.longCompactions.getCorePoolSize() + " to " + largeThreads); | ||
| } | ||
| if (this.longCompactions.getCorePoolSize() < largeThreads) { | ||
| this.longCompactions.setMaximumPoolSize(largeThreads); | ||
| this.longCompactions.setCorePoolSize(largeThreads); | ||
|
|
@@ -752,8 +779,10 @@ public void onConfigurationChange(Configuration newConf) { | |
|
|
||
| int smallThreads = newConf.getInt(SMALL_COMPACTION_THREADS, SMALL_COMPACTION_THREADS_DEFAULT); | ||
| if (this.shortCompactions.getCorePoolSize() != smallThreads) { | ||
| LOG.info("Changing the value of " + SMALL_COMPACTION_THREADS + " from " | ||
| + this.shortCompactions.getCorePoolSize() + " to " + smallThreads); | ||
| if (LOG.isInfoEnabled()) { | ||
| LOG.info("Changing the value of " + SMALL_COMPACTION_THREADS + " from " | ||
| + this.shortCompactions.getCorePoolSize() + " to " + smallThreads); | ||
| } | ||
| if (this.shortCompactions.getCorePoolSize() < smallThreads) { | ||
| this.shortCompactions.setMaximumPoolSize(smallThreads); | ||
| this.shortCompactions.setCorePoolSize(smallThreads); | ||
|
|
@@ -765,8 +794,10 @@ public void onConfigurationChange(Configuration newConf) { | |
|
|
||
| int splitThreads = newConf.getInt(SPLIT_THREADS, SPLIT_THREADS_DEFAULT); | ||
| if (this.splits.getCorePoolSize() != splitThreads) { | ||
| LOG.info("Changing the value of " + SPLIT_THREADS + " from " + this.splits.getCorePoolSize() | ||
| + " to " + splitThreads); | ||
| if (LOG.isInfoEnabled()) { | ||
| LOG.info("Changing the value of " + SPLIT_THREADS + " from " + this.splits.getCorePoolSize() | ||
| + " to " + splitThreads); | ||
| } | ||
| if (this.splits.getCorePoolSize() < splitThreads) { | ||
| this.splits.setMaximumPoolSize(splitThreads); | ||
| this.splits.setCorePoolSize(splitThreads); | ||
|
|
||
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.
Are these logging changes related?
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.
no, it is not related, just modified by the way.