Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 10 additions & 6 deletions fe/fe-core/src/main/java/org/apache/doris/master/Checkpoint.java
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,11 @@
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;
Expand Down Expand Up @@ -73,12 +73,16 @@ public void write(int b) throws IOException {

@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;
Expand Down Expand Up @@ -135,19 +139,19 @@ public synchronized void doCheckpoint() {
// 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);
}
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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,8 @@ public void testGlobalVariablePersist() throws Exception {
// 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);
Expand Down