You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@iotdb.apache.org by ha...@apache.org on 2021/01/20 15:09:59 UTC
[iotdb] branch master updated: Fix tsfile version controller (#2529)
This is an automated email from the ASF dual-hosted git repository.
haonan 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 2a68ebf Fix tsfile version controller (#2529)
2a68ebf is described below
commit 2a68ebf3af551a513783965e9b64e9dd5518e6a2
Author: SilverNarcissus <15...@smail.nju.edu.cn>
AuthorDate: Wed Jan 20 23:09:39 2021 +0800
Fix tsfile version controller (#2529)
---
.../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;
}