HDFS-11292. log lastWrittenTxId etc info in logSyncAll. Contributed by Yongjun Zhang.

(cherry picked from commit 603cbcd513)
This commit is contained in:
Yongjun Zhang 2017-01-09 15:44:42 -08:00
parent 76d62b0632
commit 137547579b
1 changed files with 15 additions and 3 deletions

View File

@ -597,7 +597,15 @@ public class FSEditLog implements LogsPurgeable {
*/
void logSyncAll() {
// Make sure we're synced up to the most recent transaction ID.
logSync(getLastWrittenTxId());
long lastWrittenTxId = getLastWrittenTxId();
LOG.info("logSyncAll toSyncToTxId=" + lastWrittenTxId
+ " lastSyncedTxid=" + synctxid
+ " mostRecentTxid=" + txid);
logSync(lastWrittenTxId);
lastWrittenTxId = getLastWrittenTxId();
LOG.info("Done logSyncAll lastWrittenTxId=" + lastWrittenTxId
+ " lastSyncedTxid=" + synctxid
+ " mostRecentTxid=" + txid);
}
/**
@ -1325,7 +1333,8 @@ public class FSEditLog implements LogsPurgeable {
* Transitions from IN_SEGMENT state to BETWEEN_LOG_SEGMENTS state.
*/
public synchronized void endCurrentLogSegment(boolean writeEndTxn) {
LOG.info("Ending log segment " + curSegmentTxId);
LOG.info("Ending log segment " + curSegmentTxId +
", " + getLastWrittenTxId());
Preconditions.checkState(isSegmentOpen(),
"Bad state: %s", state);
@ -1339,7 +1348,10 @@ public class FSEditLog implements LogsPurgeable {
printStatistics(true);
final long lastTxId = getLastWrittenTxId();
final long lastSyncedTxId = getSyncTxId();
Preconditions.checkArgument(lastTxId == lastSyncedTxId,
"LastWrittenTxId %s is expected to be the same as lastSyncedTxId %s",
lastTxId, lastSyncedTxId);
try {
journalSet.finalizeLogSegment(curSegmentTxId, lastTxId);
editLogStream = null;