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

This commit is contained in:
Yongjun Zhang 2017-01-09 15:44:42 -08:00
parent 0a212a40fc
commit 603cbcd513
1 changed files with 15 additions and 3 deletions

View File

@ -596,7 +596,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);
}
/**
@ -1358,7 +1366,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);
@ -1372,7 +1381,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;