[
https://issues.apache.org/jira/browse/HDFS-8964?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14727967#comment-14727967
]
Colin Patrick McCabe commented on HDFS-8964:
--------------------------------------------
{{FileJournalManager}}: it seems like "lastReadableTxId" is a better name than
"syncTxId". After all, the last txid may or may not have been synced. This
also reflects the fact that this starts out as Long.MAX_VALUE, indicating that
we can read all txids.
{{FsEditLogLoader#validateEditLog}}: {{maxTxId}} seems like a confusing name
here. It's not really the maximum, since if there is a transaction gap, we may
end up reading a later txid (and returning the transaction!). How about
{{finalTxId}}, plus a JavaDoc indicating that we will stop reading after
reading this or a higher txid.
Please remove the whitespace-only changes, including the one in
{{testEditLogFailOverFromCorrupt}} (I mentioned this above)
Looks good aside from that. Thanks, [~zhz].
> Provide max TxId when validating in-progress edit log files
> -----------------------------------------------------------
>
> Key: HDFS-8964
> URL: https://issues.apache.org/jira/browse/HDFS-8964
> Project: Hadoop HDFS
> Issue Type: Bug
> Components: journal-node, namenode
> Affects Versions: 2.7.1
> Reporter: Zhe Zhang
> Assignee: Zhe Zhang
> Attachments: HDFS-8964.00.patch, HDFS-8964.01.patch,
> HDFS-8964.02.patch, HDFS-8964.03.patch, HDFS-8964.04.patch
>
>
> NN/JN validates in-progress edit log files in multiple scenarios, via
> {{EditLogFile#validateLog}}. The method scans through the edit log file to
> find the last transaction ID.
> However, an in-progress edit log file could be actively written to, which
> creates a race condition and causes incorrect data to be read (and later we
> attempt to interpret the data as ops).
> Currently {{validateLog}} is used in 3 places:
> # NN {{getEditsFromTxid}}
> # JN {{getEditLogManifest}}
> # NN/JN {{recoverUnfinalizedSegments}}
> In the first two scenarios we should provide a maximum TxId to validate in
> the in-progress file. The 3rd scenario won't cause a race condition because
> only non-current in-progress edit log files are validated.
> {{validateLog}} is actually only used with in-progress files, and could use a
> better name and Javadoc.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)