[Feature request] Notify when a new OFFLINE segment is query-able
- Dominant language
- Java
- Stars
- 6.1k
- Forks
- 1.5k
- Avg merge
- 2d 3h
- Merged PRs (30d)
- 195
Description
Following Slack discussion: https://apache-pinot.slack.com/archives/C011C9JHN7R/p1649059683439889
### Summary
In some cases, there is a need to know when / if a new OFFLINE segment is ready for query.
**For example:**
1. A new segment is pushed to Pinot's controller via a `SegmentCreationAndTarPush` Job.
2. The job ends as soon as this segment is copied over to the Controller (as far as I know).
3. Some services may be interested in the fact that new data is available (e.g. to update some materialized view), we can notify them using a pub/sub system for exemple.
4. Those services come ask for this updated data.
5. As long as Pinot's servers are not done downloading the new segment from the deep store, they serve "stale" data.
=> The root issue comes from the fact that the business-level notify message is tied to the end of the `SegmentCreationAndTarPush` Job and not the true availability of new data in Pinot.
### Proposition
1. Implement a callback mechanism into Pinot which will be called as soon as data is ready for query _(By @snleee)_
- Could be a generic Java function callback
- Could be a message being sent on a pub/sub system
- Could be a call to some external REST API
2. Implement a `waitForDataAvailability` option (poor name) from within Pinot's Push Jobs.
3. Other?
### Current workarounds
1. Wait for a fixed time: Brittle solution
2. Wait for IS == EV _(By @mayankshriv)_
3. Poll segment status (given that its name is known)
4. Other?
Contributor guide
Research direction
Begin with the SegmentCreationAndTarPush job and the Push Jobs named in the issue, then trace when Pinot servers finish downloading a segment and can query it. The issue proposes several callback, pub/sub, REST, and waiting options, so first establish the intended design and its availability semantics before implementation; done requires an agreed notification mechanism that reflects true query availability.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- databases, distributed-systems
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100