Xiao Zhang created HBASE-27861:
----------------------------------

             Summary: Increases the concurrency of off-peak compactions
                 Key: HBASE-27861
                 URL: https://issues.apache.org/jira/browse/HBASE-27861
             Project: HBase
          Issue Type: Improvement
         Environment: HBase 2.0.2

Hadoop 3.1.1
            Reporter: Xiao Zhang
            Assignee: Xiao Zhang


The current off-peak compactions are global comparisons.  There can only be one 
off-peak compact running at a time, which does not make better use of the 
system resources during the off-peak period.  This is not very friendly for 
clusters with significant peaks and valleys of business.

Code:
{code:java}
private static final AtomicBoolean offPeakCompactionTracker = new 
AtomicBoolean(); 


// Normal case - coprocessor is not overriding file selection.
if (!compaction.hasSelection()) {
 boolean isUserCompaction = priority == Store.PRIORITY_USER;
 boolean mayUseOffPeak =
   offPeakHours.isOffPeakHour() && 
offPeakCompactionTracker.compareAndSet(false, true);
 try {
   compaction.select(this.filesCompacting, isUserCompaction, mayUseOffPeak,
     forceMajor && filesCompacting.isEmpty());
 } catch (IOException e) {
   if (mayUseOffPeak) {
     offPeakCompactionTracker.set(false);
   }
   throw e;
 }
 assert compaction.hasSelection();
 if (mayUseOffPeak && !compaction.getRequest().isOffPeak()) {
   // Compaction policy doesn't want to take advantage of off-peak.
   offPeakCompactionTracker.set(false);
 }
}{code}
 

I think it could be optimized to allow the user to set the number of concurrent 
off-peak compactions.

 

 



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to