Skip to content

Commit

Permalink
[Enhancement] Check meta size enough for BDB Log (#34813)
Browse files Browse the repository at this point in the history
Signed-off-by: gengjun-git <gengjun@starrocks.com>
  • Loading branch information
gengjun-git authored Nov 14, 2023
1 parent 5390b04 commit 32e8b05
Showing 1 changed file with 11 additions and 0 deletions.
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

0 comments on commit 32e8b05

Please sign in to comment.