-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Add a new API to fix segment date time in metadata #9413
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
8957120 to
8b1088e
Compare
pinot-controller/src/main/java/org/apache/pinot/controller/helix/core/util/ZKMetadataUtils.java
Outdated
Show resolved
Hide resolved
c6a638f to
3db9e6c
Compare
...in/java/org/apache/pinot/segment/local/segment/creator/impl/SegmentColumnarIndexCreator.java
Outdated
Show resolved
Hide resolved
...in/java/org/apache/pinot/segment/local/segment/creator/impl/SegmentColumnarIndexCreator.java
Outdated
Show resolved
Hide resolved
pinot-segment-spi/src/main/java/org/apache/pinot/segment/spi/SegmentMetadata.java
Outdated
Show resolved
Hide resolved
pinot-controller/src/main/java/org/apache/pinot/controller/helix/core/util/ZKMetadataUtils.java
Outdated
Show resolved
Hide resolved
...ntroller/src/main/java/org/apache/pinot/controller/helix/core/PinotHelixResourceManager.java
Outdated
Show resolved
Hide resolved
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.
Throw exception when table config is not available
...ntroller/src/main/java/org/apache/pinot/controller/helix/core/PinotHelixResourceManager.java
Outdated
Show resolved
Hide resolved
...ller/src/main/java/org/apache/pinot/controller/api/resources/PinotSchemaRestletResource.java
Outdated
Show resolved
Hide resolved
...ller/src/main/java/org/apache/pinot/controller/api/resources/PinotSchemaRestletResource.java
Outdated
Show resolved
Hide resolved
3db9e6c to
466395b
Compare
Codecov Report
@@ Coverage Diff @@
## master #9413 +/- ##
=============================================
- Coverage 69.83% 35.25% -34.59%
+ Complexity 4718 189 -4529
=============================================
Files 1902 1915 +13
Lines 101521 102049 +528
Branches 15411 15479 +68
=============================================
- Hits 70899 35973 -34926
- Misses 25623 63022 +37399
+ Partials 4999 3054 -1945
Flags with carried forward coverage won't be shown. Click here to find out more.
📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more |
ed749e4 to
9650f8e
Compare
9650f8e to
99ef712
Compare
...ler/src/main/java/org/apache/pinot/controller/api/resources/PinotSegmentRestletResource.java
Outdated
Show resolved
Hide resolved
...gment-spi/src/main/java/org/apache/pinot/segment/spi/index/metadata/SegmentMetadataImpl.java
Outdated
Show resolved
Hide resolved
...in/java/org/apache/pinot/segment/local/segment/creator/impl/SegmentColumnarIndexCreator.java
Outdated
Show resolved
Hide resolved
...ler/src/main/java/org/apache/pinot/controller/api/resources/PinotSegmentRestletResource.java
Outdated
Show resolved
Hide resolved
...ntroller/src/main/java/org/apache/pinot/controller/helix/core/PinotHelixResourceManager.java
Outdated
Show resolved
Hide resolved
...ntroller/src/main/java/org/apache/pinot/controller/helix/core/PinotHelixResourceManager.java
Outdated
Show resolved
Hide resolved
pinot-controller/src/main/java/org/apache/pinot/controller/helix/core/util/ZKMetadataUtils.java
Outdated
Show resolved
Hide resolved
pinot-controller/src/main/java/org/apache/pinot/controller/helix/core/util/ZKMetadataUtils.java
Outdated
Show resolved
Hide resolved
| if (segmentMetadata.getTimeInterval() != null) { | ||
| segmentZKMetadata.setStartTime(segmentMetadata.getStartTime()); | ||
| segmentZKMetadata.setEndTime(segmentMetadata.getEndTime()); | ||
| segmentZKMetadata.setTimeUnit(segmentMetadata.getTimeUnit()); |
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 can change this to always put MILLISECONDS as the time unit (convert start/end time using the time unit), then we no longer need to worry about time unit when updating the time interval
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.
One reason why I'm suggesting this is that there is one corner case: if the original date time format is in SECONDS, then changed to MILLISECONDS, if we keep the time unit as the old one, we might lose precision
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.
Makes sense. Closing the PR #9472. I haven't removed the logic to convert timestamp using timeUnit since I am not sure about backward compatibility
b4b9d7a to
440f6d3
Compare
440f6d3 to
f9e5bb1
Compare
...ler/src/main/java/org/apache/pinot/controller/api/resources/PinotSegmentRestletResource.java
Outdated
Show resolved
Hide resolved
9020520 to
965d857
Compare
| segmentZKMetadata.setStartTime(segmentMetadata.getStartTime()); | ||
| segmentZKMetadata.setEndTime(segmentMetadata.getEndTime()); | ||
| segmentZKMetadata.setTimeUnit(segmentMetadata.getTimeUnit()); | ||
| long startTimeMs = TimeUnit.MILLISECONDS.convert(segmentMetadata.getStartTime(), segmentMetadata.getTimeUnit()); |
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.
(minor) start/end time can be easily read from the time interval without converting again
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.
952d495 to
cf42232
Compare
Jackie-Jiang
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.
LGTM otherwise
...ler/src/main/java/org/apache/pinot/controller/api/resources/PinotSegmentRestletResource.java
Outdated
Show resolved
Hide resolved
...ler/src/main/java/org/apache/pinot/controller/api/resources/PinotSegmentRestletResource.java
Outdated
Show resolved
Hide resolved
...ler/src/main/java/org/apache/pinot/controller/api/resources/PinotSegmentRestletResource.java
Outdated
Show resolved
Hide resolved
...ler/src/main/java/org/apache/pinot/controller/api/resources/PinotSegmentRestletResource.java
Outdated
Show resolved
Hide resolved
...ntroller/src/main/java/org/apache/pinot/controller/helix/core/PinotHelixResourceManager.java
Outdated
Show resolved
Hide resolved
...ntroller/src/main/java/org/apache/pinot/controller/helix/core/PinotHelixResourceManager.java
Outdated
Show resolved
Hide resolved
...ntroller/src/main/java/org/apache/pinot/controller/helix/core/PinotHelixResourceManager.java
Outdated
Show resolved
Hide resolved
...ler/src/main/java/org/apache/pinot/controller/api/resources/PinotSegmentRestletResource.java
Outdated
Show resolved
Hide resolved
90adbff to
4d335f5
Compare
e56cf26 to
5427fa8
Compare
* Add API to handle change in timestamp format * Fix linting * Add support for storing raw segment start and end time in metadata * Do not store start end time in segment metadata seperately * remove refresh flag * Store new start/end time with proper time unit * Move the API to segment resource * Fix test failure * Add test * Cleanup: Remove duplicate methods * Store start/end time in milliseconds in zookeeper * Refactor: change method names and reduce scope of exceptions * Remove redundant timeunit conversion * Throw user errors and check for time column * Fix Segment tests Co-authored-by: Kartik Khare <[email protected]>
Currently, if an user specifies an incorrect datetime format accidentally, we don't allow any way to fix the segment start and end time in zookeeper metadata.
This creates problem when the end times lie before the retention interval in which case those segments get removed. It also creates problem in case of time pruning during queries.
The PR aims to introduce a new API to address this issue. It is still Work in progress.