nandakumar131 commented on code in PR #7665:
URL: https://github.com/apache/ozone/pull/7665#discussion_r1926824601
##########
hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/block/DeletedBlockLogImpl.java:
##########
@@ -129,7 +129,7 @@ public List<DeletedBlocksTransaction>
getFailedTransactions(int count,
final List<DeletedBlocksTransaction> failedTXs = Lists.newArrayList();
try (TableIterator<Long,
? extends Table.KeyValue<Long, DeletedBlocksTransaction>> iter =
- deletedBlockLogStateManager.getReadOnlyIterator()) {
+ deletedBlockLogStateManager.getReadOnlyIterator()) {
Review Comment:
Please avoid unnecessary formatting.
##########
hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/server/SCMClientProtocolServer.java:
##########
@@ -912,10 +912,8 @@ public List<DeletedBlocksTransactionInfo>
getFailedDeletedBlockTxn(int count,
SCMAction.GET_FAILED_DELETED_BLOCKS_TRANSACTION, auditMap));
return result;
} catch (IOException ex) {
- AUDIT.logReadFailure(
- buildAuditMessageForFailure(
- SCMAction.GET_FAILED_DELETED_BLOCKS_TRANSACTION, auditMap, ex)
- );
Review Comment:
Please avoid unnecessary formatting.
##########
hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/block/DeletedBlockLogImpl.java:
##########
@@ -176,18 +176,52 @@ public void incrementCount(List<Long> txIDs)
*/
@Override
public int resetCount(List<Long> txIDs) throws IOException {
Review Comment:
You can simplify the whole logic
```java
public int resetCount(List<Long> txIDs) throws IOException {
if (txIDs != null) {
try {
lock.lock();
transactionStatusManager.resetRetryCount(txIDs);
return deletedBlockLogStateManager.resetRetryCountOfTransactionInDB(
new ArrayList<>(txIDs));
} finally {
lock.unlock();
} catch (Exception e) {
throw new IOException("Error during transaction reset", e);
}
}
final int batchSize = 1000;
int totalProcessed = 0;
long startTxId = 0;
try {
// If txIDs are not provided, fetch all failed transactions in batches
List<DeletedBlocksTransaction> batch;
do {
// Fetch the batch of failed transactions
batch = getFailedTransactions(batchSize, startTxId);
List<Long> batchTxIDs =
batch.stream().map(DeletedBlocksTransaction::getTxID).collect(Collectors.toList());
totalProcessed += resetCount(batchTxIDs);
// Update startTxId to continue from the last processed
transaction in the next iteration
startTxId = batch.get(batch.size() - 1).getTxID() + 1;
} while (!batch.isEmpty());
}
retrun totalProcessed;
}
```
##########
hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/hdds/scm/TestStorageContainerManager.java:
##########
@@ -298,8 +298,8 @@ private void testBlockDeletionTransactions(MiniOzoneCluster
cluster) throws Exce
// Verify a few TX gets created in the TX log.
assertThat(delLog.getNumOfValidTransactions()).isGreaterThan(0);
- // These blocks cannot be found in the container, skip deleting them
- // eventually these TX will success.
Review Comment:
Please avoid unnecessary formatting.
--
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]