@Override public Long apply(RemoteEditLog log) { if (null == log) { return HdfsServerConstants.INVALID_TXID; } return log.getStartTxId(); } };
/** * Check that the logs are non-overlapping sequences of transactions, * in sorted order. They do not need to be contiguous. * @throws IllegalStateException if incorrect */ private void checkState() { Preconditions.checkNotNull(logs); RemoteEditLog prev = null; for (RemoteEditLog log : logs) { if (prev != null) { if (log.getStartTxId() <= prev.getEndTxId()) { throw new IllegalStateException( "Invalid log manifest (log " + log + " overlaps " + prev + ")\n" + this); } } prev = log; } }
.getStartTxId(); long remoteJNstartTxId = otherJournalEditLogs.get(remoteJnIndex) .getStartTxId();
static String getParamStringForLog(RemoteEditLog log, StorageInfo remoteStorageInfo) { return "getedit=1&" + START_TXID_PARAM + "=" + log.getStartTxId() + "&" + END_TXID_PARAM + "=" + log.getEndTxId() + "&" + STORAGEINFO_PARAM + "=" + remoteStorageInfo.toColonSeparatedString(); }
if (manifest.getLogs().get(0).getStartTxId() != expectedTxId) { throw new IOException("Bad edit log manifest (expected txid = " + expectedTxId + ": " + manifest);
URL url = logger.buildURLToFetchLogs(remoteLog.getStartTxId()); if (endTxId < remoteLog.getStartTxId()) { LOG.warn("Found endTxId (" + endTxId + ") that is less than " + "the startTxId (" + remoteLog.getStartTxId() + ") - setting it to startTxId."); endTxId = remoteLog.getStartTxId(); connectionFactory, url, remoteLog.getStartTxId(), endTxId, remoteLog.isInProgress()); allStreams.add(elis);
.getRoot()); assert log.getStartTxId() > 0 && log.getEndTxId() > 0 : "bad log: " + log; File finalEditsFile = jnStorage.getFinalizedEditsFile(log.getStartTxId(), log.getEndTxId()); log.getStartTxId(), log.getEndTxId());
static void rollForwardByApplyingLogs( RemoteEditLogManifest manifest, FSImage dstImage, FSNamesystem dstNamesystem) throws IOException { NNStorage dstStorage = dstImage.getStorage(); List<EditLogInputStream> editsStreams = Lists.newArrayList(); for (RemoteEditLog log : manifest.getLogs()) { if (log.getEndTxId() > dstImage.getLastAppliedTxId()) { File f = dstStorage.findFinalizedEditsFile( log.getStartTxId(), log.getEndTxId()); editsStreams.add(new EditLogFileInputStream(f, log.getStartTxId(), log.getEndTxId(), true)); } } LOG.info("Checkpointer about to load edits from " + editsStreams.size() + " stream(s)."); dstImage.loadEdits(editsStreams, dstNamesystem); } }
static void downloadEditsToStorage(URL fsName, RemoteEditLog log, NNStorage dstStorage) throws IOException { assert log.getStartTxId() > 0 && log.getEndTxId() > 0 : "bad log: " + log; String fileid = ImageServlet.getParamStringForLog( log, dstStorage); String finalFileName = NNStorage.getFinalizedEditsFileName( log.getStartTxId(), log.getEndTxId()); log.getStartTxId(), log.getEndTxId(), milliTime); List<File> tmpFiles = dstStorage.getFiles(NameNodeDirType.EDITS, tmpFileName); log.getStartTxId(), log.getEndTxId(), milliTime); File finalizedFile = NNStorage.getFinalizedEditsFile(sd, log.getStartTxId(), log.getEndTxId()); if (LOG.isDebugEnabled()) { LOG.debug("Renaming " + tmpFile + " to " + finalizedFile);
/** * @see QJournalProtocol#getEditLogManifest(String, String, long, boolean) */ public RemoteEditLogManifest getEditLogManifest(long sinceTxId, boolean inProgressOk) throws IOException { // No need to checkRequest() here - anyone may ask for the list // of segments. checkFormatted(); List<RemoteEditLog> logs = fjm.getRemoteEditLogs(sinceTxId, inProgressOk); if (inProgressOk) { RemoteEditLog log = null; for (Iterator<RemoteEditLog> iter = logs.iterator(); iter.hasNext();) { log = iter.next(); if (log.isInProgress()) { iter.remove(); break; } } if (log != null && log.isInProgress()) { logs.add(new RemoteEditLog(log.getStartTxId(), getHighestWrittenTxId(), true)); } } return new RemoteEditLogManifest(logs, getCommittedTxnId()); }
.getStartTxId(), nsInfo, false); url = new URL(remoteJNproxy.httpServerUrl, urlPath); success = downloadMissingLogSegment(url, missingLog);
public static RemoteEditLogProto convert(RemoteEditLog log) { return RemoteEditLogProto.newBuilder() .setStartTxId(log.getStartTxId()) .setEndTxId(log.getEndTxId()) .setIsInProgress(log.isInProgress()).build(); }
@Override public Long apply(RemoteEditLog log) { if (null == log) { return HdfsConstants.INVALID_TXID; } return log.getStartTxId(); } };
@Override public Long apply(RemoteEditLog log) { if (null == log) { return HdfsConstants.INVALID_TXID; } return log.getStartTxId(); } };
if (firstRemoteLog.getStartTxId() > lastApplied + 1) { LOG.info("Unable to roll forward using only logs. Downloading " + "image with txid " + sig.mostRecentCheckpointTxId); if (firstRemoteLog.getStartTxId() > lastApplied + 1) { throw new IOException("No logs to roll forward from " + lastApplied);
static String getParamStringForLog(RemoteEditLog log, StorageInfo remoteStorageInfo) { return "getedit=1&" + START_TXID_PARAM + "=" + log.getStartTxId() + "&" + END_TXID_PARAM + "=" + log.getEndTxId() + "&" + STORAGEINFO_PARAM + "=" + remoteStorageInfo.toColonSeparatedString(); }
static String getParamStringForLog(RemoteEditLog log, StorageInfo remoteStorageInfo) { return "getedit=1&" + START_TXID_PARAM + "=" + log.getStartTxId() + "&" + END_TXID_PARAM + "=" + log.getEndTxId() + "&" + STORAGEINFO_PARAM + "=" + remoteStorageInfo.toColonSeparatedString(); }
private static void compare(RemoteEditLog l1, RemoteEditLog l2) { assertEquals(l1.getEndTxId(), l2.getEndTxId()); assertEquals(l1.getStartTxId(), l2.getStartTxId()); }
public static RemoteEditLogProto convert(RemoteEditLog log) { return RemoteEditLogProto.newBuilder() .setStartTxId(log.getStartTxId()) .setEndTxId(log.getEndTxId()) .setIsInProgress(log.isInProgress()).build(); }
public static RemoteEditLogProto convert(RemoteEditLog log) { return RemoteEditLogProto.newBuilder() .setStartTxId(log.getStartTxId()) .setEndTxId(log.getEndTxId()) .setIsInProgress(log.isInProgress()).build(); }