GitHub user danny0405 edited a discussion: [DISCUSS] A Hudi service node for 
live queries before streaming writes commit

An agent span reports a tool failure while a streaming writer is building its 
next Hudi commit. The operator debugging the trace wants to see that failure 
now. A snapshot reader can see it once the corresponding Hudi instant 
completes. Even a fast point lookup can spend most of its end-to-end latency 
waiting for publication. This gap arises with Flink streaming jobs, Spark 
Structured Streaming micro-batches, and custom ingestion services that publish 
Hudi commits periodically. Committing more often can reduce the wait, at the 
cost of more commit work and potentially smaller files. [Hudi 
timeline](https://hudi.apache.org/docs/timeline/)

Could we introduce an **optional Hudi service node that makes streaming writes 
queryable as soon as they are durable, before the next Hudi commit completes**? 
Two workloads motivate this. A trace UI needs to load a run and find recent 
failures as spans start, finish, and receive corrections. An agent or retrieval 
pipeline needs to find a document it just ingested by key, text, or embedding 
while historical data remains searchable. SmithDB shows how a query service can 
read fresh segments from ingestion-node caches. LanceDB goes further by keeping 
live indexes on shard owners and acknowledging writes after they reach a 
durable log. [SmithDB 
architecture](https://www.langchain.com/blog/introducing-smithdb) · [LanceDB 
Realtime Engine](https://www.lancedb.com/blog/lancedb-real-time-engine) · 
[Lance MemWAL spec](https://lance.org/format/table/mem_wal/)

### One possible design

- **Write once to a durable log.** A streaming producer publishes the mutations 
destined for Hudi to a partitioned log. Each mutation has a stable position 
within its shard. If an existing stream already contains those mutations and 
supports replay, it could serve as the log. A long-running service node 
consumes them and maintains a live index for its assigned shards. A Hudi writer 
consumes the same mutations into a Merge-on-Read table. Applications query the 
service through a stable endpoint, including while producers or writers restart 
or rescale.
- **Read one snapshot plus the newer mutations.** Suppose a completed Hudi 
instant covers one shard through offset 100 and the service has indexed through 
108. For a live lookup, the service applies 101–108 to that snapshot using the 
table’s merge and delete semantics. If the next instant covers through 105, the 
live portion starts at 106. The writer would publish the offsets it covered in 
the same Hudi commit as the data. Conventional snapshot readers would continue 
to use completed instants.
- **Make freshness visible to callers.** A live response could identify its 
base instant and the positions it has served for each shard. This makes the 
distinction between a durable append, a mutation visible to the service, and a 
completed Hudi commit observable. How much of that detail a caller needs is an 
open question.

### What would make this worth running?

I’d start with a keyed span lookup and a query for the 50 most recent failed 
spans in one project. Replay late updates and deletes, kill a service node, and 
restart a writer after it has written data but before it publishes the commit. 
Run the same recovery test with two different ingestion engines. Compare 
against ordinary snapshot reads at the usual commit cadence and with more 
frequent commits. Measure p50/p95/p99 **from event arrival to the first correct 
result**, query latency under concurrent ingest, and CPU usage, object-store 
requests, and commit overhead at the same write rate. Once the Hudi writer 
catches up, the service and snapshot reader should agree on the same mutations. 
This would give us a baseline for extending live reads to text and vector 
search. [Full-text proposal](https://github.com/apache/hudi/pull/20478) · 
[Vector index tracking issue](https://github.com/apache/hudi/issues/19094)

I’d especially like feedback on three questions before turning this into an RFC.

1. Which streaming ingestion path do you use, and which workload needs to see a 
mutation before its Hudi commit completes? What latency does it need, and is a 
per-key or per-shard guarantee sufficient?
2. If an agent acts on a live result and the producer or Hudi writer later 
replays a batch, what must remain visible? How should a producer identify 
retried mutations, especially when a stateful transformation sits upstream?
3. Would you run this over an existing durable stream of output mutations, or 
does the use case justify Hudi owning the log and shard recovery? The existing 
Spark serving endpoint discussion is a natural place to consider how clients 
could access either design. [Related serving 
discussion](https://github.com/apache/hudi/discussions/19843)


GitHub link: https://github.com/apache/hudi/discussions/21013

----
This is an automatically sent email for [email protected].
To unsubscribe, please send an email to: [email protected]

Reply via email to