This is an automated email from the ASF dual-hosted git repository. morningman pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/incubator-doris.git
The following commit(s) were added to refs/heads/master by this push: new 0b6758cacd [fix](checkpoint) fix checkpoint failure when reloading new image (#9262) 0b6758cacd is described below commit 0b6758cacdeb282e146ef7ab123e3a71259fa750 Author: Mingyu Chen <morningman....@gmail.com> AuthorDate: Thu Apr 28 09:47:16 2022 +0800 [fix](checkpoint) fix checkpoint failure when reloading new image (#9262) Introduced from #9011 --- .../main/java/org/apache/doris/master/Checkpoint.java | 16 ++++++++++------ .../test/java/org/apache/doris/qe/VariableMgrTest.java | 2 ++ 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/fe/fe-core/src/main/java/org/apache/doris/master/Checkpoint.java b/fe/fe-core/src/main/java/org/apache/doris/master/Checkpoint.java index 2d3c3ac271..4eda3fb9ef 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/master/Checkpoint.java +++ b/fe/fe-core/src/main/java/org/apache/doris/master/Checkpoint.java @@ -32,11 +32,11 @@ import org.apache.doris.persist.Storage; import org.apache.doris.qe.VariableMgr; import org.apache.doris.system.Frontend; +import com.google.common.base.Strings; + import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; -import com.google.common.base.Strings; - import java.io.IOException; import java.io.OutputStream; import java.net.HttpURLConnection; @@ -73,12 +73,16 @@ public class Checkpoint extends MasterDaemon { @Override protected void runAfterCatalogReady() { - doCheckpoint(); + try { + doCheckpoint(); + } catch (CheckpointException e) { + LOG.warn("failed to do checkpoint.", e); + } } // public for unit test, so that we can trigger checkpoint manually. // DO NOT call it manually outside the unit test. - public synchronized void doCheckpoint() { + public synchronized void doCheckpoint() throws CheckpointException { long imageVersion = 0; long checkPointVersion = 0; Storage storage = null; @@ -135,6 +139,7 @@ public class Checkpoint extends MasterDaemon { // If success, do all the following jobs // If failed, just return catalog = Catalog.getCurrentCatalog(); + createStaticFieldForCkpt(); catalog.loadImage(imageDir); if (MetricRepo.isInit) { MetricRepo.COUNTER_IMAGE_WRITE_SUCCESS.increase(1L); @@ -142,12 +147,11 @@ public class Checkpoint extends MasterDaemon { LOG.info("checkpoint finished save image.{}", replayedJournalId); } catch (Throwable e) { exceptionCaught = true; - e.printStackTrace(); LOG.error("Exception when generate new image file", e); if (MetricRepo.isInit) { MetricRepo.COUNTER_IMAGE_WRITE_FAILED.increase(1L); } - return; + throw new CheckpointException(e.getMessage(), e); } finally { // destroy checkpoint catalog, reclaim memory catalog = null; diff --git a/fe/fe-core/src/test/java/org/apache/doris/qe/VariableMgrTest.java b/fe/fe-core/src/test/java/org/apache/doris/qe/VariableMgrTest.java index 074ab86af4..38e235ce0f 100644 --- a/fe/fe-core/src/test/java/org/apache/doris/qe/VariableMgrTest.java +++ b/fe/fe-core/src/test/java/org/apache/doris/qe/VariableMgrTest.java @@ -179,6 +179,8 @@ public class VariableMgrTest { // the Catalog.isCheckpointThread() will return true. Deencapsulation.setField(Catalog.class, "checkpointThreadId", Thread.currentThread().getId()); currentCatalog.getCheckpointer().doCheckpoint(); + } catch (Throwable e) { + Assert.fail(e.getMessage()); } finally { // Restore the ckptThreadId Deencapsulation.setField(Catalog.class, "checkpointThreadId", ckptThreadId); --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org For additional commands, e-mail: commits-h...@doris.apache.org