[BOOKKEEPER-TOOL] Fix update rate-limiting for update-ledger command
authorRajan Dhabalia <rdhabalia@apache.org>
Tue, 19 May 2020 06:22:35 +0000 (23:22 -0700)
committerGitHub <noreply@github.com>
Tue, 19 May 2020 06:22:35 +0000 (08:22 +0200)
commite9021a607d55ed1802c44fd503fbf7640ad3ae98
tree46038c64812ff1c12b2f26431da806a4577818b4
parent993148e5b292a5b5fcaf64c95231e84fd1697831
[BOOKKEEPER-TOOL] Fix update rate-limiting for update-ledger command

### Motivation
Right now, `UpdateLedgerCmd` provides option `updatespersec` to throttle number of writes on zk. However, it throttles number of reads instead writes. Because of that it takes long time to complete this command as it slows down the read instead applying throttling while writing to zk.

### Modification
- Apply throttling while updating zk.
- If writes are being throttled then we also want to avoid accumulating reads so, added `maxOutstandingReads` option to manage max concurrent reads.

**Note:** We also need this change for #2321 .. so, I will rebase #2321 once this PR is merged.

Reviewers: Enrico Olivelli <eolivelli@gmail.com>

This closes #2336 from rdhabalia/update_rate
bookkeeper-server/src/main/java/org/apache/bookkeeper/bookie/BookieShell.java
bookkeeper-server/src/main/java/org/apache/bookkeeper/client/MetadataUpdateLoop.java
bookkeeper-server/src/main/java/org/apache/bookkeeper/client/UpdateLedgerOp.java
bookkeeper-server/src/main/java/org/apache/bookkeeper/tools/cli/commands/bookie/FlipBookieIdCommand.java
bookkeeper-server/src/test/java/org/apache/bookkeeper/client/UpdateLedgerOpTest.java
tools/ledger/src/test/java/org/apache/bookkeeper/tools/cli/commands/bookie/FlipBookieIdCommandTest.java