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

Switch to new Bookkeeper Client API #163 #167

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

caliuf
Copy link
Contributor

@caliuf caliuf commented Apr 16, 2020

Description

Resolves #163

Formalities

Following this checklist to help us incorporate your
contribution quickly and easily:

  • Each commit in the pull request should have a meaningful subject line and body.
  • Write a pull request description that is detailed enough to understand what the pull request does, how, and why.
  • Rember to add the correct license header to new files.
  • Run mvn clean verify to make sure basic checks pass. A more thorough check will
    be performed on your pull request automatically.

To make clear that you license your contribution under
the Apache License Version 2.0, January 2004
you have to acknowledge this by using the following check-box.

LOGGER.log(Level.SEVERE, "error while writing to ledger " + out, err);
throw err;
switch (err.getCode()) {
case BKException.Code.LedgerClosedException:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I feel you can leave the original catch clause.
as you are still referencing old BKException.

exception.set(error);
res.set(index, null);
for (int j = 0; j < edits.size(); j++) {
for (StatusEdit edit1 : edits) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it is better to leave the counted loop
with this change you are using the Iterator ! this is more expensive

LOGGER.log(Level.SEVERE, "error while writing to ledger " + out, err);
throw err;
} catch (Exception err) {
switch (err.getCode()) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same as above

config.setEnableParallelRecoveryRead(true);
config.setThrottleValue(0);
config.setEnableDigestTypeAutodetection(true);
String zkConnString = "zk+null://" + zkAddress + zkPath;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what is zkAddress ? is it a list of server addresses ?
server1:port1,server2:port2,server3:port3 ?

while (seq.hasMoreElements()) {
LedgerEntry entry = seq.nextElement();

Iterator<LedgerEntry> entries = handle.read(start, end).iterator();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

try (LedgerEntries entries = handle.read(start, end)) {
for (LedgerEntry entry : entries) {
..........
}
}

nextEntry = 0;
continue;
}
try (LedgerEntries entries = handler.read(nextEntry, lastAddConfirmed)) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same as above

@@ -1042,12 +1074,24 @@ public void followTheLeader(LogSequenceNumber skipPast, BiConsumer<LogSequenceNu
lastSequenceNumber = number.sequenceNumber;
currentLedgerId = number.ledgerId;
}
} catch (BKException err) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it is better to leave off all of these refactor of exception handling
it is very dangerous and it makes the review more difficult

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

Successfully merging this pull request may close these issues.

Switch to new Bookkeeper Client API
2 participants