You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@iotdb.apache.org by xi...@apache.org on 2023/08/08 17:17:47 UTC
[iotdb] branch rel/1.1 updated: [To rel/1.1] Fix compaction log keyword bug (#10787)
This is an automated email from the ASF dual-hosted git repository.
xingtanzjr pushed a commit to branch rel/1.1
in repository https://gitbox.apache.org/repos/asf/iotdb.git
The following commit(s) were added to refs/heads/rel/1.1 by this push:
new b442fa8f30f [To rel/1.1] Fix compaction log keyword bug (#10787)
b442fa8f30f is described below
commit b442fa8f30f9ddaba7226a4e70910a9b7e05fef5
Author: shuwenwei <55...@users.noreply.github.com>
AuthorDate: Wed Aug 9 01:17:41 2023 +0800
[To rel/1.1] Fix compaction log keyword bug (#10787)
---
.../execute/utils/log/CompactionLogAnalyzer.java | 16 +++++++++-------
1 file changed, 9 insertions(+), 7 deletions(-)
diff --git a/server/src/main/java/org/apache/iotdb/db/engine/compaction/execute/utils/log/CompactionLogAnalyzer.java b/server/src/main/java/org/apache/iotdb/db/engine/compaction/execute/utils/log/CompactionLogAnalyzer.java
index 6c05a78ad06..9dca57f0331 100644
--- a/server/src/main/java/org/apache/iotdb/db/engine/compaction/execute/utils/log/CompactionLogAnalyzer.java
+++ b/server/src/main/java/org/apache/iotdb/db/engine/compaction/execute/utils/log/CompactionLogAnalyzer.java
@@ -58,14 +58,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));
}
}
@@ -132,12 +132,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 {