Skip to content

Commit e19cb9d

Browse files
authored
Fix compaction threshold default value precision problem. (#3871)
* Fix compaction threshold precision problem. * Fix compaction threshold precision problem.
1 parent dda42a3 commit e19cb9d

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

bookkeeper-server/src/main/java/org/apache/bookkeeper/bookie/GarbageCollectorThread.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -218,7 +218,7 @@ public void removeEntryLog(long logToRemove) {
218218

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

232232
if (isForceAllowCompaction) {
233-
if (minorCompactionThreshold > 0 && minorCompactionThreshold < 1.0f) {
233+
if (minorCompactionThreshold > 0 && minorCompactionThreshold < 1.0d) {
234234
isForceMinorCompactionAllow = true;
235235
}
236-
if (majorCompactionThreshold > 0 && majorCompactionThreshold < 1.0f) {
236+
if (majorCompactionThreshold > 0 && majorCompactionThreshold < 1.0d) {
237237
isForceMajorCompactionAllow = true;
238238
}
239239
}
240240

241241
if (majorCompactionInterval > 0 && majorCompactionThreshold > 0) {
242-
if (majorCompactionThreshold > 1.0f) {
242+
if (majorCompactionThreshold > 1.0d) {
243243
throw new IOException("Invalid major compaction threshold "
244244
+ majorCompactionThreshold);
245245
}

bookkeeper-server/src/main/java/org/apache/bookkeeper/conf/ServerConfiguration.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1676,7 +1676,7 @@ public boolean isForceAllowCompaction() {
16761676
* @return threshold of minor compaction
16771677
*/
16781678
public double getMinorCompactionThreshold() {
1679-
return getDouble(MINOR_COMPACTION_THRESHOLD, 0.2f);
1679+
return getDouble(MINOR_COMPACTION_THRESHOLD, 0.2d);
16801680
}
16811681

16821682
/**
@@ -1704,7 +1704,7 @@ public ServerConfiguration setMinorCompactionThreshold(double threshold) {
17041704
* @return threshold of major compaction
17051705
*/
17061706
public double getMajorCompactionThreshold() {
1707-
return getDouble(MAJOR_COMPACTION_THRESHOLD, 0.8f);
1707+
return getDouble(MAJOR_COMPACTION_THRESHOLD, 0.8d);
17081708
}
17091709

17101710
/**

0 commit comments

Comments
 (0)