BukrosSzabolcs commented on a change in pull request #3786:
URL: https://github.com/apache/hbase/pull/3786#discussion_r736641941
##########
File path:
hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HRegionServer.java
##########
@@ -1895,6 +1900,22 @@ private void initializeThreads() {
this.storefileRefresher = new
StorefileRefresherChore(storefileRefreshPeriod,
onlyMetaRefresh, this, this);
}
+
+ int fileBasedStoreFileCleanerPeriod = conf.getInt(
+ FileBasedStoreFileCleaner.FILEBASED_STOREFILE_CLEANER_PERIOD,
+ FileBasedStoreFileCleaner.DEFAULT_FILEBASED_STOREFILE_CLEANER_PERIOD);
+ int fileBasedStoreFileCleanerDelay = conf.getInt(
+ FileBasedStoreFileCleaner.FILEBASED_STOREFILE_CLEANER_DELAY,
+ FileBasedStoreFileCleaner.DEFAULT_FILEBASED_STOREFILE_CLEANER_DELAY);
+ double fileBasedStoreFileCleanerDelayJitter = conf.getDouble(
+ FileBasedStoreFileCleaner.FILEBASED_STOREFILE_CLEANER_DELAY_JITTER,
+
FileBasedStoreFileCleaner.DEFAULT_FILEBASED_STOREFILE_CLEANER_DELAY_JITTER);
+ double jitterRate = (RandomUtils.nextDouble() - 0.5D) *
fileBasedStoreFileCleanerDelayJitter;
+ long jitterValue = Math.round(fileBasedStoreFileCleanerDelay * jitterRate);
Review comment:
After actually trying to move them to constructor I realized why it got
implemented like this:
These values are needed for the super class constructor. So the resulting
constructor would look something like this:
```
public BrokenStoreFileCleaner(final Stoppable stopper, Configuration conf,
HRegionServer regionServer) {
this((int)
(conf.getInt(BrokenStoreFileCleaner.BROKEN_STOREFILE_CLEANER_DELAY,
BrokenStoreFileCleaner.DEFAULT_BROKEN_STOREFILE_CLEANER_DELAY)
+ (RandomUtils.nextDouble() - 0.5D) * conf.getDouble(
BrokenStoreFileCleaner.BROKEN_STOREFILE_CLEANER_DELAY_JITTER,
BrokenStoreFileCleaner.DEFAULT_BROKEN_STOREFILE_CLEANER_DELAY_JITTER)),
conf.getInt(BrokenStoreFileCleaner.BROKEN_STOREFILE_CLEANER_PERIOD,
BrokenStoreFileCleaner.DEFAULT_BROKEN_STOREFILE_CLEANER_PERIOD),
stopper, conf,
regionServer);
}
```
Considering readability I would prefer to leave the config handling where it
is. What do you think?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]