This is an automated email from the ASF dual-hosted git repository.
xingtanzjr pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/iotdb.git
The following commit(s) were added to refs/heads/master by this push:
new 685bfa983c2 Fix compaction log keyword bug (#10785)
685bfa983c2 is described below
commit 685bfa983c223d99a258e78bd1b2ebe72bc32c95
Author: shuwenwei <[email protected]>
AuthorDate: Tue Aug 8 20:02:52 2023 +0800
Fix compaction log keyword bug (#10785)
---
.../execute/utils/log/CompactionLogAnalyzer.java | 16 +++++++++-------
1 file changed, 9 insertions(+), 7 deletions(-)
diff --git
a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/storageengine/dataregion/compaction/execute/utils/log/CompactionLogAnalyzer.java
b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/storageengine/dataregion/compaction/execute/utils/log/CompactionLogAnalyzer.java
index a0322cf3b7c..61edea2d225 100644
---
a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/storageengine/dataregion/compaction/execute/utils/log/CompactionLogAnalyzer.java
+++
b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/storageengine/dataregion/compaction/execute/utils/log/CompactionLogAnalyzer.java
@@ -63,14 +63,14 @@ public class CompactionLogAnalyzer {
while ((currLine = bufferedReader.readLine()) != null) {
String fileInfo;
if (currLine.startsWith(STR_SOURCE_FILES)) {
- fileInfo = currLine.replace(STR_SOURCE_FILES +
TsFileIdentifier.INFO_SEPARATOR, "");
+ fileInfo = currLine.replaceFirst(STR_SOURCE_FILES +
TsFileIdentifier.INFO_SEPARATOR, "");
sourceFileInfos.add(TsFileIdentifier.getFileIdentifierFromInfoString(fileInfo));
} else if (currLine.startsWith(STR_TARGET_FILES)) {
- fileInfo = currLine.replace(STR_TARGET_FILES +
TsFileIdentifier.INFO_SEPARATOR, "");
+ fileInfo = currLine.replaceFirst(STR_TARGET_FILES +
TsFileIdentifier.INFO_SEPARATOR, "");
targetFileInfos.add(TsFileIdentifier.getFileIdentifierFromInfoString(fileInfo));
} else {
fileInfo =
- currLine.replace(STR_DELETED_TARGET_FILES +
TsFileIdentifier.INFO_SEPARATOR, "");
+ currLine.replaceFirst(STR_DELETED_TARGET_FILES +
TsFileIdentifier.INFO_SEPARATOR, "");
deletedTargetFileInfos.add(TsFileIdentifier.getFileIdentifierFromInfoString(fileInfo));
}
}
@@ -146,12 +146,14 @@ public class CompactionLogAnalyzer {
} else {
sourceFileInfos.add(TsFileIdentifier.getFileIdentifierFromFilePath(oldFilePath));
}
+
+ int pos = oldFilePath.lastIndexOf(TsFileConstant.TSFILE_SUFFIX);
if (isSeqSource) {
String targetFilePath =
- oldFilePath.replace(
- TsFileConstant.TSFILE_SUFFIX,
- TsFileConstant.TSFILE_SUFFIX
- + IoTDBConstant.CROSS_COMPACTION_TMP_FILE_SUFFIX_FROM_OLD);
+ oldFilePath.substring(0, pos)
+ + TsFileConstant.TSFILE_SUFFIX
+ + IoTDBConstant.CROSS_COMPACTION_TMP_FILE_SUFFIX_FROM_OLD
+ + oldFilePath.substring(pos +
TsFileConstant.TSFILE_SUFFIX.length());
if (oldFilePath.startsWith("root")) {
targetFileInfos.add(TsFileIdentifier.getFileIdentifierFromOldInfoString(targetFilePath));
} else {