-
Notifications
You must be signed in to change notification settings - Fork 1.1k
[IOTDB-4251] Persist ChunkMetadata in TsFileIOWriter ahead of time to save memory #7276
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
…nd corresponding test
|
Coverage decreased (-0.1%) to 40.939% when pulling 97c34e9 on IOTDB-4251 into b71569a on master. |
|
Kudos, SonarCloud Quality Gate passed! |
JackieTien97
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should discuss more about the temp file format, no need to serialize FullPath for each chunkmetadata.
And BTW, I think we should share the same endFile() function. The only difference is how we get ChunkMetadataList, whether from disk or memory or both disk & memory.
...r/src/main/java/org/apache/iotdb/db/engine/compaction/writer/CrossSpaceCompactionWriter.java
Outdated
Show resolved
Hide resolved
...r/src/main/java/org/apache/iotdb/db/engine/compaction/writer/InnerSpaceCompactionWriter.java
Outdated
Show resolved
Hide resolved
tsfile/src/main/java/org/apache/iotdb/tsfile/file/metadata/AlignedChunkMetadata.java
Outdated
Show resolved
Hide resolved
tsfile/src/main/java/org/apache/iotdb/tsfile/file/metadata/ChunkMetadata.java
Outdated
Show resolved
Hide resolved
tsfile/src/main/java/org/apache/iotdb/tsfile/file/metadata/ChunkMetadata.java
Outdated
Show resolved
Hide resolved
tsfile/src/main/java/org/apache/iotdb/tsfile/write/writer/MemoryControlTsFileIOWriter.java
Outdated
Show resolved
Hide resolved
tsfile/src/main/java/org/apache/iotdb/tsfile/write/writer/TsFileIOWriter.java
Outdated
Show resolved
Hide resolved
tsfile/src/main/java/org/apache/iotdb/tsfile/write/writer/MemoryControlTsFileIOWriter.java
Outdated
Show resolved
Hide resolved
tsfile/src/main/java/org/apache/iotdb/tsfile/write/writer/MemoryControlTsFileIOWriter.java
Outdated
Show resolved
Hide resolved
tsfile/src/main/java/org/apache/iotdb/tsfile/write/writer/MemoryControlTsFileIOWriter.java
Outdated
Show resolved
Hide resolved
example/tsfile/src/main/java/org/apache/iotdb/tsfile/TsFileSequenceRead.java
Outdated
Show resolved
Hide resolved
server/src/main/java/org/apache/iotdb/db/engine/storagegroup/TsFileResource.java
Show resolved
Hide resolved
| Map<String, List<TimeseriesMetadata>> deviceTimeseriesMetadataMap = | ||
| tsFileIOWriter.getDeviceTimeseriesMetadataMap(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is no need to read all TimeSeriesMetadata at once here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This method is used when loading tsfile, all the chunk metadata is in the memory, there is no IO overhead to return all the data at once.
| Map<String, List<TimeseriesMetadata>> deviceTimeseriesMetadataMap = new TreeMap<>(); | ||
| Map<String, Map<String, List<IChunkMetadata>>> chunkMetadataMap = new TreeMap<>(); | ||
| for (ChunkGroupMetadata chunkGroupMetadata : chunkGroupMetadataList) { | ||
| for (ChunkMetadata chunkMetadata : chunkGroupMetadata.getChunkMetadataList()) { | ||
| chunkMetadataMap | ||
| .computeIfAbsent(chunkGroupMetadata.getDevice(), x -> new TreeMap<>()) | ||
| .computeIfAbsent(chunkMetadata.getMeasurementUid(), x -> new ArrayList<>()) | ||
| .add(chunkMetadata); | ||
| } | ||
| } | ||
| for (String device : chunkMetadataMap.keySet()) { | ||
| Map<String, List<IChunkMetadata>> seriesToChunkMetadataMap = chunkMetadataMap.get(device); | ||
| for (Map.Entry<String, List<IChunkMetadata>> entry : seriesToChunkMetadataMap.entrySet()) { | ||
| try { | ||
| deviceTimeseriesMetadataMap | ||
| .computeIfAbsent(device, x -> new ArrayList<>()) | ||
| .add(TSMIterator.constructOneTimeseriesMetadata(entry.getKey(), entry.getValue())); | ||
| } catch (IOException e) { | ||
| logger.error("Failed to get device timeseries metadata map", e); | ||
| return null; | ||
| } | ||
| } | ||
| } | ||
|
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It seems that this method only contains chunkmetadata in memory.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As above
tsfile/src/main/java/org/apache/iotdb/tsfile/write/writer/tsmiterator/TSMIterator.java
Outdated
Show resolved
Hide resolved
tsfile/src/main/java/org/apache/iotdb/tsfile/write/writer/tsmiterator/DiskTSMIterator.java
Outdated
Show resolved
Hide resolved
tsfile/src/main/java/org/apache/iotdb/tsfile/write/writer/tsmiterator/DiskTSMIterator.java
Show resolved
Hide resolved
tsfile/src/main/java/org/apache/iotdb/tsfile/write/writer/tsmiterator/TSMIterator.java
Outdated
Show resolved
Hide resolved
tsfile/src/main/java/org/apache/iotdb/tsfile/write/writer/TsFileIOWriter.java
Outdated
Show resolved
Hide resolved
tsfile/src/main/java/org/apache/iotdb/tsfile/write/writer/TsFileIOWriter.java
Outdated
Show resolved
Hide resolved
ab09860 to
5cccdab
Compare








See IOTDB-4251.