Skip to content

Conversation

@THUMarkLau
Copy link
Contributor

See IOTDB-4251.

@coveralls
Copy link

coveralls commented Sep 9, 2022

Coverage Status

Coverage decreased (-0.1%) to 40.939% when pulling 97c34e9 on IOTDB-4251 into b71569a on master.

@sonarqubecloud
Copy link

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 58 Code Smells

91.1% 91.1% Coverage
0.0% 0.0% Duplication

Copy link
Contributor

@JackieTien97 JackieTien97 left a 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.

Comment on lines 495 to 496
Map<String, List<TimeseriesMetadata>> deviceTimeseriesMetadataMap =
tsFileIOWriter.getDeviceTimeseriesMetadataMap();
Copy link
Contributor

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.

Copy link
Contributor Author

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.

Comment on lines +549 to +572
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;
}
}
}

Copy link
Contributor

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.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As above

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants