Skip to content

Commit

Permalink
[improve][conf] Change the default value of readOnlyModeOnAnyDiskFull…
Browse files Browse the repository at this point in the history
…Enabled to true (apache#4520)

* [improve][conf] Change the default value of readOnlyModeOnAnyDiskFullEnabled to true
  • Loading branch information
liangyepianzhou authored Dec 2, 2024
1 parent d873ca4 commit b372e90
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2462,12 +2462,12 @@ public ServerConfiguration setReadOnlyModeOnAnyDiskFullEnabled(boolean enabled)
}

/**
* Get whether read-only mode is enable when any disk is full. The default is false.
* Get whether read-only mode is enable when any disk is full. The default is true.
*
* @return boolean
*/
public boolean isReadOnlyModeOnAnyDiskFullEnabled() {
return getBoolean(READ_ONLY_MODE_ON_ANY_DISK_FULL_ENABLED, false);
return getBoolean(READ_ONLY_MODE_ON_ANY_DISK_FULL_ENABLED, true);
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -414,7 +414,7 @@ public void testLedgerDirsMonitorHandlingWithMultipleLedgerDirectories() throws
// one dir usagespace above storagethreshold, another dir below storagethreshold
// should still be writable
setUsageAndThenVerify(curDir1, nospace + 0.02f, curDir2, nospace - 0.05f, mockDiskChecker,
mockLedgerDirsListener, false);
mockLedgerDirsListener, true);

// should remain readonly
setUsageAndThenVerify(curDir1, nospace + 0.05f, curDir2, nospace + 0.02f, mockDiskChecker,
Expand All @@ -438,7 +438,7 @@ public void testLedgerDirsMonitorHandlingWithMultipleLedgerDirectories() throws
// overall diskusage is less than lwm
// should goto readwrite
setUsageAndThenVerify(curDir1, lwm - 0.17f, curDir2, nospace + 0.03f, mockDiskChecker, mockLedgerDirsListener,
false);
true);
assertEquals("Only one LedgerDir should be writable", 1, dirsManager.getWritableLedgerDirs().size());

// bring both the dirs below lwm
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,7 @@ public void testBookieShouldServeAsReadOnly() throws Exception {
public void testBookieShouldTurnWritableFromReadOnly() throws Exception {
killBookie(0);
baseConf.setReadOnlyModeEnabled(true);
baseConf.setReadOnlyModeOnAnyDiskFullEnabled(false);
baseConf.setDiskCheckInterval(Integer.MAX_VALUE);
startNewBookie();
LedgerHandle ledger = bkc.createLedger(2, 2, DigestType.MAC,
Expand Down
4 changes: 2 additions & 2 deletions conf/bk_server.conf
Original file line number Diff line number Diff line change
Expand Up @@ -181,8 +181,8 @@ extraServerComponents=
# If "readOnlyModeOnAnyDiskFullEnabled=true" then on any ledger disks full, bookie will be converted
# to read-only mode and serve only read requests. When all disks recovered,
# the bookie will be converted to read-write mode.Otherwise it will obey the `readOnlyModeEnabled` behavior.
# By default this will be disabled.
# readOnlyModeOnAnyDiskFullEnabled=false
# By default this will be enable.
# readOnlyModeOnAnyDiskFullEnabled=true

#############################################################################
## Netty server settings
Expand Down

0 comments on commit b372e90

Please sign in to comment.