Region migration related work#12293
Conversation
…yuheng55555/iotdb into Working/region-migration-0401
liyuheng55555
left a comment
There was a problem hiding this comment.
PTAL~ @BUAAserein
| @Override | ||
| public List<ConsensusGroupId> getAllConsensusGroupIdsFromDisk() { | ||
| List<ConsensusGroupId> consensusGroupIds = new ArrayList<>(); | ||
| try (DirectoryStream<Path> stream = Files.newDirectoryStream(storageDir.toPath())) { | ||
| for (Path path : stream) { | ||
| String[] items = path.getFileName().toString().split("_"); | ||
| ConsensusGroupId consensusGroupId = | ||
| ConsensusGroupId.Factory.create(Integer.parseInt(items[0]), Integer.parseInt(items[1])); | ||
| consensusGroupIds.add(consensusGroupId); | ||
| } | ||
| } catch (IOException e) { | ||
| logger.error("Failed to get all consensus group ids from disk", e); | ||
| } | ||
| return consensusGroupIds; | ||
| } | ||
|
|
There was a problem hiding this comment.
@BUAAserein Maybe write an UT for this function ? Test the cooperation between getAllConsensusGroupIdsFromDisk and IoTConsensus.buildPeerDir .
There was a problem hiding this comment.
This logic is the same as IoTConsensus, so may no need to add UT
There was a problem hiding this comment.
This logic is the same as IoTConsensus, so may no need to add UT
@BUAAserein I still believe it is necessary, as UT are an effective tools to ensure the logic consistency between two functions. This can be exemplified by the numerous serialize-deserialize UTs in IoTDB, such as NodeInfoTest.testSnapshot.
There was a problem hiding this comment.
Yes, we add parsingAndConstructIDTest
iotdb-core/consensus/src/main/java/org/apache/iotdb/consensus/iot/IoTConsensus.java
Outdated
Show resolved
Hide resolved
60aaa61 to
bf31c3b
Compare
9511e26 to
5e99732
Compare
liyuheng55555
left a comment
There was a problem hiding this comment.
PTAL~ @BUAAserein
iotdb-core/consensus/src/main/java/org/apache/iotdb/consensus/iot/IoTConsensusServerImpl.java
Outdated
Show resolved
Hide resolved
| + region.getDatabaseName() | ||
| + "-" | ||
| + region.getDataRegionId(); | ||
| String snapshotDir = "null"; |
There was a problem hiding this comment.
@BUAAserein seems not necessary to set to "null"
There was a problem hiding this comment.
default is ""? or just use null
iotdb-client/jdbc/src/main/java/org/apache/iotdb/jdbc/IoTDBConnection.java
Show resolved
Hide resolved
iotdb-client/jdbc/src/main/java/org/apache/iotdb/jdbc/IoTDBStatement.java
Outdated
Show resolved
Hide resolved
iotdb-client/service-rpc/src/main/java/org/apache/iotdb/rpc/TElasticFramedTransport.java
Outdated
Show resolved
Hide resolved
...onfignode/src/main/java/org/apache/iotdb/confignode/procedure/env/RegionMaintainHandler.java
Show resolved
Hide resolved
.../src/main/java/org/apache/iotdb/confignode/procedure/impl/region/AddRegionPeerProcedure.java
Show resolved
Hide resolved
| + region.getDatabaseName() | ||
| + "-" | ||
| + region.getDataRegionId(); | ||
| String snapshotDir = "null"; |
There was a problem hiding this comment.
default is ""? or just use null
iotdb-core/datanode/src/main/java/org/apache/iotdb/db/service/DataNode.java
Show resolved
Hide resolved
iotdb-protocol/thrift-consensus/src/main/thrift/iotconsensus.thrift
Outdated
Show resolved
Hide resolved
| * | ||
| * @return consensusGroupId list | ||
| */ | ||
| List<ConsensusGroupId> getAllConsensusGroupIdsFromDisk(); |
There was a problem hiding this comment.
getAllConsensusGroupIdsWithoutStarting()
iotdb-core/consensus/src/main/java/org/apache/iotdb/consensus/IConsensus.java
Show resolved
Hide resolved
…yuheng55555/iotdb into Working/region-migration-0401
| filePath.getFileName().toString().endsWith(CONFIGURATION_TMP_FILE_NAME)) | ||
| .collect(Collectors.toList()); | ||
| for (Path filePath : paths) { | ||
| String formalPath = |
There was a problem hiding this comment.
if formalPath exsists, should delete first
| } | ||
| }); | ||
| } | ||
| serializeConfigurationAndFsyncToDisk(); |
Signed-off-by: OneSizeFitQuorum <tanxinyu@apache.org>
…yuheng55555/iotdb into Working/region-migration-0401
…yuheng55555/iotdb into Working/region-migration-0401
Co-authored-by: BUAAserein <18376359@buaa.edu.cn>
No description provided.