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
Original file line number Diff line number Diff line change
Expand Up @@ -216,8 +216,6 @@ public void checkSystemConfig() throws ConfigurationException, IOException {
properties = systemPropertiesHandler.read();

if (systemPropertiesHandler.isFirstStart()) {
// overwrite system.properties when first start
generateOrOverwriteSystemPropertiesFile();
if (config.getDataRegionConsensusProtocolClass().equals(ConsensusFactory.IOT_CONSENSUS)
&& config.getWalMode().equals(WALMode.DISABLE)) {
throw new ConfigurationException(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -194,9 +194,11 @@ protected void doAddNode() {
isFirstStart = prepareDataNode();

if (isFirstStart) {
logger.info("DataNode is starting for the first time...");
ConfigNodeInfo.getInstance()
.updateConfigNodeList(Collections.singletonList(config.getSeedConfigNode()));
} else {
logger.info("DataNode is restarting...");
// Load registered ConfigNodes from system.properties
ConfigNodeInfo.getInstance().loadConfigNodeList();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
package org.apache.iotdb.commons.file;

import org.apache.ratis.util.AutoCloseableLock;
import org.apache.ratis.util.FileUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

Expand Down Expand Up @@ -158,12 +159,14 @@ private void replaceFormalFile() throws IOException {
"Delete formal system properties file fail: %s", formalFile.getAbsoluteFile());
throw new IOException(msg);
}
if (!tmpFile.renameTo(formalFile)) {
try {
FileUtils.move(tmpFile.toPath(), formalFile.toPath());
} catch (IOException e) {
String msg =
String.format(
"Failed to replace formal system properties file, you may manually rename it: %s -> %s",
tmpFile.getAbsolutePath(), formalFile.getAbsolutePath());
throw new IOException(msg);
throw new IOException(msg, e);
}
}

Expand Down