|
25 | 25 | import org.apache.iotdb.db.queryengine.plan.planner.plan.node.PlanNodeId; |
26 | 26 | import org.apache.iotdb.db.queryengine.plan.planner.plan.node.write.InsertRowNode; |
27 | 27 | import org.apache.iotdb.db.storageengine.dataregion.wal.node.IWALNode; |
28 | | -import org.apache.iotdb.db.storageengine.dataregion.wal.node.WALFakeNode; |
29 | 28 | import org.apache.iotdb.db.storageengine.dataregion.wal.node.WALNode; |
30 | 29 | import org.apache.iotdb.db.storageengine.dataregion.wal.utils.WALFileUtils; |
31 | 30 | import org.apache.iotdb.db.utils.EnvironmentUtils; |
|
47 | 46 | import static org.junit.Assert.assertEquals; |
48 | 47 | import static org.junit.Assert.assertNotEquals; |
49 | 48 | import static org.junit.Assert.assertNotNull; |
50 | | -import static org.junit.Assert.assertNull; |
51 | 49 | import static org.junit.Assert.assertTrue; |
52 | 50 |
|
53 | 51 | public class FirstCreateStrategyTest { |
@@ -224,60 +222,6 @@ public void testReInitializeAfterDiskSpaceCleaned() throws IllegalPathException, |
224 | 222 | } |
225 | 223 | } |
226 | 224 |
|
227 | | - @Test |
228 | | - public void testReInitializeFailsWhenDiskStillFull() throws IllegalPathException, IOException { |
229 | | - // Create unique temporary directory for testing |
230 | | - Path tempDir = Files.createTempDirectory("iotdb_wal_reinit_fail_test_"); |
231 | | - |
232 | | - // Use non-existent directories that will cause re-initialization to fail |
233 | | - String[] nonExistentWalDirs = |
234 | | - new String[] { |
235 | | - tempDir.resolve("non_existent_dir1").toString(), |
236 | | - tempDir.resolve("non_existent_dir2").toString(), |
237 | | - tempDir.resolve("non_existent_dir3").toString() |
238 | | - }; |
239 | | - |
240 | | - String[] originalWalDirs = commonConfig.getWalDirs(); |
241 | | - commonConfig.setWalDirs(nonExistentWalDirs); |
242 | | - |
243 | | - try { |
244 | | - // Create strategy - this will fail to initialize folderManager |
245 | | - FirstCreateStrategy strategy = new FirstCreateStrategy(); |
246 | | - |
247 | | - // Verify that folderManager is null due to initialization failure |
248 | | - try { |
249 | | - java.lang.reflect.Field folderManagerField = |
250 | | - AbstractNodeAllocationStrategy.class.getDeclaredField("folderManager"); |
251 | | - folderManagerField.setAccessible(true); |
252 | | - Object folderManager = folderManagerField.get(strategy); |
253 | | - assertNull("folderManager should be null due to initialization failure", folderManager); |
254 | | - } catch (NoSuchFieldException | IllegalAccessException e) { |
255 | | - throw new RuntimeException("Failed to access folderManager field", e); |
256 | | - } |
257 | | - |
258 | | - // Now apply for WAL node - re-initialization should also fail and return WALFakeNode |
259 | | - IWALNode walNode = strategy.applyForWALNode("test_reinit_fail_identifier"); |
260 | | - |
261 | | - // Verify that WALFakeNode is returned when re-initialization fails |
262 | | - assertNotNull("WAL node should be returned even when re-initialization fails", walNode); |
263 | | - assertTrue( |
264 | | - "Should return WALFakeNode when re-initialization fails", walNode instanceof WALFakeNode); |
265 | | - |
266 | | - // WALFakeNode should be the failure instance |
267 | | - WALFakeNode fakeNode = (WALFakeNode) walNode; |
268 | | - assertTrue( |
269 | | - "WALFakeNode should contain failure information", |
270 | | - fakeNode.toString().contains("DiskSpaceInsufficientException") |
271 | | - || fakeNode.toString().contains("Failed to create WAL node")); |
272 | | - |
273 | | - } finally { |
274 | | - // Clean up temp directory |
275 | | - EnvironmentUtils.cleanDir(tempDir.toString()); |
276 | | - // Restore original WAL directories |
277 | | - commonConfig.setWalDirs(originalWalDirs); |
278 | | - } |
279 | | - } |
280 | | - |
281 | 225 | private InsertRowNode getInsertRowNode() throws IllegalPathException { |
282 | 226 | long time = 110L; |
283 | 227 | TSDataType[] dataTypes = |
|
0 commit comments