feat(realtime): support two-stage scan and read - #199
Conversation
zjw1111
left a comment
There was a problem hiding this comment.
Concurrent consumption of the same real-time split needs to be prevented.
| std::shared_ptr<MemReadView> read_view; | ||
| }; | ||
|
|
||
| class RealtimeContextImpl final : public RealtimeContext { |
There was a problem hiding this comment.
This class is compiled under the repository-wide -fvisibility=hidden, but realtime_context_test.cpp and realtime_write_inte_test.cpp call its out-of-line methods while their executables link against paimon_shared. Those methods are therefore private/hidden in the shared library (for example Cast, GetOrCreateMemIndexer, and ResolveReadView), so the test link will fail with undefined symbols. Please either export the test-used class/symbols, link this implementation into those tests, or exercise it through public APIs.
| RealtimeReader::Create(memory.read_view, std::move(memory_reader))); | ||
| readers.push_back(std::move(realtime_reader)); | ||
| } | ||
| PAIMON_RETURN_NOT_OK(realtime_context_impl->ReleaseReadView(realtime_split->OpaqueTicket())); |
There was a problem hiding this comment.
This consumes the ticket before the public TableRead::CreateReader(vector<Split>) call has succeeded as a whole. With two real-time splits, split 1 can release its ticket here and split 2 can then fail (for example, a plugin error or ticket expiry); the vector overload returns an error, but retrying that failed call now fails on split 1 because its ticket is gone. Please make the ticket claims/consumption rollbackable across the vector overload, or defer consumption until all per-split readers have been created, and add a two-split regression test.
Purpose
Linked issue: #158
This PR extends the real-time append read path introduced in #163 to support separate scan and
reader creation stages.
The main changes are:
RealtimeContext;read-view ticket to
RealtimeSplit;ReadContextto share the sameRealtimeContextused by the writer and scanner;match the split;
RealtimeReaderto keep the memory view alive while disk and memory data are being read;segment destruction on the query thread;
A real-time split ticket is currently single-use. Once reader creation consumes the ticket, retrying
the same reader task requires creating a new scan plan and
RealtimeSplit. Tickets are alsoprocess-local and must be resolved by the
RealtimeContextthat created them.Tests
Added or updated coverage for:
RealtimeSplitticket is reused;API and Format
This PR changes public APIs:
ReadContextBuilder::WithRealtimeContext;RealtimeContext;RealtimeReader, which keeps aMemReadViewalive for the reader lifetime;MemIndexer::CreateQueryReadersto returnRealtimeReaderinstances.There is no change to the Paimon table storage format, data-file format, snapshot format, or commit
protocol.
RealtimeSplitcarries versioned real-time metadata, but cross-process split serialization is notimplemented in this PR. Its opaque ticket is currently resolved only inside the originating process.
Documentation
Generative AI tooling
Generated-by: OpenAI Codex (GPT-5)