Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,7 @@ public List<DeletedBlocksTransaction> getFailedTransactions(int count,
}
}
} else {
iter.seek(startTxId);
while (iter.hasNext() && failedTXs.size() < count) {
DeletedBlocksTransaction delTX = iter.next().getValue();
if (delTX.getCount() == -1 && delTX.getTxID() >= startTxId) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,9 @@ public void seekToLast() {
@Override
public TypedTable.KeyValue<Long, DeletedBlocksTransaction> seek(
Long key) throws IOException {
throw new UnsupportedOperationException("seek");
iter.seek(key);
findNext();
return nextTx;
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -259,5 +259,27 @@ public void testDeletedBlocksTxnSubcommand() throws Exception {
currentValidTxnNum = deletedBlockLog.getNumOfValidTransactions();
LOG.info("Valid num of txns: {}", currentValidTxnNum);
assertEquals(30, currentValidTxnNum);

// Fail first 20 txns be failed
// increment retry count than threshold, count will be set to -1
for (int i = 0; i < maxRetry + 1; i++) {
deletedBlockLog.incrementCount(txIds);
}
flush();

GetFailedDeletedBlocksTxnSubcommand getFailedBlockCommand =
new GetFailedDeletedBlocksTxnSubcommand();
outContent.reset();
cmd = new CommandLine(getFailedBlockCommand);
// set start transaction as 15
cmd.parseArgs("-c", "5", "-s", "15");
getFailedBlockCommand.execute(scmClient);
matchCount = 0;
p = Pattern.compile("\"txID\" : \\d+", Pattern.MULTILINE);
m = p.matcher(outContent.toString(DEFAULT_ENCODING));
while (m.find()) {
matchCount += 1;
}
assertEquals(5, matchCount);
}
}
Loading