[Umbrella] Support bulk loading for primary-key tables
Search before asking
- [x] I searched in the issues and found nothing similar.
Motivation
Fluss currently lacks an efficient way to load a large initial dataset or backfill a primary-key table. Writing records through the ordinary online write path is expensive for bounded batch workloads.
This capability is also a foundation for promoting lake-resident data into Fluss's real-time serving path. Typical use cases include upgrading a lake table into a real-time table and promoting a cold lake partition into a real-time partition, without replaying the complete dataset through the ordinary online write path.
The target capability should build ordinary KV snapshots outside TabletServers, publish each bucket snapshot through a server-managed transaction, and restore the selected snapshots asynchronously.
Production use also requires scoped temporary write authorization. A workflow that succeeds only when clients have unrestricted storage credentials is not sufficient for production batch insert or lake-to-real-time promotion.
Solution
The protocol is described in FIP-61.
Scope
The initial implementation supports:
- Empty primary-key tables and partitions.
- Offline construction of ordinary Fluss KV snapshots.
- Server-managed Begin, Commit, and Abort transactions.
- Exclusive BulkLoad ownership for overlapping physical targets.
- Independent bucket commits with asynchronous leader recovery. The caller coordinates ordinary writes, and each bucket commit rejects a changed WAL end offset.
- Coordinator failover and assignment changes during transaction processing.
- A public client SDK for building and committing bulk-load files.
- Scoped temporary write authorization for build sessions.
- Flink batch insert as the first engine integration.
Sub Tasks
- [x] #4223
- [x] #4224
- [x] #4225
- [ ] #4226
- [ ] #4227
The tasks are expected to be delivered in the listed order.
Anything else?
Completion criteria
This umbrella issue is complete when:
- An externally built KV snapshot can be validated, adopted, and restored by Fluss.
- The server provides a complete and recoverable Begin/Commit/Abort lifecycle.
- The client SDK exposes the complete bulk-load workflow.
- Build sessions can obtain scoped temporary write authorization without serializing credentials into build contexts or engine checkpoints.
- Flink batch insert can load an empty primary-key table or partition using the bucket commit and asynchronous recovery contract.
- Failure, abort, Coordinator failover, TabletServer restart, and assignment change paths have appropriate regression coverage.
- Compatibility behavior and user documentation are complete.
Non-goals
- Streaming bulk load.
- Loading into a non-empty target.
- Non-primary-key tables.
- Atomic visibility or transaction isolation across buckets or physical targets.
- Spark integration.
- A complete general-purpose authentication or authorization system.
Willingness to contribute
- [x] I'm willing to submit a PR!
@platinumhamburg great proposal! this is a very valuable feature, and there is strong demand for it in many production scenarios.
+1, this would solve a real problem. Happy to help test this! 🙏