This is an automated email from the ASF dual-hosted git repository.
chenhang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/bookkeeper.git
The following commit(s) were added to refs/heads/master by this push:
new bacd9ac44b [BP-62] Tune the BP-62 doc (#4227)
bacd9ac44b is described below
commit bacd9ac44b79788123c1539f36f40f16de5777c3
Author: Yan Zhao <[email protected]>
AuthorDate: Mon Mar 18 08:54:54 2024 +0800
[BP-62] Tune the BP-62 doc (#4227)
### Motivation
In the coding stage, we implements API not same with the doc, we should
correct the doc to match the code.
---
.../apache/bookkeeper/client/BatchedReadOp.java | 6 ++---
.../pages/bps/BP-62-new-API-for-batched-reads.md | 27 +++++++++-------------
2 files changed, 14 insertions(+), 19 deletions(-)
diff --git
a/bookkeeper-server/src/main/java/org/apache/bookkeeper/client/BatchedReadOp.java
b/bookkeeper-server/src/main/java/org/apache/bookkeeper/client/BatchedReadOp.java
index 4892882e1d..e5ca9bb432 100644
---
a/bookkeeper-server/src/main/java/org/apache/bookkeeper/client/BatchedReadOp.java
+++
b/bookkeeper-server/src/main/java/org/apache/bookkeeper/client/BatchedReadOp.java
@@ -81,10 +81,10 @@ public class BatchedReadOp extends ReadOpBase implements
BatchedReadEntryCallbac
long latencyNanos = MathUtils.elapsedNanos(requestTimeNanos);
if (code != BKException.Code.OK) {
LOG.error(
- "Read of ledger entry failed: L{} E{}-E{}, Sent to {}, "
+ "Batch read of ledger entry failed: L{} E{}-E{}, Sent to
{}, "
+ "Heard from {} : bitset = {}, Error = '{}'.
First unread entry is ({}, rc = {})",
- lh.getId(), startEntryId, endEntryId, sentToHosts,
heardFromHosts, heardFromHostsBitSet,
- BKException.getMessage(code), startEntryId, code);
+ lh.getId(), startEntryId, startEntryId + maxCount - 1,
sentToHosts, heardFromHosts,
+ heardFromHostsBitSet, BKException.getMessage(code),
startEntryId, code);
clientCtx.getClientStats().getReadOpLogger().registerFailedEvent(latencyNanos,
TimeUnit.NANOSECONDS);
// release the entries
diff --git a/site3/website/src/pages/bps/BP-62-new-API-for-batched-reads.md
b/site3/website/src/pages/bps/BP-62-new-API-for-batched-reads.md
index c66389a635..5e77a04f83 100644
--- a/site3/website/src/pages/bps/BP-62-new-API-for-batched-reads.md
+++ b/site3/website/src/pages/bps/BP-62-new-API-for-batched-reads.md
@@ -44,24 +44,19 @@ that takes into account the expected count and size of
entries.
## BookKeeper Client API
1. The new APIs will be added to BookieClient.java
```java
-default void readEntries(BookieId address, long ledgerId, long startEntryId,
+default void batchReadEntries(BookieId address, long ledgerId, long
startEntryId,
int maxCount, long maxSize, BatchedReadEntryCallback cb, Object ctx,
int flags) {
- readEntries(address, ledgerId, startEntryId, maxCount, maxSize, cb,
ctx, flags, null);
+ batchReadEntries(address, ledgerId, startEntryId, maxCount, maxSize,
cb, ctx, flags, null);
}
-default void readEntries(BookieId address, long ledgerId, long startEntryId,
+default void batchReadEntries(BookieId address, long ledgerId, long
startEntryId,
int maxCount, long maxSize, BatchedReadEntryCallback cb, Object ctx,
int flags, byte[] masterKey) {
- readEntries(address, ledgerId, startEntryId, maxCount, maxSize, cb,
ctx, flags, masterKey, false);
+ batchReadEntries(address, ledgerId, startEntryId, maxCount, maxSize,
cb, ctx, flags, masterKey, false);
}
-
- void readEntries(BookieId address, long ledgerId, long startEntryId,
+ void batchReadEntries(BookieId address, long ledgerId, long
startEntryId,
int maxCount, long maxSize, BatchedReadEntryCallback cb, Object ctx,
int flags, byte[] masterKey, boolean allowFastFail);
-
- void readEntiesWithFallback(BookieId address, long ledgerId, long
startEntryId,
- int maxCount, long maxSize, BatchedReadEntryCallback cb, Object ctx,
- int flags, byte[] masterKey, boolean allowFastFail)
```
2. The new class BatchedReadEntryCallback will be added to
BookkeeperInternalCallbacks.java
```java
@@ -71,17 +66,17 @@ public interface BatchedReadEntryCallback {
```
3. The new APIs will be added to ReadHandle.java
```java
-CompletableFuture<LedgerEntries> readAsync(long startEntry, int maxCount, long
maxSize);
-
-default LedgerEntries read(long startEntry, int maxCount, long maxSize) throws
BKException, InterruptedException {
- return FutureUtils.result(readAsync(startEntry, maxCount, maxSize),
- BKException.HANDLER);
+ default CompletableFuture<LedgerEntries> batchReadAsync(long startEntry,
int maxCount, long maxSize);
+
+default LedgerEntries batchRead(long startEntry, int maxCount, long maxSize)
+ throws BKException, InterruptedException {
+ return FutureUtils.result(batchReadAsync(startEntry, maxCount,
maxSize), BKException.HANDLER);
}
```
## Wire protocol changes
In BookKeeper, the V2 protocol uses a custom encoding format. So we need to
handle the data encoding and decoding.
-The V3 protocol uses the ProtoBuf for encoding and decoding.
+The V3 protocol uses the ProtoBuf for encoding and decoding.(Not support now)
### V2 Protocol