Skip to content

Commit

Permalink
Use another way to support compatibility.
Browse files Browse the repository at this point in the history
  • Loading branch information
horizonzy committed Dec 4, 2023
1 parent 6f02306 commit 0502a36
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -266,7 +266,7 @@ synchronized BookieId sendNextRead() {
@Override
synchronized void logErrorAndReattemptRead(int bookieIndex, BookieId host, String errMsg, int rc) {
super.logErrorAndReattemptRead(bookieIndex, host, errMsg, rc);
if (rc == BKException.Code.ProtocolVersionException) {
if (rc == BKException.Code.BookieHandleNotAvailableException) {
fail(rc);
return;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -720,8 +720,7 @@ public void asyncReadEntries(long firstEntry, int maxCount, long maxSize, ReadCa
asyncReadEntriesInternal(firstEntry, maxCount, maxSize, new ReadCallback() {
@Override
public void readComplete(int rc, LedgerHandle lh, Enumeration<LedgerEntry> seq, Object ctx) {
//not compatible
if (rc == Code.ProtocolVersionException) {
if (rc == Code.BookieHandleNotAvailableException) {
notSupportBatch = true;
asyncReadEntries(firstEntry, firstEntry + maxCount - 1, cb, ctx);
} else {
Expand Down Expand Up @@ -812,7 +811,7 @@ public CompletableFuture<LedgerEntries> readAsync(long startEntry, int maxCount,
readEntriesInternalAsync(startEntry, maxCount, maxSize, false)
.whenComplete((entries, ex) -> {
if (ex != null) {
if (ex instanceof BKException.BKProtocolVersionException) {
if (ex instanceof BKException.BKBookieHandleNotAvailableException) {
notSupportBatch = true;
readAsync(startEntry, startEntry + maxCount - 1).whenComplete((entries1, ex1) -> {
if (ex1 != null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ public interface BookieProtocol {
/**
* Current version of the protocol, which client will use.
*/
byte CURRENT_PROTOCOL_VERSION = 3;
byte CURRENT_PROTOCOL_VERSION = 2;

/**
* Entry Entry ID. To be used when no valid entry id can be assigned.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1034,8 +1034,8 @@ private void readEntriesInternal(final long ledgerId,
int flags,
byte[] masterKey,
boolean allowFastFail) {
Object request = null;
CompletionKey completionKey = null;
Object request;
CompletionKey completionKey;
final long txnId = getTxnId();
if (useV2WireProtocol) {
request = BookieProtocol.BatchedReadRequest.create(BookieProtocol.CURRENT_PROTOCOL_VERSION,
Expand Down

0 comments on commit 0502a36

Please sign in to comment.