|
@@ -560,7 +560,6 @@ public class FSImage implements Closeable {
|
|
* file.
|
|
* file.
|
|
*/
|
|
*/
|
|
void reloadFromImageFile(File file) throws IOException {
|
|
void reloadFromImageFile(File file) throws IOException {
|
|
- // TODO: namesystem.close(); ??
|
|
|
|
namesystem.dir.reset();
|
|
namesystem.dir.reset();
|
|
|
|
|
|
LOG.debug("Reloading namespace from " + file);
|
|
LOG.debug("Reloading namespace from " + file);
|
|
@@ -603,8 +602,6 @@ public class FSImage implements Closeable {
|
|
//
|
|
//
|
|
StorageDirectory sdForProperties =
|
|
StorageDirectory sdForProperties =
|
|
loadPlan.getStorageDirectoryForProperties();
|
|
loadPlan.getStorageDirectoryForProperties();
|
|
- // TODO need to discuss what the correct logic is for determing which
|
|
|
|
- // storage directory to read properties from
|
|
|
|
sdForProperties.read();
|
|
sdForProperties.read();
|
|
File imageFile = loadPlan.getImageFile();
|
|
File imageFile = loadPlan.getImageFile();
|
|
|
|
|
|
@@ -798,8 +795,7 @@ public class FSImage implements Closeable {
|
|
long imageTxId = editLog.getLastWrittenTxId();
|
|
long imageTxId = editLog.getLastWrittenTxId();
|
|
try {
|
|
try {
|
|
saveFSImageInAllDirs(imageTxId);
|
|
saveFSImageInAllDirs(imageTxId);
|
|
- storage.writeAll(); // TODO is this a good spot for this?
|
|
|
|
-
|
|
|
|
|
|
+ storage.writeAll();
|
|
} finally {
|
|
} finally {
|
|
if (editLogWasOpen) {
|
|
if (editLogWasOpen) {
|
|
editLog.startLogSegment(imageTxId + 1, true);
|
|
editLog.startLogSegment(imageTxId + 1, true);
|
|
@@ -934,33 +930,23 @@ public class FSImage implements Closeable {
|
|
+ " role " + bnReg.getRole() + ": checkpoint is not allowed.";
|
|
+ " role " + bnReg.getRole() + ": checkpoint is not allowed.";
|
|
else if(bnReg.getLayoutVersion() < storage.getLayoutVersion()
|
|
else if(bnReg.getLayoutVersion() < storage.getLayoutVersion()
|
|
|| (bnReg.getLayoutVersion() == storage.getLayoutVersion()
|
|
|| (bnReg.getLayoutVersion() == storage.getLayoutVersion()
|
|
- && bnReg.getCTime() > storage.getCTime())
|
|
|
|
- || (bnReg.getLayoutVersion() == storage.getLayoutVersion()
|
|
|
|
- && bnReg.getCTime() == storage.getCTime()
|
|
|
|
- && bnReg.getCheckpointTxId() > storage.getMostRecentCheckpointTxId()))
|
|
|
|
|
|
+ && bnReg.getCTime() > storage.getCTime()))
|
|
// remote node has newer image age
|
|
// remote node has newer image age
|
|
msg = "Name node " + bnReg.getAddress()
|
|
msg = "Name node " + bnReg.getAddress()
|
|
+ " has newer image layout version: LV = " +bnReg.getLayoutVersion()
|
|
+ " has newer image layout version: LV = " +bnReg.getLayoutVersion()
|
|
+ " cTime = " + bnReg.getCTime()
|
|
+ " cTime = " + bnReg.getCTime()
|
|
- + " checkpointTxId = " + bnReg.getCheckpointTxId()
|
|
|
|
+ ". Current version: LV = " + storage.getLayoutVersion()
|
|
+ ". Current version: LV = " + storage.getLayoutVersion()
|
|
- + " cTime = " + storage.getCTime()
|
|
|
|
- + " checkpointTxId = " + storage.getMostRecentCheckpointTxId();
|
|
|
|
|
|
+ + " cTime = " + storage.getCTime();
|
|
if(msg != null) {
|
|
if(msg != null) {
|
|
LOG.error(msg);
|
|
LOG.error(msg);
|
|
return new NamenodeCommand(NamenodeProtocol.ACT_SHUTDOWN);
|
|
return new NamenodeCommand(NamenodeProtocol.ACT_SHUTDOWN);
|
|
}
|
|
}
|
|
- boolean isImgObsolete = true;
|
|
|
|
- if(bnReg.getLayoutVersion() == storage.getLayoutVersion()
|
|
|
|
- && bnReg.getCTime() == storage.getCTime()
|
|
|
|
- && bnReg.getCheckpointTxId() == storage.getMostRecentCheckpointTxId())
|
|
|
|
- isImgObsolete = false;
|
|
|
|
boolean needToReturnImg = true;
|
|
boolean needToReturnImg = true;
|
|
if(storage.getNumStorageDirs(NameNodeDirType.IMAGE) == 0)
|
|
if(storage.getNumStorageDirs(NameNodeDirType.IMAGE) == 0)
|
|
// do not return image if there are no image directories
|
|
// do not return image if there are no image directories
|
|
needToReturnImg = false;
|
|
needToReturnImg = false;
|
|
CheckpointSignature sig = rollEditLog();
|
|
CheckpointSignature sig = rollEditLog();
|
|
- return new CheckpointCommand(sig, isImgObsolete, needToReturnImg);
|
|
|
|
|
|
+ return new CheckpointCommand(sig, needToReturnImg);
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
/**
|