You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@iotdb.apache.org by "liyuheng55555 (via GitHub)" <gi...@apache.org> on 2024/03/01 08:57:51 UTC
Re: [PR] Split IoTConsensus region peer configuration for region migration [iotdb]
liyuheng55555 commented on code in PR #12101:
URL: https://github.com/apache/iotdb/pull/12101#discussion_r1508679236
##########
iotdb-core/consensus/src/main/java/org/apache/iotdb/consensus/iot/IoTConsensusServerImpl.java:
##########
@@ -635,20 +623,59 @@ public void recoverConfiguration() {
// interrupted
// unexpectedly, we need substitute configuration with tmpConfiguration file
if (Files.exists(tmpConfigurationPath)) {
- if (Files.exists(configurationPath)) {
- Files.delete(configurationPath);
- }
+ Files.deleteIfExists(configurationPath);
Files.move(tmpConfigurationPath, configurationPath);
}
buffer = ByteBuffer.wrap(Files.readAllBytes(configurationPath));
Review Comment:
After the configuration.dat file is split, seems Files.readAllBytes(configurationPath) will cause `IOException`, then line 637 will catch this exception and handle it with the new `getConfiguration` method.
Thus, there are some other code also throw `IOException`. This makes the code here somewhat unclear.
<img width="728" alt="image" src="https://github.com/apache/iotdb/assets/90501481/c36bf5f3-8d4d-40e4-8e7b-b19c6a677f4e">
It is hoped to use a clearer method to determine whether the current processing is a new version file or an old version file (for example, whether the CONFIGURATION_FILE_NAME file exists or not).
--
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: reviews-unsubscribe@iotdb.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org