liyuheng55555 commented on code in PR #12293:
URL: https://github.com/apache/iotdb/pull/12293#discussion_r1558793060
##########
iotdb-core/consensus/src/main/java/org/apache/iotdb/consensus/iot/IoTConsensusServerImpl.java:
##########
@@ -591,23 +614,12 @@ public void removeSyncLogChannel(Peer targetPeer) throws
ConsensusGroupModifyPee
}
}
- // TODO: persist first and then delete old configuration file
public void persistConfiguration() {
try {
- try (Stream<Path> stream = Files.walk(Paths.get(storageDir))) {
- stream
- .filter(Files::isRegularFile)
- .filter(filePath ->
filePath.getFileName().toString().contains("configuration"))
- .forEach(
- filePath -> {
- try {
- Files.delete(filePath);
- } catch (IOException e) {
- logger.error("Unexpected error occurs when deleting old
configuration file", e);
- }
- });
- }
- serializeConfigurationAndFsyncToDisk();
+ serializeConfigurationAndFsyncToDisk(CONFIGURATION_TMP_FILE_NAME);
+ deleteConfiguration(CONFIGURATION_FILE_NAME);
+ serializeConfigurationAndFsyncToDisk(CONFIGURATION_FILE_NAME);
Review Comment:
@BUAAserein why create a new file instead of rename tmp file ?
##########
iotdb-core/datanode/src/main/java/org/apache/iotdb/db/consensus/statemachine/dataregion/DataRegionStateMachine.java:
##########
@@ -287,15 +287,16 @@ public DataSet read(IConsensusRequest request) {
@Override
public File getSnapshotRoot() {
- String snapshotDir =
-
IoTDBDescriptor.getInstance().getConfig().getRatisDataRegionSnapshotDir()
- + File.separator
- + region.getDatabaseName()
- + "-"
- + region.getDataRegionId();
+ String snapshotDir = "null";
Review Comment:
@BUAAserein seems not necessary to set to "null"
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]