jt2594838 commented on code in PR #13162:
URL: https://github.com/apache/iotdb/pull/13162#discussion_r1716378905
##########
iotdb-core/datanode/src/test/java/org/apache/iotdb/db/storageengine/dataregion/wal/recover/WALRecoverManagerTest.java:
##########
@@ -351,6 +353,91 @@ private void recoverAndCheck() throws Exception {
// endregion
}
+ @Test
+ public void testRecoverOldWalWithEmptyTsFile() throws Exception {
+ // old version of wal is generated by
prepareCheckpointAndWALFileForSnapshot() in v1.3
+ String oldWalPathStr =
this.getClass().getClassLoader().getResource("oldwal").getFile();
+ File oldWalFileDir = new File(oldWalPathStr);
+ FileUtils.copyDir(oldWalFileDir, new File(WAL_NODE_FOLDER));
+ walBuffer = new WALBuffer(WAL_NODE_IDENTIFIER, WAL_NODE_FOLDER);
+ checkpointManager = walBuffer.getCheckpointManager();
+ WALRecoverManager.getInstance().clear();
+ recoverFromOldWalAndCheck(false);
+ }
+
+ @Test
+ public void testRecoverOldWalWithBrokenTsFile() throws Exception {
+ // old version of wal is generated by
prepareCheckpointAndWALFileForSnapshot() in v1.3
+ String oldWalPathStr =
this.getClass().getClassLoader().getResource("oldwal").getFile();
+ File oldWalFileDir = new File(oldWalPathStr);
+ FileUtils.copyDir(oldWalFileDir, new File(WAL_NODE_FOLDER));
+ walBuffer = new WALBuffer(WAL_NODE_IDENTIFIER, WAL_NODE_FOLDER);
+ checkpointManager = walBuffer.getCheckpointManager();
+ WALRecoverManager.getInstance().clear();
+ recoverFromOldWalAndCheck(true);
+ }
+
+ private void recoverFromOldWalAndCheck(boolean withBrokenTsFile) throws
Exception {
+ // prepare tsFiles
+ List<WALRecoverListener> recoverListeners = new ArrayList<>();
+
+ // prepare file with wal
+ File fileWithWALDir = new File(FILE_WITH_WAL_NAME).getParentFile();
+ Files.createDirectories(fileWithWALDir.toPath());
+ File fileWithWAL = new File(fileWithWALDir, "1723544967972-1-0-0.tsfile");
+ ;
Review Comment:
Redundant colon.
--
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]