/** * @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()); }
static String getParamStringForLog(RemoteEditLog log, StorageInfo remoteStorageInfo) { return "getedit=1&" + START_TXID_PARAM + "=" + log.getStartTxId() + "&" + END_TXID_PARAM + "=" + log.getEndTxId() + "&" + STORAGEINFO_PARAM + "=" + remoteStorageInfo.toColonSeparatedString(); }
@Override public boolean equals(Object o) { if (!(o instanceof RemoteEditLog)) return false; return this.compareTo((RemoteEditLog)o) == 0; }
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 HdfsServerConstants.INVALID_TXID; } return log.getStartTxId(); } };
public static RemoteEditLog convert(RemoteEditLogProto l) { return new RemoteEditLog(l.getStartTxId(), l.getEndTxId(), l.getIsInProgress()); }
logs.add(bestLog); curStartTxId = bestLog.getEndTxId() + 1;
URL url = logger.buildURLToFetchLogs(remoteLog.getStartTxId()); long endTxId = remoteLog.getEndTxId(); if (onlyDurableTxns && inProgressOk && remoteLog.isInProgress()) { endTxId = Math.min(endTxId, committedTxnId); 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);
.getStartTxId(); long remoteJNstartTxId = otherJournalEditLogs.get(remoteJnIndex) .getStartTxId();
ret.add(new RemoteEditLog(elf.firstTxId, elf.lastTxId, elf.isInProgress())); } else if (elf.getFirstTxId() < firstTxId && firstTxId <= elf.getLastTxId()) { ret.add(new RemoteEditLog(elf.firstTxId, elf.lastTxId, elf.isInProgress()));
logs.add(bestLog); curStartTxId = bestLog.getEndTxId() + 1;
/** * 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; } }
public static RemoteEditLogProto convert(RemoteEditLog log) { return RemoteEditLogProto.newBuilder() .setStartTxId(log.getStartTxId()) .setEndTxId(log.getEndTxId()) .setIsInProgress(log.isInProgress()).build(); }
/** * @see QJournalProtocol#getEditLogManifest(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); }
if (manifest.getLogs().get(0).getStartTxId() != expectedTxId) { throw new IOException("Bad edit log manifest (expected txid = " + expectedTxId + ": " + manifest);
public static RemoteEditLog convert(RemoteEditLogProto l) { return new RemoteEditLog(l.getStartTxId(), l.getEndTxId(), l.getIsInProgress()); }
logs.add(bestLog); curStartTxId = bestLog.getEndTxId() + 1;
@Override public boolean equals(Object o) { if (!(o instanceof RemoteEditLog)) return false; return this.compareTo((RemoteEditLog)o) == 0; }
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); } }
public static RemoteEditLogProto convert(RemoteEditLog log) { return RemoteEditLogProto.newBuilder() .setStartTxId(log.getStartTxId()) .setEndTxId(log.getEndTxId()) .setIsInProgress(log.isInProgress()).build(); }