Hi,各位社区的大佬们。关于offPeakCompaction我有一个疑惑,在HStore中有一个static修饰的成员,这是HBASE-7437优化HBASE-7822中的bug而引入的。

private static final AtomicBoolean offPeakCompactionTracker = new 
AtomicBoolean();

然后在请求compaction时,同一个rs中的不同store需要来抢着这个offPeakCompactionTracker,这样在低峰期,同一个时刻只能有一个store使用offpeak
 compaction的参数配置来运行compaction。

// 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);
  }
}


对于这里,我有几个疑惑:

1. 为啥offpeak compaction需要做成rs级别不同的store之间互斥?(对此,我没有翻找到任何相关的jira或者设计文档。)
2. 如果去掉static的修饰,会有什么问题?

Reply via email to