You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@iotdb.apache.org by xu...@apache.org on 2021/01/20 14:00:35 UTC
[iotdb] 01/01: fix bug
This is an automated email from the ASF dual-hosted git repository.
xuekaifeng pushed a commit to branch fix-tsfile-version-controller
in repository https://gitbox.apache.org/repos/asf/iotdb.git
commit 86d927a974046716894c8291187478f7d7f3094d
Author: 151250176 <15...@smail.nju.edu.cn>
AuthorDate: Wed Jan 20 21:59:39 2021 +0800
fix bug
---
.../db/engine/storagegroup/StorageGroupProcessor.java | 19 +++++++++++++++++++
1 file changed, 19 insertions(+)
diff --git a/server/src/main/java/org/apache/iotdb/db/engine/storagegroup/StorageGroupProcessor.java b/server/src/main/java/org/apache/iotdb/db/engine/storagegroup/StorageGroupProcessor.java
index 3652709..a1ff15d 100755
--- a/server/src/main/java/org/apache/iotdb/db/engine/storagegroup/StorageGroupProcessor.java
+++ b/server/src/main/java/org/apache/iotdb/db/engine/storagegroup/StorageGroupProcessor.java
@@ -444,6 +444,14 @@ public class StorageGroupProcessor {
mergingMods.delete();
}
recoverCompaction();
+ for (TsFileResource resource : tsFileManagement.getTsFileList(true)) {
+ long partitionNum = resource.getTimePartition();
+ updatePartitionFileVersion(partitionNum, resource.getVersion());
+ }
+ for (TsFileResource resource : tsFileManagement.getTsFileList(false)) {
+ long partitionNum = resource.getTimePartition();
+ updatePartitionFileVersion(partitionNum, resource.getVersion());
+ }
updateLatestFlushedTime();
} catch (IOException | MetadataException e) {
throw new StorageGroupProcessorException(e);
@@ -484,6 +492,13 @@ public class StorageGroupProcessor {
}
}
+ private void updatePartitionFileVersion(long partitionNum, long fileVersion) {
+ long oldVersion = partitionMaxFileVersions.getOrDefault(partitionNum, 0L);
+ if (fileVersion > oldVersion) {
+ partitionMaxFileVersions.put(partitionNum, fileVersion);
+ }
+ }
+
/**
* use old seq file to update latestTimeForEachDevice, globalLatestFlushedTimeForEachDevice,
* partitionLatestFlushedTimeForEachDevice and timePartitionIdVersionControllerMap
@@ -1958,6 +1973,8 @@ public class StorageGroupProcessor {
// update latest time map
updateLatestTimeMap(newTsFileResource);
+ long partitionNum = newTsFileResource.getTimePartition();
+ updatePartitionFileVersion(partitionNum, newTsFileResource.getVersion());
} catch (DiskSpaceInsufficientException e) {
logger.error(
"Failed to append the tsfile {} to storage group processor {} because the disk space is insufficient.",
@@ -2311,6 +2328,8 @@ public class StorageGroupProcessor {
syncedResourceFile.getAbsolutePath(), targetResourceFile.getAbsolutePath(),
e.getMessage()));
}
+
+ updatePartitionFileVersion(filePartitionId, tsFileResource.getVersion());
return true;
}