reddycharan commented on a change in pull request #1225: Issue #570: getting
rid of unnecessary synchronization in InterleavedLedgerStorage
URL: https://github.com/apache/bookkeeper/pull/1225#discussion_r171939731
##########
File path:
bookkeeper-server/src/test/java/org/apache/bookkeeper/bookie/EntryLogTest.java
##########
@@ -391,4 +400,137 @@ public void testGetEntryLogsSet() throws Exception {
assertEquals(Sets.newHashSet(0L, 1L, 2L, 3L),
logger.getEntryLogsSet());
}
+
+ class LedgerStorageWriteTask implements Callable<Boolean> {
+ long ledgerId;
+ int entryId;
+ LedgerStorage ledgerStorage;
+
+ LedgerStorageWriteTask(long ledgerId, int entryId, LedgerStorage
ledgerStorage) {
+ this.ledgerId = ledgerId;
+ this.entryId = entryId;
+ this.ledgerStorage = ledgerStorage;
+ }
+
+ @Override
+ public Boolean call() {
+ try {
+ ledgerStorage.addEntry(generateEntry(ledgerId, entryId));
+ } catch (IOException e) {
+ LOG.error("Got Exception for AddEntry call. LedgerId: " +
ledgerId + " entryId: " + entryId, e);
+ return false;
+ }
+ return true;
+ }
+ }
+
+ class LedgerStorageReadTask implements Callable<Boolean> {
+ long ledgerId;
+ int entryId;
+ LedgerStorage ledgerStorage;
+
+ LedgerStorageReadTask(long ledgerId, int entryId, LedgerStorage
ledgerStorage) {
+ this.ledgerId = ledgerId;
+ this.entryId = entryId;
+ this.ledgerStorage = ledgerStorage;
+ }
+
+ @Override
+ public Boolean call() {
Review comment:
other than removing redundant .isDone check, I would keep the rest of the
test logic as it is now. For diagnosing in the case of failure, it is helpful
to have assert failures and proper error log lines (by catching the error and
log it) rather than failing with generic cancellation exception or
executionexception when we call future.get().
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services