Skip to content
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

Fix insert/load with timestamp of Long.MIN_VALUE and LONG.MAX_VALUE #14491

Open
wants to merge 11 commits into
base: master
Choose a base branch
from

Conversation

jt2594838
Copy link
Contributor

No description provided.

# Conflicts:
#	iotdb-core/datanode/src/main/java/org/apache/iotdb/db/conf/IoTDBDescriptor.java
@SteveYurongSu SteveYurongSu self-assigned this Dec 19, 2024
Copy link

codecov bot commented Dec 19, 2024

Codecov Report

Attention: Patch coverage is 75.78947% with 46 lines in your changes missing coverage. Please review.

Project coverage is 39.42%. Comparing base (55b37e0) to head (7916e79).
Report is 31 commits behind head on master.

Files with missing lines Patch % Lines
...a/org/apache/iotdb/db/utils/ModificationUtils.java 0.00% 7 Missing ⚠️
...te/utils/writer/AbstractCrossCompactionWriter.java 16.66% 5 Missing ⚠️
...orageengine/load/splitter/NonAlignedChunkData.java 0.00% 4 Missing ⚠️
...g/apache/iotdb/db/tools/TsFileResourcePrinter.java 0.00% 4 Missing ⚠️
...e/iotdb/db/queryengine/plan/parser/ASTVisitor.java 0.00% 3 Missing ⚠️
...tor/readchunk/AlignedSeriesCompactionExecutor.java 0.00% 3 Missing ⚠️
...n/planner/plan/node/load/LoadSingleTsFileNode.java 0.00% 2 Missing ⚠️
...gion/compaction/repair/RepairDataFileScanUtil.java 90.00% 2 Missing ⚠️
...region/utils/TsFileDeviceStartEndTimeIterator.java 0.00% 2 Missing ⚠️
...l/recover/file/UnsealedTsFileRecoverPerformer.java 50.00% 2 Missing ⚠️
... and 9 more
Additional details and impacted files
@@             Coverage Diff              @@
##             master   #14491      +/-   ##
============================================
- Coverage     39.60%   39.42%   -0.19%     
  Complexity      185      185              
============================================
  Files          4334     4341       +7     
  Lines        275866   275427     -439     
  Branches      33533    33647     +114     
============================================
- Hits         109267   108580     -687     
- Misses       166599   166847     +248     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@@ -336,7 +344,7 @@ public void insertByObjAndNotInferTypeTest() {
expected.add(TSDataType.TEXT.name());

Set<String> actual = new HashSet<>();
SessionDataSet dataSet = session.executeQueryStatement("show timeseries root.**");
SessionDataSet dataSet = session.executeQueryStatement("show timeseries root.sg1.**");
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 avoids conflicts with other tests.

Copy link
Contributor Author

@jt2594838 jt2594838 left a comment

Choose a reason for hiding this comment

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

Self-reviewed

Copy link
Collaborator

Choose a reason for hiding this comment

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

The previousTime also needs to be modified. This value is used in checkPreviousTimeAndUpdate to check the order of timestamps. Perhaps we can add a boolean to determine whether to set initial values.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed

@shuwenwei
Copy link
Collaborator

These classes also need to be modified:

  • iotdb-core/datanode/src/main/java/org/apache/iotdb/db/storageengine/dataregion/compaction/execute/utils/executor/readchunk/AlignedSeriesCompactionExecutor.java
  • iotdb-core/datanode/src/main/java/org/apache/iotdb/db/storageengine/dataregion/compaction/execute/utils/executor/readchunk/ReadChunkAlignedSeriesCompactionExecutor.java
  • iotdb-core/datanode/src/main/java/org/apache/iotdb/db/storageengine/dataregion/compaction/execute/utils/writer/AbstractCompactionWriter.java

@jt2594838 jt2594838 requested a review from shuwenwei December 21, 2024 06:48
@@ -158,8 +161,10 @@ public void execute() throws IOException {
flushChunkWriter();
}
fileWriter.checkMetadataSizeAndMayFlush();
targetResource.updateStartTime(device, minStartTimestamp);
targetResource.updateEndTime(device, maxEndTimestamp);
if (minStartTimestampSet) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Can use minStartTimestamp <= minEndTimestamp to instead these booleans?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

You mean still let the initial value of minStartTimestamp be Long.MAX and maxEndTimestamp be Long.MIN?
It is possible, but I think it may be more important not to leave the impression that Long.MAX and Long.MIN are treated as special timestamps and keep the consistency with other places.

@@ -140,8 +142,12 @@ protected int calculatingMaxOverlapFileNumInSubCompactionTask(List<TsFileResourc
long maxEndTimeOfCurrentDevice = Long.MIN_VALUE;
int overlapFileNumOfCurrentDevice = 0;
for (ArrayDeviceTimeIndex resource : resourcesContainsCurrentDevice) {
long deviceStartTimeInCurrentFile = resource.getStartTime(device);
long deviceEndTimeInCurrentFile = resource.getEndTime(device);
if (resource.definitelyNotContains(device)) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

This check should have been done in line135

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Removed

Copy link

Quality Gate Failed Quality Gate failed

Failed conditions
E Reliability Rating on New Code (required ≥ A)

See analysis details on SonarQube Cloud

Catch issues before they fail your Quality Gate with our IDE extension SonarQube for IDE

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.

3 participants