Copilot commented on code in PR #16869:
URL: https://github.com/apache/iotdb/pull/16869#discussion_r2616015260
##########
iotdb-core/datanode/src/test/java/org/apache/iotdb/db/storageengine/dataregion/wal/allocation/FirstCreateStrategyTest.java:
##########
@@ -141,6 +145,83 @@ public void testRegisterWALNode() throws
IllegalPathException {
}
}
+ @Test
+ public void testReInitializeAfterDiskSpaceCleaned() throws
IllegalPathException, IOException {
+ // Create unique temporary directory for testing
+ Path tempDir = Files.createTempDirectory("iotdb_wal_reinit_test_");
+
+ String[] testWalDirs =
+ new String[] {
+ tempDir.resolve("wal_reinit_test1").toString(),
+ tempDir.resolve("wal_reinit_test2").toString(),
+ tempDir.resolve("wal_reinit_test3").toString()
+ };
+
+ String[] originalWalDirs = commonConfig.getWalDirs();
+ commonConfig.setWalDirs(testWalDirs);
+
+ try {
Review Comment:
The test modifies the global commonConfig state before entering the try
block, but this modification is not in the try block itself. If an exception
occurs between line 161 and line 163, the original WAL directories won't be
restored. Consider moving line 161 inside the try block or adding another
try-finally wrapper to ensure the original configuration is always restored.
```suggestion
try {
commonConfig.setWalDirs(testWalDirs);
```
--
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]