NN unable to restart or start ---- failover feature will be disabled...
Blocker
Yes.
Yes. IOException (mishandled) + later unable to start exception
Entire data center because any NN will not start after this.
0.22.0
Standard
1. Trigger the namespace saving (feature start)
2. save image encounter exception from underlying file system (data corrupt)
In this order
No. 2 has to arrive at a particular time:
FSImage.saveNamespace(...), does the following:
The IOException needs to occur btw. 2 and 3 for this failure to trigger.
Yes.
2 (NN + the other failing over NN)
NN failed to start because it cannot load the edits.
From the log, you can also see that previously there was an exception when NN was to save image in saveNamespace.
Yes
The developers simply didn’t anticipate the error occurred in saving the image.
- FSImageSaver saver = new FSImageSaver(sd, errorSDs);
- Thread saveThread = new Thread(saver, saver.toString());
- saveThreads.add(saveThread);
- saveThread.start();
+ if (errorSDs.contains(sd)) {
+ continue;
+ }
+ try {
+ FSImageSaver saver = new FSImageSaver(sd, errorSDs);
+ Thread saveThread = new Thread(saver, saver.toString());
+ saveThreads.add(saveThread);
+ saveThread.start();
+ } catch (Exception e) {
+ LOG.error("Failed save to edits directory " + sd.getRoot(), e);
+ errorSDs.add(sd);
+ continue;
+ }
This error (IOException), in the buggy version, was eventually caught by an upper-level function:
public void run() {
// Check the size of the edit log once every 5 minutes.
long periodMSec = 5 * 60; // 5 minutes
if(checkpointPeriod < periodMSec) {
periodMSec = checkpointPeriod;
}
periodMSec *= 1000;
long lastCheckpointTime = 0;
if (!backupNode.shouldCheckpointAtStartup()) {
lastCheckpointTime = now();
}
while(shouldRun) {
try {
long now = now();
boolean shouldCheckpoint = false;
if(now >= lastCheckpointTime + periodMSec) {
shouldCheckpoint = true;
} else {
long txns = countUncheckpointedTxns();
if(txns >= checkpointTxnCount)
shouldCheckpoint = true;
}
if(shouldCheckpoint) {
doCheckpoint();
lastCheckpointTime = now;
}
} catch(IOException e) {
LOG.error("Exception in doCheckpoint: ", e);
} catch(Throwable e) {
LOG.error("Throwable Exception in doCheckpoint: ", e);
shutdown();
break;
}
Incorrect error handling (handled, missed error subtype).
As you can see clearly from patch above, they did not anticipate that an error can be thrown in step 2 in the sequence above.
The handler of this IOException, however, is empty!