poorbarcode opened a new pull request, #4640:
URL: https://github.com/apache/bookkeeper/pull/4640
### Motivation
Issue: BK stays at `readOnly` state even if the disk is empty
Reproduce steps
- Configurations
- `diskUsageLwmThreshold`: `0.85`
- `diskUsageWarnThreshold`: `0.85`
- `diskUsageThreshold`: `0.90`
- `persistBookieStatusEnabled`: `true`
- The state of BK switches to `read-only` because the disk usage increased
to `0.92`.
- The disk usage came down to `0.851`.
- Restart the BK.
- The state is set to `read-only`, because the payload of the state file
is `1, {timestamp}, Read_only`
- **(Highlight)** the attributes of `LedgerDirsManager` is as follows
- `filledDirs`: `[]`
- `writableLedgerDirectories`: `["ledger-0"]`
- **Issue: ** the state staies at `read_only` and never recovers, because
there is no ledger dir will switch state from `filled` to `writable` since the
`filledDirs` is empty. see also
https://github.com/apache/bookkeeper/blob/master/bookkeeper-server/src/main/java/org/apache/bookkeeper/bookie/LedgerDirsMonitor.java#L186-L191
```java
// When a dir switches state from "filled" to "writable" and the variable
"filledDirs" is empty, BK will switch state to "read_write"
if (someDiskRecovered && ldm.getFullFilledLedgerDirs().isEmpty()) {
// notify all disk recovered.
for (LedgerDirsListener listener : ldm.getListeners()) {
listener.allDisksWritable();
}
}
```
### Changes
- If `filledDirs` is empty, the first check task after BK starts will switch
`read_only` state to `read_write`
- If the `read_only` state was set by Admin API, the check task will not
trigger a switching that change state from `read_only` to `read_write` until
users call a Admin API to set the statue manually. which keeps the previous
behavior
--
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]