-
Notifications
You must be signed in to change notification settings - Fork 621
HDDS-11712. Process other DeletedBlocksTransaction before retrying failed one #7532
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 3 commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
a86e502
HDDS-11712. Iterate whole scm delete block table in SCMBlockDeletingS…
ashishkr200 e3b90d0
Update long object
ashishkr200 31481f0
Reorder import
ashishkr200 8858489
Fix review comments
ashishkr200 aa4bcc5
Handle edge case
ashishkr200 f80a461
Simplify code
ashishkr200 7fe7eba
Remove unwanted change
ashishkr200 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -93,6 +93,7 @@ public class DeletedBlockLogImpl | |||||||||||||||||||||||||||
| private long scmCommandTimeoutMs = Duration.ofSeconds(300).toMillis(); | ||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||
| private static final int LIST_ALL_FAILED_TRANSACTIONS = -1; | ||||||||||||||||||||||||||||
| private long lastProcessedTransactionId; | ||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||
| public DeletedBlockLogImpl(ConfigurationSource conf, | ||||||||||||||||||||||||||||
| StorageContainerManager scm, | ||||||||||||||||||||||||||||
|
|
@@ -115,6 +116,7 @@ public DeletedBlockLogImpl(ConfigurationSource conf, | |||||||||||||||||||||||||||
| this.scmContext = scm.getScmContext(); | ||||||||||||||||||||||||||||
| this.sequenceIdGen = scm.getSequenceIdGen(); | ||||||||||||||||||||||||||||
| this.metrics = metrics; | ||||||||||||||||||||||||||||
| this.lastProcessedTransactionId = -1L; | ||||||||||||||||||||||||||||
| this.transactionStatusManager = | ||||||||||||||||||||||||||||
| new SCMDeletedBlockTransactionStatusManager(deletedBlockLogStateManager, | ||||||||||||||||||||||||||||
| containerManager, this.scmContext, metrics, scmCommandTimeoutMs); | ||||||||||||||||||||||||||||
|
|
@@ -341,9 +343,13 @@ public DatanodeDeletedBlockTransactions getTransactions( | |||||||||||||||||||||||||||
| scmCommandTimeoutMs); | ||||||||||||||||||||||||||||
| DatanodeDeletedBlockTransactions transactions = | ||||||||||||||||||||||||||||
| new DatanodeDeletedBlockTransactions(); | ||||||||||||||||||||||||||||
| long firstProcessedTransactionKey = -1; | ||||||||||||||||||||||||||||
| try (TableIterator<Long, | ||||||||||||||||||||||||||||
| ? extends Table.KeyValue<Long, DeletedBlocksTransaction>> iter = | ||||||||||||||||||||||||||||
| deletedBlockLogStateManager.getReadOnlyIterator()) { | ||||||||||||||||||||||||||||
| if (lastProcessedTransactionId != -1) { | ||||||||||||||||||||||||||||
| iter.seek(lastProcessedTransactionId); | ||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||
| // Get the CmdStatus status of the aggregation, so that the current | ||||||||||||||||||||||||||||
| // status of the specified transaction can be found faster | ||||||||||||||||||||||||||||
| Map<UUID, Map<Long, CmdStatus>> commandStatus = | ||||||||||||||||||||||||||||
|
|
@@ -360,6 +366,12 @@ public DatanodeDeletedBlockTransactions getTransactions( | |||||||||||||||||||||||||||
| transactions.getBlocksDeleted() < blockDeletionLimit) { | ||||||||||||||||||||||||||||
| Table.KeyValue<Long, DeletedBlocksTransaction> keyValue = iter.next(); | ||||||||||||||||||||||||||||
| DeletedBlocksTransaction txn = keyValue.getValue(); | ||||||||||||||||||||||||||||
| if (firstProcessedTransactionKey == keyValue.getKey()) { | ||||||||||||||||||||||||||||
| break; | ||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||
| if (firstProcessedTransactionKey == -1) { | ||||||||||||||||||||||||||||
| firstProcessedTransactionKey = keyValue.getKey(); | ||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||
| final ContainerID id = ContainerID.valueOf(txn.getContainerID()); | ||||||||||||||||||||||||||||
| try { | ||||||||||||||||||||||||||||
| // HDDS-7126. When container is under replicated, it is possible | ||||||||||||||||||||||||||||
|
|
@@ -386,6 +398,25 @@ public DatanodeDeletedBlockTransactions getTransactions( | |||||||||||||||||||||||||||
| LOG.warn("Container: {} was not found for the transaction: {}.", id, txn); | ||||||||||||||||||||||||||||
| txIDs.add(txn.getTxID()); | ||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||
| if (!iter.hasNext()) { | ||||||||||||||||||||||||||||
| try (TableIterator<Long, | ||||||||||||||||||||||||||||
| ? extends Table.KeyValue<Long, DeletedBlocksTransaction>> tmpIter = | ||||||||||||||||||||||||||||
| deletedBlockLogStateManager.getReadOnlyIterator()) { | ||||||||||||||||||||||||||||
| if (tmpIter.hasNext()) { | ||||||||||||||||||||||||||||
| keyValue = tmpIter.next(); | ||||||||||||||||||||||||||||
| if (keyValue.getKey() != firstProcessedTransactionKey) { | ||||||||||||||||||||||||||||
| iter.seek(keyValue.getKey()); | ||||||||||||||||||||||||||||
| } else { | ||||||||||||||||||||||||||||
| break; | ||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @nandakumar131 Thanks for the suggestion, handled it. |
||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||
| if (iter.hasNext()) { | ||||||||||||||||||||||||||||
| lastProcessedTransactionId = iter.next().getKey(); | ||||||||||||||||||||||||||||
| } else { | ||||||||||||||||||||||||||||
| lastProcessedTransactionId = -1L; | ||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||
| if (!txIDs.isEmpty()) { | ||||||||||||||||||||||||||||
| deletedBlockLogStateManager.removeTransactionsFromDB(txIDs); | ||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.