[fix](checkpoint)fix Checkpoint error when http server is not ready #19699
This commit is contained in:
@ -172,6 +172,7 @@ public class DorisFE {
|
||||
httpServer.setMinThreads(Config.jetty_threadPool_minThreads);
|
||||
httpServer.setMaxHttpHeaderSize(Config.jetty_server_max_http_header_size);
|
||||
httpServer.start();
|
||||
Env.getCurrentEnv().setHttpReady(true);
|
||||
}
|
||||
|
||||
if (options.enableQeService) {
|
||||
|
||||
@ -333,6 +333,8 @@ public class Env {
|
||||
// set to true after finished replay all meta and ready to serve
|
||||
// set to false when catalog is not ready.
|
||||
private AtomicBoolean isReady = new AtomicBoolean(false);
|
||||
// set to true after http server start
|
||||
private AtomicBoolean httpReady = new AtomicBoolean(false);
|
||||
// set to true if FE can offer READ service.
|
||||
// canRead can be true even if isReady is false.
|
||||
// for example: OBSERVER transfer to UNKNOWN, then isReady will be set to false, but canRead can still be true
|
||||
@ -920,6 +922,14 @@ public class Env {
|
||||
return isReady.get();
|
||||
}
|
||||
|
||||
public boolean isHttpReady() {
|
||||
return httpReady.get();
|
||||
}
|
||||
|
||||
public void setHttpReady(boolean httpReady) {
|
||||
this.httpReady.set(httpReady);
|
||||
}
|
||||
|
||||
private void getClusterIdAndRole() throws IOException {
|
||||
File roleFile = new File(this.imageDir, Storage.ROLE_FILE);
|
||||
File versionFile = new File(this.imageDir, Storage.VERSION_FILE);
|
||||
|
||||
@ -83,6 +83,10 @@ public class Checkpoint extends MasterDaemon {
|
||||
// public for unit test, so that we can trigger checkpoint manually.
|
||||
// DO NOT call it manually outside the unit test.
|
||||
public synchronized void doCheckpoint() throws CheckpointException {
|
||||
if (!Env.getServingEnv().isHttpReady()) {
|
||||
LOG.info("Http server is not ready.");
|
||||
return;
|
||||
}
|
||||
long imageVersion = 0;
|
||||
long checkPointVersion = 0;
|
||||
Storage storage = null;
|
||||
|
||||
Reference in New Issue
Block a user