-
Notifications
You must be signed in to change notification settings - Fork 9.2k
HDFS-16507. [SBN read] Avoid purging edit log which is in progress #4082
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 1 commit
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 |
|---|---|---|
|
|
@@ -1509,13 +1509,18 @@ synchronized void abortCurrentLogSegment() { | |
| * effect. | ||
| */ | ||
| @Override | ||
| public synchronized void purgeLogsOlderThan(final long minTxIdToKeep) { | ||
| public synchronized void purgeLogsOlderThan(long minTxIdToKeep) { | ||
| // Should not purge logs unless they are open for write. | ||
| // This prevents the SBN from purging logs on shared storage, for example. | ||
| if (!isOpenForWrite()) { | ||
| return; | ||
| } | ||
|
|
||
|
|
||
| // Reset purgeLogsFrom to avoid purging edit log which is in progress. | ||
| if (isSegmentOpen()) { | ||
| minTxIdToKeep = minTxIdToKeep > curSegmentTxId ? curSegmentTxId : minTxIdToKeep; | ||
|
||
| } | ||
|
|
||
| assert curSegmentTxId == HdfsServerConstants.INVALID_TXID || // on format this is no-op | ||
| minTxIdToKeep <= curSegmentTxId : | ||
| "cannot purge logs older than txid " + minTxIdToKeep + | ||
|
|
||
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.
Once done, we can also revert this.
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.
Good suggestion. Thank you @virajjasani for your review.