You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ozone.apache.org by so...@apache.org on 2022/10/10 11:02:51 UTC
[ozone] branch master updated: HDDS-7287. Send deleteBlocksRequest with correct retry count (#3799)
This is an automated email from the ASF dual-hosted git repository.
sodonnell pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/ozone.git
The following commit(s) were added to refs/heads/master by this push:
new 17753bc93c HDDS-7287. Send deleteBlocksRequest with correct retry count (#3799)
17753bc93c is described below
commit 17753bc93c60ab969e3827ac8d94b49c83b168a2
Author: Symious <yi...@foxmail.com>
AuthorDate: Mon Oct 10 19:02:44 2022 +0800
HDDS-7287. Send deleteBlocksRequest with correct retry count (#3799)
---
.../hadoop/hdds/scm/block/DeletedBlockLogImpl.java | 14 +++++++++++---
.../hadoop/hdds/scm/block/TestDeletedBlockLog.java | 19 ++++++++++++++++++-
2 files changed, 29 insertions(+), 4 deletions(-)
diff --git a/hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/block/DeletedBlockLogImpl.java b/hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/block/DeletedBlockLogImpl.java
index e19a82c914..31877876e1 100644
--- a/hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/block/DeletedBlockLogImpl.java
+++ b/hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/block/DeletedBlockLogImpl.java
@@ -195,6 +195,9 @@ public class DeletedBlockLogImpl
.map(DeletedBlocksTransaction::getTxID)
.collect(Collectors.toList());
}
+ for (Long txID: txIDs) {
+ transactionToRetryCountMap.computeIfPresent(txID, (key, value) -> 0);
+ }
return deletedBlockLogStateManager.resetRetryCountOfTransactionInDB(
new ArrayList<>(new HashSet<>(txIDs)));
} finally {
@@ -390,17 +393,22 @@ public class DeletedBlockLogImpl
private void getTransaction(DeletedBlocksTransaction tx,
DatanodeDeletedBlockTransactions transactions) {
try {
+ DeletedBlocksTransaction updatedTxn = DeletedBlocksTransaction
+ .newBuilder(tx)
+ .setCount(transactionToRetryCountMap.getOrDefault(tx.getTxID(), 0))
+ .build();
Set<ContainerReplica> replicas = containerManager
- .getContainerReplicas(ContainerID.valueOf(tx.getContainerID()));
+ .getContainerReplicas(
+ ContainerID.valueOf(updatedTxn.getContainerID()));
for (ContainerReplica replica : replicas) {
UUID dnID = replica.getDatanodeDetails().getUuid();
Set<UUID> dnsWithTransactionCommitted =
- transactionToDNsCommitMap.get(tx.getTxID());
+ transactionToDNsCommitMap.get(updatedTxn.getTxID());
if (dnsWithTransactionCommitted == null || !dnsWithTransactionCommitted
.contains(dnID)) {
// Transaction need not be sent to dns which have
// already committed it
- transactions.addTransactionToDN(dnID, tx);
+ transactions.addTransactionToDN(dnID, updatedTxn);
}
}
} catch (IOException e) {
diff --git a/hadoop-hdds/server-scm/src/test/java/org/apache/hadoop/hdds/scm/block/TestDeletedBlockLog.java b/hadoop-hdds/server-scm/src/test/java/org/apache/hadoop/hdds/scm/block/TestDeletedBlockLog.java
index bccc2441eb..7c2f2ddebb 100644
--- a/hadoop-hdds/server-scm/src/test/java/org/apache/hadoop/hdds/scm/block/TestDeletedBlockLog.java
+++ b/hadoop-hdds/server-scm/src/test/java/org/apache/hadoop/hdds/scm/block/TestDeletedBlockLog.java
@@ -335,11 +335,20 @@ public class TestDeletedBlockLog {
// This will return all TXs, total num 30.
List<DeletedBlocksTransaction> blocks = getAllTransactions();
List<Long> txIDs = blocks.stream().map(DeletedBlocksTransaction::getTxID)
- .collect(Collectors.toList());
+ .distinct().collect(Collectors.toList());
+ Assertions.assertEquals(30, txIDs.size());
+
+ for (DeletedBlocksTransaction block : blocks) {
+ Assertions.assertEquals(0, block.getCount());
+ }
for (int i = 0; i < maxRetry; i++) {
incrementCount(txIDs);
}
+ blocks = getAllTransactions();
+ for (DeletedBlocksTransaction block : blocks) {
+ Assertions.assertEquals(maxRetry, block.getCount());
+ }
// Increment another time so it exceed the maxRetry.
// On this call, count will be set to -1 which means TX eventually fails.
@@ -388,6 +397,14 @@ public class TestDeletedBlockLog {
for (DeletedBlocksTransaction block : blocks) {
Assertions.assertEquals(0, block.getCount());
}
+
+ // Increment for the reset transactions.
+ incrementCount(txIDs);
+ blocks = getAllTransactions();
+ for (DeletedBlocksTransaction block : blocks) {
+ Assertions.assertEquals(1, block.getCount());
+ }
+
Assertions.assertEquals(30 * THREE, blocks.size());
}
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@ozone.apache.org
For additional commands, e-mail: commits-help@ozone.apache.org