Xushaohong commented on code in PR #3691:
URL: https://github.com/apache/ozone/pull/3691#discussion_r1119535267
##########
hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/block/DeletedBlockLogImpl.java:
##########
@@ -126,18 +128,27 @@ public DeletedBlockLogImpl(ConfigurationSource conf,
}
@Override
- public List<DeletedBlocksTransaction> getFailedTransactions()
+ public List<DeletedBlocksTransaction> getFailedTransactions(int count)
throws IOException {
lock.lock();
try {
final List<DeletedBlocksTransaction> failedTXs = Lists.newArrayList();
try (TableIterator<Long,
? extends Table.KeyValue<Long, DeletedBlocksTransaction>> iter =
deletedBlockLogStateManager.getReadOnlyIterator()) {
- while (iter.hasNext()) {
- DeletedBlocksTransaction delTX = iter.next().getValue();
- if (delTX.getCount() == -1) {
- failedTXs.add(delTX);
+ if (count <= 0) {
+ while (iter.hasNext()) {
+ DeletedBlocksTransaction delTX = iter.next().getValue();
+ if (delTX.getCount() == -1) {
+ failedTXs.add(delTX);
+ }
+ }
+ } else {
+ while (iter.hasNext() && failedTXs.size() < count) {
+ DeletedBlocksTransaction delTX = iter.next().getValue();
+ if (delTX.getCount() == -1) {
Review Comment:
Oops, this is the special value of DeletedBlocksTransaction, not for the
clear instant description.
See `DeletedBlocksTransaction.Builder builder =
block.toBuilder().setCount(-1);`
--
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]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]