-
Notifications
You must be signed in to change notification settings - Fork 588
HDDS-10141. [hsync] Support hard limit and auto recovery for hsync file. #6033
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
Changes from 4 commits
a752b87
fcc3bca
b2765a9
a590c20
7d82982
fd87570
75b23c1
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||
|---|---|---|---|---|---|---|---|---|
|
|
@@ -1844,7 +1844,7 @@ public long getTotalOpenKeyCount() throws IOException { | |||||||
|
|
||||||||
| @Override | ||||||||
| public ExpiredOpenKeys getExpiredOpenKeys(Duration expireThreshold, | ||||||||
| int count, BucketLayout bucketLayout) throws IOException { | ||||||||
| int count, BucketLayout bucketLayout, Duration leaseThreshold) throws IOException { | ||||||||
| final ExpiredOpenKeys expiredKeys = new ExpiredOpenKeys(); | ||||||||
|
|
||||||||
| final Table<String, OmKeyInfo> kt = getKeyTable(bucketLayout); | ||||||||
|
|
@@ -1857,6 +1857,8 @@ public ExpiredOpenKeys getExpiredOpenKeys(Duration expireThreshold, | |||||||
| final long expiredCreationTimestamp = | ||||||||
| expireThreshold.negated().plusMillis(Time.now()).toMillis(); | ||||||||
|
|
||||||||
| final long expiredLeaseTimestamp = | ||||||||
| leaseThreshold.negated().plusMillis(Time.now()).toMillis(); | ||||||||
|
|
||||||||
| int num = 0; | ||||||||
| while (num < count && keyValueTableIterator.hasNext()) { | ||||||||
|
|
@@ -1871,7 +1873,8 @@ public ExpiredOpenKeys getExpiredOpenKeys(Duration expireThreshold, | |||||||
| continue; | ||||||||
| } | ||||||||
|
|
||||||||
| if (openKeyInfo.getCreationTime() <= expiredCreationTimestamp) { | ||||||||
| if (openKeyInfo.getCreationTime() <= expiredCreationTimestamp || | ||||||||
| openKeyInfo.getModificationTime() <= expiredLeaseTimestamp) { | ||||||||
| final String clientIdString | ||||||||
| = dbOpenKeyName.substring(lastPrefix + 1); | ||||||||
|
|
||||||||
|
|
@@ -1882,10 +1885,12 @@ public ExpiredOpenKeys getExpiredOpenKeys(Duration expireThreshold, | |||||||
| .filter(id -> id.equals(clientIdString)) | ||||||||
| .isPresent(); | ||||||||
|
|
||||||||
| if (!isHsync) { | ||||||||
| if (!isHsync && openKeyInfo.getCreationTime() <= expiredCreationTimestamp) { | ||||||||
| // add non-hsync'ed keys | ||||||||
| expiredKeys.addOpenKey(openKeyInfo, dbOpenKeyName); | ||||||||
| } else { | ||||||||
| num++; | ||||||||
| } else if (isHsync && openKeyInfo.getModificationTime() <= expiredLeaseTimestamp && | ||||||||
| !openKeyInfo.getMetadata().containsKey(OzoneConsts.LEASE_RECOVERY)) { | ||||||||
|
Comment on lines
+1892
to
+1893
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
What if the client performing lease recovery crashes before committing the final change? The file would become recovery-in-progress forever and can't be closed.
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. When manual recovery is performed on a file we are skipping those file for auto recovery. These file can be manually recovered any time. We are skipping this to avoid any data loss in this case as the exact length may not get updated during auto recovery.
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. Yes. If the manual recovery client crashes before the final file commit, then this file will be kept in the openKeyTable. User can rerun the manual recovery through CLI again to recover the file later. |
||||||||
| // add hsync'ed keys | ||||||||
| final KeyArgs.Builder keyArgs = KeyArgs.newBuilder() | ||||||||
| .setVolumeName(info.getVolumeName()) | ||||||||
|
|
@@ -1903,8 +1908,8 @@ public ExpiredOpenKeys getExpiredOpenKeys(Duration expireThreshold, | |||||||
| info.getReplicationConfig(), keyArgs); | ||||||||
|
|
||||||||
| expiredKeys.addHsyncKey(keyArgs, Long.parseLong(clientIdString)); | ||||||||
| num++; | ||||||||
| } | ||||||||
| num++; | ||||||||
| } | ||||||||
| } | ||||||||
| } | ||||||||
|
|
||||||||
Uh oh!
There was an error while loading. Please reload this page.
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.
What happens if an admin misconfigures this to
7ms? A key will almost immediately get committed after a client callshsync()ifOpenKeyCleanupServiceis triggered at that moment?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 point is, should we have a lower limit on this config?
Uh oh!
There was an error while loading. Please reload this page.
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.
We can add one check, the hard limit should not be less than the soft limit.
For most of duration properties in Ozone, if some of them are related, then we will check whether one is smaller than another. Talking about misconfiguration, it's hard to draw a bar.
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.
@ChenSammi I agree that it is generally hard to prevent all misconfigurations.
I was prompted when I saw these
ns,msunits in the description. :DThere 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.
Added check for hard limit should not be less than the soft limit, and made it equal if it is so.