Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BUG: dir_*_usage stats are reported as 0 for read-only bookies after a restart #1884

Closed
pasha-kuznetsov opened this issue Dec 13, 2018 · 0 comments

Comments

@pasha-kuznetsov
Copy link
Contributor

When a read-only bookie is restarted it keeps reporting dir_*_usage stats as 0 until it becomes writable again.

This is caused by the LedgerDirsMonitor.check only updating diskUsages if there are any writable dirs, or if the total usage goes below the low water mark, otherwise relying on previously filled values which are 0 after a bookie is restarted.

Source:

    private void check() {
        try {
            List<File> writableDirs = ldm.getWritableLedgerDirs();
            // Check all writable dirs disk space usage.
            for (File dir : writableDirs) {
                try {
                    diskUsages.put(dir, diskChecker.checkDir(dir));
                    ...
            }
        ...
        List<File> fullfilledDirs = new ArrayList<File>(ldm.getFullFilledLedgerDirs());
        boolean hasWritableLedgerDirs = ldm.hasWritableLedgerDirs();
        float totalDiskUsage = 0;

        // When bookie is in READONLY mode .i.e there are no writableLedgerDirs:
        // - Check if the total disk usage is below DiskLowWaterMarkUsageThreshold.
        // - If So, walk through the entire list of fullfilledDirs and add them back to writableLedgerDirs list if
        // their usage is < conf.getDiskUsageThreshold.
        try {
            if (hasWritableLedgerDirs
                    || (totalDiskUsage = diskChecker.getTotalDiskUsage(ldm.getAllLedgerDirs())) < conf
                            .getDiskLowWaterMarkUsageThreshold()) {
                // Check all full-filled disk space usage
                for (File dir : fullfilledDirs) {
                    try {
                        diskUsages.put(dir, diskChecker.checkDir(dir));
                        ...
pasha-kuznetsov pushed a commit to pasha-kuznetsov/bookkeeper that referenced this issue Dec 13, 2018
…only ...

bookies after a restart

When a read-only bookie is restarted it keeps reporting `dir_*_usage`
stats as `0` until it becomes writable again.

This is caused by the `LedgerDirsMonitor.check` only updating
`diskUsages` if there are any writable dirs, or if the total usage
goes below the low water mark, otherwise relying on previously filled
values which are `0` after a bookie is restarted.
pasha-kuznetsov pushed a commit to pasha-kuznetsov/bookkeeper that referenced this issue Dec 13, 2018
…s 0 ...

for read-only bookies after a restart

When a read-only bookie is restarted it keeps reporting `dir_*_usage`
stats as `0` until it becomes writable again.

This is caused by the `LedgerDirsMonitor.check` only updating
`diskUsages` if there are any writable dirs, or if the total usage
goes below the low water mark, otherwise relying on previously filled
values which are `0` after a bookie is restarted.

(@Rev cguttapalem@)
@sijie sijie closed this as completed in 1b2138f Dec 14, 2018
sijie pushed a commit that referenced this issue Dec 14, 2018
for read-only bookies after a restart

### Motivation

Fixing the Issue #1884:

When a read-only bookie is restarted it keeps reporting `dir_*_usage`
stats as `0` until it becomes writable again.

This is caused by the `LedgerDirsMonitor.check` only updating
`diskUsages` if there are any writable dirs, or if the total usage
goes below the low water mark, otherwise relying on previously filled
values which are `0` after a bookie is restarted.

### Changes

* Change the `LedgerDirsMonitor.check` to update `diskUsages`
  even when there are no writable dirs.
* Add new `testLedgerDirsMonitorStartReadOnly` testing this scenario.
* Simplify previous tests checking read-only since `diskUsages`
  are now updated regardless if a bookie is in read-only mode.

jvrao reddycharan

Reviewers: Sijie Guo <sijie@apache.org>, Charan Reddy Guttapalem <reddycharan18@gmail.com>

This closes #1885 from pasha-kuznetsov/issue-1884-dir-usage-ro-restart, closes #1884

(cherry picked from commit 1b2138f)
Signed-off-by: Sijie Guo <sijie@apache.org>
sijie pushed a commit that referenced this issue Dec 14, 2018
for read-only bookies after a restart

### Motivation

Fixing the Issue #1884:

When a read-only bookie is restarted it keeps reporting `dir_*_usage`
stats as `0` until it becomes writable again.

This is caused by the `LedgerDirsMonitor.check` only updating
`diskUsages` if there are any writable dirs, or if the total usage
goes below the low water mark, otherwise relying on previously filled
values which are `0` after a bookie is restarted.

### Changes

* Change the `LedgerDirsMonitor.check` to update `diskUsages`
  even when there are no writable dirs.
* Add new `testLedgerDirsMonitorStartReadOnly` testing this scenario.
* Simplify previous tests checking read-only since `diskUsages`
  are now updated regardless if a bookie is in read-only mode.

jvrao reddycharan

Reviewers: Sijie Guo <sijie@apache.org>, Charan Reddy Guttapalem <reddycharan18@gmail.com>

This closes #1885 from pasha-kuznetsov/issue-1884-dir-usage-ro-restart, closes #1884

(cherry picked from commit 1b2138f)
Signed-off-by: Sijie Guo <sijie@apache.org>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant