|
@@ -211,7 +211,7 @@ public class FileJournalManager implements JournalManager {
|
|
|
}
|
|
|
if (elf.isInProgress()) {
|
|
|
try {
|
|
|
- elf.validateLog(getLastReadableTxId());
|
|
|
+ elf.scanLog(getLastReadableTxId(), true);
|
|
|
} catch (IOException e) {
|
|
|
LOG.error("got IOException while trying to validate header of " +
|
|
|
elf + ". Skipping.", e);
|
|
@@ -348,8 +348,8 @@ public class FileJournalManager implements JournalManager {
|
|
|
}
|
|
|
|
|
|
static void addStreamsToCollectionFromFiles(Collection<EditLogFile> elfs,
|
|
|
- Collection<EditLogInputStream> streams, long fromTxId, long maxTxIdToValidate,
|
|
|
- boolean inProgressOk) {
|
|
|
+ Collection<EditLogInputStream> streams, long fromTxId,
|
|
|
+ long maxTxIdToScan, boolean inProgressOk) {
|
|
|
for (EditLogFile elf : elfs) {
|
|
|
if (elf.isInProgress()) {
|
|
|
if (!inProgressOk) {
|
|
@@ -360,7 +360,7 @@ public class FileJournalManager implements JournalManager {
|
|
|
continue;
|
|
|
}
|
|
|
try {
|
|
|
- elf.validateLog(maxTxIdToValidate);
|
|
|
+ elf.scanLog(maxTxIdToScan, true);
|
|
|
} catch (IOException e) {
|
|
|
LOG.error("got IOException while trying to validate header of " +
|
|
|
elf + ". Skipping.", e);
|
|
@@ -404,7 +404,7 @@ public class FileJournalManager implements JournalManager {
|
|
|
continue;
|
|
|
}
|
|
|
|
|
|
- elf.validateLog(getLastReadableTxId());
|
|
|
+ elf.scanLog(getLastReadableTxId(), true);
|
|
|
|
|
|
if (elf.hasCorruptHeader()) {
|
|
|
elf.moveAsideCorruptFile();
|
|
@@ -536,20 +536,16 @@ public class FileJournalManager implements JournalManager {
|
|
|
* Find out where the edit log ends.
|
|
|
* This will update the lastTxId of the EditLogFile or
|
|
|
* mark it as corrupt if it is.
|
|
|
- * @param maxTxIdToValidate Maximum Tx ID to try to validate. Validation
|
|
|
- * returns after reading this or a higher ID.
|
|
|
- * The file portion beyond this ID is potentially
|
|
|
- * being updated.
|
|
|
+ * @param maxTxIdToScan Maximum Tx ID to try to scan.
|
|
|
+ * The scan returns after reading this or a higher ID.
|
|
|
+ * The file portion beyond this ID is potentially being
|
|
|
+ * updated.
|
|
|
+ * @param verifyVersion Whether the scan should verify the layout version
|
|
|
*/
|
|
|
- public void validateLog(long maxTxIdToValidate) throws IOException {
|
|
|
- EditLogValidation val = EditLogFileInputStream.validateEditLog(file,
|
|
|
- maxTxIdToValidate);
|
|
|
- this.lastTxId = val.getEndTxId();
|
|
|
- this.hasCorruptHeader = val.hasCorruptHeader();
|
|
|
- }
|
|
|
-
|
|
|
- public void scanLog() throws IOException {
|
|
|
- EditLogValidation val = EditLogFileInputStream.scanEditLog(file);
|
|
|
+ public void scanLog(long maxTxIdToScan, boolean verifyVersion)
|
|
|
+ throws IOException {
|
|
|
+ EditLogValidation val = EditLogFileInputStream.scanEditLog(file,
|
|
|
+ maxTxIdToScan, verifyVersion);
|
|
|
this.lastTxId = val.getEndTxId();
|
|
|
this.hasCorruptHeader = val.hasCorruptHeader();
|
|
|
}
|