-
Notifications
You must be signed in to change notification settings - Fork 588
HDDS-8869. Make DN DeleteBlocksCommandHandler wait for the lock can timeout. #4913
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
Conversation
adoroszlai
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @xichen01 for the patch. I haven't checked in detail, but would like to point out some minor issues noticed.
| @RunWith(Parameterized.class) | ||
| @Timeout(300) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: @Timeout is from JUnit5, all other test annotations are from JUnit4. I don't think timeout is enforced with this setup.
| conf, dnConf.getBlockDeleteThreads(), | ||
| dnConf.getBlockDeleteQueueLimit())) | ||
| dnConf.getBlockDeleteQueueLimit(), | ||
| dnConf.getBlockDeleteCommandHandleLockTimeoutMs())) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: pass DatanodeConfiguration to DeleteBlocksCommandHandler instead of individual values.
| @Metric(about = "The total number of transactions witch was failed " + | ||
| "cause by wait Container lock timeout.") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Typo: witch -> which
# Conflicts: # hadoop-hdds/container-service/src/main/java/org/apache/hadoop/ozone/container/common/helpers/BlockDeletingServiceMetrics.java # hadoop-hdds/container-service/src/main/java/org/apache/hadoop/ozone/container/common/statemachine/commandhandler/DeleteBlocksCommandHandler.java
|
@adoroszlai PTAL. Thanks. |
adoroszlai
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @xichen01 for updating the patch.
Note: there is a findbugs failure:
M D UrF: Unread public/protected field: org.apache.hadoop.ozone.container.common.statemachine.commandhandler.TestDeleteBlocksCommandHandler.testTimeout At TestDeleteBlocksCommandHandler.java:[line 80]
Once you get a clean run, please ask @sumitagrawl for review.
| @Parameterized.Parameters(name = "{index}: Schema Version {0}") | ||
| public static Collection<Object[]> data() { | ||
| return Arrays.asList(new Object[][]{ | ||
| {SCHEMA_V1}, | ||
| {SCHEMA_V2}, | ||
| {SCHEMA_V3}, | ||
| }); | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can use ContainerTestVersionInfo to parameterize by schema version and layout version.
|
@sumitagrawl PTAL. Thanks |
|
@adoroszlai PTAL, Thanks |
| * after waiting timeout, the hold time spent waiting for the lock | ||
| * is not greater than the time spent operating RocksDB | ||
| */ | ||
| @Config(key = "block.delete.command.handle.lock.timeout", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Suggest change the property name from block.delete.command.handle.lock.timeout ->
block.delete.max.lock.wait.timeout
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@xichen01 , is the slow RocksDB open a major cause behind this patch? I have one question, it takes 200ms to open a rocksdb, you set this timeout to 100ms, and retry once in the block deletion logic, why not set the default value to 200ms, with a simpler handler logic?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will this property be a reconfigurable property?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This comment may have caused some misunderstanding, I'll modify it.
The retry does not happen immediately, it waits until all DeleteBlockTransactions have been processed, so the retry may happen after a few seconds or tens of seconds.
Slow RocksDB open (Schema V2 only), rebalancer, BlockDeletingService, etc, may cause here cannot get the lock, retry to increase the chance of success.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@xichen01 , thanks for the further info.
| @Metric(about = "The total number of Container chosen to be deleted.") | ||
| private MutableGaugeLong totalContainerChosenCount; | ||
|
|
||
| @Metric(about = "The total number of transactions which was failed " + |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
which was failed cause by wait Container lock timeout -> which failed due to container lock wait timeout
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
| "containerType {}", containerType); | ||
| } | ||
| } catch (IOException e) { | ||
| } catch (IOException | InterruptedException e) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please call Thread.currentThread().interrupt() if it's an InterruptedException.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
| int newDeletionBlocks, long txnID) | ||
| KeyValueContainerData containerData, DeletedBlocksTransaction delTX) | ||
| throws IOException { | ||
| int newDeletionBlocks = 0; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you do some refactor on markBlocksForDeletionTransaction too? This newDeletionBlocks is always 0. It's better to be declared in markBlocksForDeletionTransaction.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Already modified.
|
The failed TestOzoneFileSystem.testListStatusOnKeyNameContainDelimiter is being addressed by HDDS-8877 #5093 https://github.com/apache/ozone/actions/runs/6269541505/job/17030065862 |
ChenSammi
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @xichen01 for the contribution, @adoroszlai for the review.
…e lock can timeout. (apache#4913) (cherry picked from commit 5b5d352)
What changes were proposed in this pull request?
Some performance issues are mentioned here. https://issues.apache.org/jira/browse/HDDS-8865 so in this PR:
We Make DN
DeleteBlocksCommandHandlerwait for the lock to timeout. This way, no other transaction will be blocked because the lock cannot be acquired, and for locks that time out, we can retry once on the DN if can not acquired the lock in specified time, transaction will failed and the SCM can resent it after.What is the link to the Apache JIRA
https://issues.apache.org/jira/browse/HDDS-8869
How was this patch tested?
unit test