THUMarkLau commented on code in PR #12476:
URL: https://github.com/apache/iotdb/pull/12476#discussion_r1632199051


##########
iotdb-core/datanode/src/main/java/org/apache/iotdb/db/storageengine/dataregion/wal/io/WALMetaData.java:
##########
@@ -153,10 +157,20 @@ public static WALMetaData readFromWALFile(File logFile, 
FileChannel channel) thr
     return metaData;
   }
 
-  private static String readTailMagic(FileChannel channel) throws IOException {
+  private static boolean isValidMagicString(FileChannel channel) throws 
IOException {
     ByteBuffer magicStringBytes = 
ByteBuffer.allocate(WALWriter.MAGIC_STRING_BYTES);
     channel.read(magicStringBytes, channel.size() - 
WALWriter.MAGIC_STRING_BYTES);
     magicStringBytes.flip();
-    return new String(magicStringBytes.array());
+    String magicString = new String(magicStringBytes.array());
+    return magicString.equals(WALWriter.MAGIC_STRING)
+        || magicString.startsWith(WALWriter.MAGIC_STRING_V1);

Review Comment:
   I replace it with `contains`.



-- 
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]

Reply via email to