|
@@ -143,7 +143,6 @@ public class StandbyCheckpointer {
|
|
}
|
|
}
|
|
|
|
|
|
public void triggerRollbackCheckpoint() {
|
|
public void triggerRollbackCheckpoint() {
|
|
- thread.setNeedRollbackCheckpoint(true);
|
|
|
|
thread.interrupt();
|
|
thread.interrupt();
|
|
}
|
|
}
|
|
|
|
|
|
@@ -242,9 +241,6 @@ public class StandbyCheckpointer {
|
|
private class CheckpointerThread extends Thread {
|
|
private class CheckpointerThread extends Thread {
|
|
private volatile boolean shouldRun = true;
|
|
private volatile boolean shouldRun = true;
|
|
private volatile long preventCheckpointsUntil = 0;
|
|
private volatile long preventCheckpointsUntil = 0;
|
|
- // Indicate that a rollback checkpoint is required immediately. It will be
|
|
|
|
- // reset to false after the checkpoint is done
|
|
|
|
- private volatile boolean needRollbackCheckpoint = false;
|
|
|
|
|
|
|
|
private CheckpointerThread() {
|
|
private CheckpointerThread() {
|
|
super("Standby State Checkpointer");
|
|
super("Standby State Checkpointer");
|
|
@@ -254,10 +250,6 @@ public class StandbyCheckpointer {
|
|
this.shouldRun = shouldRun;
|
|
this.shouldRun = shouldRun;
|
|
}
|
|
}
|
|
|
|
|
|
- private void setNeedRollbackCheckpoint(boolean need) {
|
|
|
|
- this.needRollbackCheckpoint = need;
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
@Override
|
|
@Override
|
|
public void run() {
|
|
public void run() {
|
|
// We have to make sure we're logged in as far as JAAS
|
|
// We have to make sure we're logged in as far as JAAS
|
|
@@ -292,6 +284,7 @@ public class StandbyCheckpointer {
|
|
// on startup.
|
|
// on startup.
|
|
lastCheckpointTime = now();
|
|
lastCheckpointTime = now();
|
|
while (shouldRun) {
|
|
while (shouldRun) {
|
|
|
|
+ boolean needRollbackCheckpoint = namesystem.isNeedRollbackFsImage();
|
|
if (!needRollbackCheckpoint) {
|
|
if (!needRollbackCheckpoint) {
|
|
try {
|
|
try {
|
|
Thread.sleep(checkPeriod);
|
|
Thread.sleep(checkPeriod);
|
|
@@ -344,7 +337,7 @@ public class StandbyCheckpointer {
|
|
if (needRollbackCheckpoint
|
|
if (needRollbackCheckpoint
|
|
&& namesystem.getFSImage().hasRollbackFSImage()) {
|
|
&& namesystem.getFSImage().hasRollbackFSImage()) {
|
|
namesystem.setCreatedRollbackImages(true);
|
|
namesystem.setCreatedRollbackImages(true);
|
|
- needRollbackCheckpoint = false;
|
|
|
|
|
|
+ namesystem.setNeedRollbackFsImage(false);
|
|
}
|
|
}
|
|
lastCheckpointTime = now;
|
|
lastCheckpointTime = now;
|
|
}
|
|
}
|