-
Notifications
You must be signed in to change notification settings - Fork 588
HDDS-10104. [hsync] Introduce soft limit support for lease recovery #5974
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 5 commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
af364fc
HDDS-10104. Introduce soft limit support for lease recovery.
ashishkr200 63278a3
Fix integration test.
ashishkr200 1f1a547
Fix integration test.
ashishkr200 cf1da3a
Fix review comment
ashishkr200 faba6f8
Add force option in recover lease request
ashishkr200 b4eceda
Handle test for force option in recovery
ashishkr200 4106c8c
Update test case
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
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
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
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
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
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
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
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
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
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 |
|---|---|---|
|
|
@@ -21,6 +21,7 @@ | |
| import com.google.common.base.Preconditions; | ||
| import org.apache.hadoop.hdds.protocol.proto.HddsProtos; | ||
| import org.apache.hadoop.ozone.ClientVersion; | ||
| import org.apache.hadoop.ozone.OzoneConfigKeys; | ||
| import org.apache.hadoop.ozone.OzoneConsts; | ||
| import org.apache.hadoop.ozone.om.helpers.BucketLayout; | ||
| import org.apache.hadoop.ozone.om.helpers.KeyValueUtil; | ||
|
|
@@ -297,6 +298,40 @@ public void testRecoverAbsentFile() throws Exception { | |
| verifyTables(false, false); | ||
| } | ||
|
|
||
| @Test | ||
| public void testLeaseSoftLimitForHsyncRecoverFile() throws Exception { | ||
| populateNamespace(true, true, true, true); | ||
|
|
||
| // update soft limit to high value | ||
| ozoneManager.getConfiguration().set(OzoneConfigKeys.OZONE_OM_LEASE_SOFT_LIMIT, "2s"); | ||
| // Call recovery inside soft limit period it should fail | ||
| OMClientResponse omClientResponse = validateAndUpdateCache(); | ||
| OMResponse omResponse = omClientResponse.getOMResponse(); | ||
| Assertions.assertEquals(OzoneManagerProtocolProtos.Status.KEY_UNDER_LEASE_SOFT_LIMIT_PERIOD, | ||
| omResponse.getStatus()); | ||
| // Call second time inside soft limit period also should fail | ||
| omClientResponse = validateAndUpdateCache(); | ||
| omResponse = omClientResponse.getOMResponse(); | ||
| Assertions.assertEquals(OzoneManagerProtocolProtos.Status.KEY_UNDER_LEASE_SOFT_LIMIT_PERIOD, | ||
| omResponse.getStatus()); | ||
| Thread.sleep(2000); | ||
| // Call recovery after soft limit period it should succeed | ||
| omClientResponse = validateAndUpdateCache(); | ||
| omResponse = omClientResponse.getOMResponse(); | ||
| Assertions.assertEquals(OzoneManagerProtocolProtos.Status.OK, omResponse.getStatus()); | ||
| RecoverLeaseResponse recoverLeaseResponse = omResponse.getRecoverLeaseResponse(); | ||
| KeyInfo keyInfo = recoverLeaseResponse.getKeyInfo(); | ||
| Assertions.assertNotNull(keyInfo); | ||
|
|
||
| // Call recovery again it should succeed | ||
| omClientResponse = validateAndUpdateCache(); | ||
| omResponse = omClientResponse.getOMResponse(); | ||
| Assertions.assertEquals(OzoneManagerProtocolProtos.Status.OK, omResponse.getStatus()); | ||
| recoverLeaseResponse = omResponse.getRecoverLeaseResponse(); | ||
| keyInfo = recoverLeaseResponse.getKeyInfo(); | ||
| Assertions.assertNotNull(keyInfo); | ||
|
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. @ashishkumar50, could you test the both force and non-force case in this testLeaseSoftLimitForHsyncRecoverFile ? Try the Parametrized test.
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. Done |
||
| } | ||
|
|
||
| private KeyArgs getNewKeyArgs(OmKeyInfo omKeyInfo, long deltaLength) throws IOException { | ||
| OmKeyLocationInfoGroup omKeyLocationInfoGroup = omKeyInfo.getLatestVersionLocations(); | ||
| List<OmKeyLocationInfo> omKeyLocationInfoList = omKeyLocationInfoGroup.getBlocksLatestVersionOnly(); | ||
|
|
@@ -355,6 +390,9 @@ private void populateNamespace(boolean addKeyTable, boolean keyInfoWithHsyncFlag | |
| .get(openKey); | ||
| assertNotNull(omKeyInfo); | ||
| } | ||
|
|
||
| // Set lease soft limit to 0 | ||
| ozoneManager.getConfiguration().set(OzoneConfigKeys.OZONE_OM_LEASE_SOFT_LIMIT, "0s"); | ||
| } | ||
|
|
||
| protected OMRequest createAllocateBlockRequest(String volumeName, String bucketName, String keyName) { | ||
|
|
||
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.
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.
The second call should success. The soft limit period is to prevent recoveror to recover the client too soon when there is still client writing to this file. When the file is already under recovery, the soft limit period will have no use.