Signed-off-by: gengjun-git <gengjun@starrocks.com> Co-authored-by: gengjun-git <gengjun@starrocks.com>
This commit is contained in:
parent
a65a4e2eb9
commit
c7f97d8f46
|
|
@ -75,9 +75,6 @@ export_env_from_conf() {
|
|||
}
|
||||
|
||||
export_shared_envvars() {
|
||||
# compatible with DORIS_HOME: DORIS_HOME still be using in config on the user side, so set DORIS_HOME to the meaningful value in case of wrong envs.
|
||||
export DORIS_HOME="$STARROCKS_HOME"
|
||||
|
||||
# ===================================================================================
|
||||
# initialization of environment variables before exporting env variables from be.conf
|
||||
# For most cases, you should put default environment variables in this section.
|
||||
|
|
|
|||
|
|
@ -58,9 +58,6 @@ done
|
|||
|
||||
export STARROCKS_HOME=`cd "$curdir/.."; pwd`
|
||||
|
||||
# compatible with DORIS_HOME: DORIS_HOME still be using in config on the user side, so set DORIS_HOME to the meaningful value in case of wrong envs.
|
||||
export DORIS_HOME="$STARROCKS_HOME"
|
||||
|
||||
source $STARROCKS_HOME/bin/common.sh
|
||||
|
||||
check_and_update_max_processes
|
||||
|
|
|
|||
|
|
@ -31,8 +31,6 @@ curdir=`dirname "$0"`
|
|||
curdir=`cd "$curdir"; pwd`
|
||||
|
||||
export STARROCKS_HOME=`cd "$curdir/.."; pwd`
|
||||
# compatible with DORIS_HOME: DORIS_HOME still be using in config on the user side, so set DORIS_HOME to the meaningful value in case of wrong envs.
|
||||
export DORIS_HOME="$STARROCKS_HOME"
|
||||
export PID_DIR=`cd "$curdir"; pwd`
|
||||
|
||||
source $STARROCKS_HOME/bin/common.sh
|
||||
|
|
|
|||
|
|
@ -31,8 +31,6 @@ curdir=`dirname "$0"`
|
|||
curdir=`cd "$curdir"; pwd`
|
||||
|
||||
export STARROCKS_HOME=`cd "$curdir/.."; pwd`
|
||||
# compatible with DORIS_HOME: DORIS_HOME still be using in config on the user side, so set DORIS_HOME to the meaningful value in case of wrong envs.
|
||||
export DORIS_HOME="$STARROCKS_HOME"
|
||||
export PID_DIR=`cd "$curdir"; pwd`
|
||||
|
||||
source $STARROCKS_HOME/bin/common.sh
|
||||
|
|
|
|||
|
|
@ -56,8 +56,6 @@ while true; do
|
|||
done
|
||||
|
||||
export STARROCKS_HOME=`cd "$curdir/.."; pwd`
|
||||
# compatible with DORIS_HOME: DORIS_HOME still be using in config on the user side, so set DORIS_HOME to the meaningful value in case of wrong envs.
|
||||
export DORIS_HOME="$STARROCKS_HOME"
|
||||
export PID_DIR=`cd "$curdir"; pwd`
|
||||
|
||||
source $STARROCKS_HOME/bin/common.sh
|
||||
|
|
|
|||
|
|
@ -208,42 +208,11 @@ public class MetaHelper {
|
|||
|
||||
public static void checkMetaDir() throws InvalidMetaDirException,
|
||||
IOException {
|
||||
// check meta dir
|
||||
// if metaDir is the default config: StarRocksFE.STARROCKS_HOME_DIR + "/meta",
|
||||
// we should check whether both the new default dir (STARROCKS_HOME_DIR + "/meta")
|
||||
// and the old default dir (DORIS_HOME_DIR + "/doris-meta") are present. If both are present,
|
||||
// we need to let users keep only one to avoid starting from outdated metadata.
|
||||
Path oldDefaultMetaDir = Paths.get(System.getenv("DORIS_HOME") + "/doris-meta");
|
||||
Path newDefaultMetaDir = Paths.get(System.getenv("STARROCKS_HOME") + "/meta");
|
||||
Path metaDir = Paths.get(Config.meta_dir);
|
||||
if (metaDir.equals(newDefaultMetaDir)) {
|
||||
File oldMeta = new File(oldDefaultMetaDir.toUri());
|
||||
File newMeta = new File(newDefaultMetaDir.toUri());
|
||||
if (oldMeta.exists() && newMeta.exists()) {
|
||||
LOG.error("New default meta dir: {} and Old default meta dir: {} are both present. " +
|
||||
"Please make sure {} has the latest data, and remove the another one.",
|
||||
newDefaultMetaDir, oldDefaultMetaDir, newDefaultMetaDir);
|
||||
throw new InvalidMetaDirException();
|
||||
}
|
||||
}
|
||||
|
||||
File meta = new File(metaDir.toUri());
|
||||
if (!meta.exists()) {
|
||||
// If metaDir is not the default config, it means the user has specified the other directory
|
||||
// We should not use the oldDefaultMetaDir.
|
||||
// Just exit in this case
|
||||
if (!metaDir.equals(newDefaultMetaDir)) {
|
||||
LOG.error("meta dir {} dose not exist", metaDir);
|
||||
throw new InvalidMetaDirException();
|
||||
}
|
||||
File oldMeta = new File(oldDefaultMetaDir.toUri());
|
||||
if (oldMeta.exists()) {
|
||||
// For backward compatible
|
||||
Config.meta_dir = oldDefaultMetaDir.toString();
|
||||
} else {
|
||||
LOG.error("meta dir {} does not exist", meta.getAbsolutePath());
|
||||
throw new InvalidMetaDirException();
|
||||
}
|
||||
LOG.error("meta dir {} does not exist", metaDir);
|
||||
throw new InvalidMetaDirException();
|
||||
}
|
||||
|
||||
long lowerFreeDiskSize = Long.parseLong(EnvironmentParams.FREE_DISK.getDefault());
|
||||
|
|
|
|||
|
|
@ -18,8 +18,6 @@ package com.starrocks.leader;
|
|||
import com.starrocks.common.Config;
|
||||
import com.starrocks.common.InvalidMetaDirException;
|
||||
import com.starrocks.persist.ImageFormatVersion;
|
||||
import mockit.Mock;
|
||||
import mockit.MockUp;
|
||||
import org.junit.jupiter.api.AfterEach;
|
||||
import org.junit.jupiter.api.Assertions;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
|
@ -39,50 +37,6 @@ public class MetaHelperTest {
|
|||
deleteDir(new File(testDir));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testHasTwoMetaDir() {
|
||||
assertThrows(InvalidMetaDirException.class, () -> {
|
||||
Config.start_with_incomplete_meta = false;
|
||||
new MockUp<System>() {
|
||||
@Mock
|
||||
public String getenv(String name) {
|
||||
return testDir;
|
||||
}
|
||||
};
|
||||
|
||||
mkdir(testDir + "/doris-meta/");
|
||||
mkdir(testDir + "/meta/");
|
||||
Config.meta_dir = testDir + "/meta";
|
||||
try {
|
||||
MetaHelper.checkMetaDir();
|
||||
} finally {
|
||||
deleteDir(new File(testDir));
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testUseOldMetaDir() throws IOException,
|
||||
InvalidMetaDirException {
|
||||
Config.start_with_incomplete_meta = false;
|
||||
new MockUp<System>() {
|
||||
@Mock
|
||||
public String getenv(String name) {
|
||||
return testDir;
|
||||
}
|
||||
};
|
||||
|
||||
mkdir(testDir + "/doris-meta/");
|
||||
Config.meta_dir = testDir + "/meta";
|
||||
try {
|
||||
MetaHelper.checkMetaDir();
|
||||
} finally {
|
||||
deleteDir(new File(testDir));
|
||||
}
|
||||
|
||||
Assertions.assertEquals(Config.meta_dir, testDir + "/doris-meta");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testImageExistBDBNotExist() {
|
||||
assertThrows(InvalidMetaDirException.class, () -> {
|
||||
|
|
|
|||
Loading…
Reference in New Issue