horizonzy commented on code in PR #3675:
URL: https://github.com/apache/bookkeeper/pull/3675#discussion_r1034248819
##########
bookkeeper-server/src/main/java/org/apache/bookkeeper/tools/cli/commands/client/SimpleTestCommand.java:
##########
@@ -102,10 +105,15 @@ protected void run(BookKeeper bk, Flags flags) throws
Exception {
}
}
LOG.info("{} entries written to ledger {}", flags.numEntries,
wh.getId());
- if (flags.cleanup) {
- LOG.info("Cleaning up the ledger {}", wh.getId());
-
result(bk.newDeleteLedgerOp().withLedgerId(wh.getId()).execute());
+
+ try (ReadHandle rh =
result(bk.newOpenLedgerOp().withLedgerId(wh.getId()).withDigestType(DigestType.CRC32C)
+ .withPassword(new byte[0]).execute())) {
+ LedgerEntries ledgerEntries = rh.read(0, flags.numEntries);
+ for (LedgerEntry ledgerEntry : ledgerEntries) {
+ assert Arrays.equals(ledgerEntry.getEntryBytes(), data);
Review Comment:
Good point.
##########
bookkeeper-server/src/main/java/org/apache/bookkeeper/tools/cli/commands/client/SimpleTestCommand.java:
##########
@@ -102,10 +105,15 @@ protected void run(BookKeeper bk, Flags flags) throws
Exception {
}
}
LOG.info("{} entries written to ledger {}", flags.numEntries,
wh.getId());
- if (flags.cleanup) {
- LOG.info("Cleaning up the ledger {}", wh.getId());
-
result(bk.newDeleteLedgerOp().withLedgerId(wh.getId()).execute());
+
+ try (ReadHandle rh =
result(bk.newOpenLedgerOp().withLedgerId(wh.getId()).withDigestType(DigestType.CRC32C)
+ .withPassword(new byte[0]).execute())) {
+ LedgerEntries ledgerEntries = rh.read(0, flags.numEntries);
+ for (LedgerEntry ledgerEntry : ledgerEntries) {
+ assert Arrays.equals(ledgerEntry.getEntryBytes(), data);
+ }
}
+ result(bk.newDeleteLedgerOp().withLedgerId(wh.getId()).execute());
Review Comment:
Fine.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]