Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Enhancement] Check meta size enough for BDB Log #34813

Merged
merged 4 commits into from
Nov 14, 2023
Merged
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
11 changes: 11 additions & 0 deletions fe/fe-core/src/main/java/com/starrocks/leader/MetaHelper.java
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,12 @@

package com.starrocks.leader;

import com.sleepycat.je.config.EnvironmentParams;
import com.starrocks.common.Config;
import com.starrocks.common.InvalidMetaDirException;
import com.starrocks.common.io.IOUtils;
import com.starrocks.journal.bdbje.BDBEnvironment;
import com.starrocks.monitor.unit.ByteSizeValue;
import com.starrocks.server.GlobalStateMgr;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
Expand All @@ -50,6 +52,7 @@
import java.io.OutputStream;
import java.net.HttpURLConnection;
import java.net.URL;
import java.nio.file.FileStore;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
Expand Down Expand Up @@ -164,6 +167,14 @@ public static void checkMetaDir() throws InvalidMetaDirException,
}
}

long lowerFreeDiskSize = Long.parseLong(EnvironmentParams.FREE_DISK.getDefault());
FileStore store = Files.getFileStore(Paths.get(Config.meta_dir));
if (store.getUsableSpace() < lowerFreeDiskSize) {
LOG.error("Free capacity left for meta dir: {} is less than {}",
Config.meta_dir, new ByteSizeValue(lowerFreeDiskSize));
throw new InvalidMetaDirException();
}

Path imageDir = Paths.get(Config.meta_dir + GlobalStateMgr.IMAGE_DIR);
Path bdbDir = Paths.get(BDBEnvironment.getBdbDir());
boolean haveImageData = false;
Expand Down
Loading