Skip to content

Commit

Permalink
Fix compaction threshold default value precision problem. (#3871)
Browse files Browse the repository at this point in the history
* Fix compaction threshold precision problem.

* Fix compaction threshold precision problem.
  • Loading branch information
horizonzy committed Mar 20, 2023
1 parent dda42a3 commit e19cb9d
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,7 @@ public void removeEntryLog(long logToRemove) {

this.throttler = new AbstractLogCompactor.Throttler(conf);
if (minorCompactionInterval > 0 && minorCompactionThreshold > 0) {
if (minorCompactionThreshold > 1.0f) {
if (minorCompactionThreshold > 1.0d) {
throw new IOException("Invalid minor compaction threshold "
+ minorCompactionThreshold);
}
Expand All @@ -230,16 +230,16 @@ public void removeEntryLog(long logToRemove) {
}

if (isForceAllowCompaction) {
if (minorCompactionThreshold > 0 && minorCompactionThreshold < 1.0f) {
if (minorCompactionThreshold > 0 && minorCompactionThreshold < 1.0d) {
isForceMinorCompactionAllow = true;
}
if (majorCompactionThreshold > 0 && majorCompactionThreshold < 1.0f) {
if (majorCompactionThreshold > 0 && majorCompactionThreshold < 1.0d) {
isForceMajorCompactionAllow = true;
}
}

if (majorCompactionInterval > 0 && majorCompactionThreshold > 0) {
if (majorCompactionThreshold > 1.0f) {
if (majorCompactionThreshold > 1.0d) {
throw new IOException("Invalid major compaction threshold "
+ majorCompactionThreshold);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1676,7 +1676,7 @@ public boolean isForceAllowCompaction() {
* @return threshold of minor compaction
*/
public double getMinorCompactionThreshold() {
return getDouble(MINOR_COMPACTION_THRESHOLD, 0.2f);
return getDouble(MINOR_COMPACTION_THRESHOLD, 0.2d);
}

/**
Expand Down Expand Up @@ -1704,7 +1704,7 @@ public ServerConfiguration setMinorCompactionThreshold(double threshold) {
* @return threshold of major compaction
*/
public double getMajorCompactionThreshold() {
return getDouble(MAJOR_COMPACTION_THRESHOLD, 0.8f);
return getDouble(MAJOR_COMPACTION_THRESHOLD, 0.8d);
}

/**
Expand Down

0 comments on commit e19cb9d

Please sign in to comment.