/** get FSImage */ @VisibleForTesting public FSImage getFSImage() { return namesystem.getFSImage(); }
@Override // NameNodeMXBean public boolean isUpgradeFinalized() { return this.getFSImage().isUpgradeFinalized(); }
/** Stop services required in standby state */ void stopStandbyServices() throws IOException { LOG.info("Stopping services started for standby state"); if (standbyCheckpointer != null) { standbyCheckpointer.stop(); } if (editLogTailer != null) { editLogTailer.stop(); } if (dir != null && getFSImage() != null && getFSImage().editLog != null) { getFSImage().editLog.close(); } }
public FSEditLog getEditLog() { return getFSImage().getEditLog(); }
@Override // NameNodeMxBean public String getJournalTransactionInfo() { Map<String, String> txnIdMap = new HashMap<String, String>(); txnIdMap.put("LastAppliedOrWrittenTxId", Long.toString(this.getFSImage().getLastAppliedOrWrittenTxId())); txnIdMap.put("MostRecentCheckpointTxId", Long.toString(this.getFSImage().getMostRecentCheckpointTxId())); return JSON.toString(txnIdMap); }
/** * Get registrationID for datanodes based on the namespaceID. * * @see #registerDatanode(DatanodeRegistration) * @return registration ID */ String getRegistrationID() { return Storage.getRegistrationID(getFSImage().getStorage()); }
@Metric({"TransactionsSinceLastCheckpoint", "Number of transactions since last checkpoint"}) public long getTransactionsSinceLastCheckpoint() { return getFSImage().getLastAppliedOrWrittenTxId() - getFSImage().getStorage().getMostRecentCheckpointTxId(); }
private int getLayoutVersion() { return namesystem.getFSImage().getStorage().getLayoutVersion(); }
@Override // NameNodeMXBean public String getClusterId() { return getFSImage().getStorage().getClusterID(); }
@Override // NameNodeStatusMXBean public String getNameDirSize() { return getFSImage().getStorage().getNNDirectorySize(); }
@Metric({"LastCheckpointTime", "Time in milliseconds since the epoch of the last checkpoint"}) public long getLastCheckpointTime() { return getFSImage().getStorage().getMostRecentCheckpointTime(); }
/** * Update internal state to indicate that a rolling upgrade is in progress. * @param startTime rolling upgrade start time */ void startRollingUpgradeInternal(long startTime) throws IOException { checkRollingUpgrade("start rolling upgrade"); getFSImage().checkUpgrade(); setRollingUpgradeInfo(false, startTime); }
private long countUncheckpointedTxns() { FSImage img = namesystem.getFSImage(); return img.getCorrectLastAppliedOrWrittenTxId() - img.getStorage().getMostRecentCheckpointTxId(); }
@Override // NamenodeProtocol public long getTransactionID() throws IOException { checkNNStartup(); namesystem.checkOperation(OperationCategory.UNCHECKED); namesystem.checkSuperuserPrivilege(); return namesystem.getFSImage().getCorrectLastAppliedOrWrittenTxId(); }
/** * Version of @see #getNamespaceInfo() that is not protected by a lock. */ NamespaceInfo unprotectedGetNamespaceInfo() { return new NamespaceInfo(getFSImage().getStorage().getNamespaceID(), getClusterId(), getBlockPoolId(), getFSImage().getStorage().getCTime(), getState()); }
@Override // NamenodeProtocol public long getMostRecentCheckpointTxId() throws IOException { checkNNStartup(); namesystem.checkOperation(OperationCategory.UNCHECKED); namesystem.checkSuperuserPrivilege(); return namesystem.getFSImage().getMostRecentCheckpointTxId(); }
@Override public TransferFsImage.TransferResult call() throws IOException, InterruptedException { CheckpointFaultInjector.getInstance().duringUploadInProgess(); return TransferFsImage.uploadImageFromStorage(activeNNAddress, conf, namesystem .getFSImage().getStorage(), imageType, txid, canceler); } });
void endCheckpoint(NamenodeRegistration registration, CheckpointSignature sig) throws IOException { checkOperation(OperationCategory.CHECKPOINT); readLock(); try { checkOperation(OperationCategory.CHECKPOINT); checkNameNodeSafeMode("Checkpoint not ended"); LOG.info("End checkpoint for " + registration.getAddress()); getFSImage().endCheckpoint(sig); } finally { readUnlock("endCheckpoint"); } }
NamenodeCommand startCheckpoint(NamenodeRegistration backupNode, NamenodeRegistration activeNamenode) throws IOException { checkOperation(OperationCategory.CHECKPOINT); writeLock(); try { checkOperation(OperationCategory.CHECKPOINT); checkNameNodeSafeMode("Checkpoint not started"); LOG.info("Start checkpoint for " + backupNode.getAddress()); NamenodeCommand cmd = getFSImage().startCheckpoint(backupNode, activeNamenode, getEffectiveLayoutVersion()); getEditLog().logSync(); return cmd; } finally { writeUnlock("startCheckpoint"); } }
void finalizeUpgrade() throws IOException { String operationName = "finalizeUpgrade"; checkSuperuserPrivilege(operationName); checkOperation(OperationCategory.UNCHECKED); cpLock(); // Block if a checkpointing is in progress on standby. writeLock(); try { checkOperation(OperationCategory.UNCHECKED); getFSImage().finalizeUpgrade(this.isHaEnabled() && inActiveState()); } finally { writeUnlock(operationName); cpUnlock(); } logAuditEvent(true, operationName, null); }