feat: add collection-level table format (MS1) - #451
Conversation
Implement Iceberg-inspired collection-level table format library with manifest lists, versioned metadata, schema/index evolution, snapshot rollback, and OCC transaction commit. - types.h/types_codec.h: POD structs + Avro codec_traits - layout.h/cpp: path conventions, version discovery - manifest_list.h/cpp: ManifestList with shared filesystem I/O - metadata.h/cpp: Metadata with monotonic snapshot ID counter - action.h/cpp: ActionBuilder for atomic mutations - collection_transaction.h/cpp: OCC read/commit with retry - 7 test files covering 29 table_format tests Signed-off-by: Ted Xu <ted.xu@zilliz.com>
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: tedxu The full list of commands accepted by this bot can be found here. The pull request process is described here DetailsNeeds approval from an approver in each of these files:
Approvers can indicate their approval by writing |
Implementation ReferenceCollection-level table format on top of existing segment manifests. Enables segment enumeration, schema evolution, time travel, and snapshot rollback without etcd. Tech: C++17, Apache Avro (DataFile API), Apache Arrow (filesystem + Status/Result), Google Test. Namespace: File LayoutArchitectureNo separate Key Design DecisionsIceberg-inspired patterns:
Divergences from original plan:
Mutation via Action/ActionBuilderAll metadata changes go through auto action = ActionBuilder::Create(fs, base_path)
.SetCollectionInfo({...})
.SetSchema(schema)
.AddSegment("_default", {.segment_id = 1001, .manifest = "..."})
.AddColumn(new_field)
.AddIndex(idx)
.Build();
txn->Commit(action);Supported operations: Mutual exclusivity enforced: rollback by ID and by timestamp cannot coexist in one action. Internal structure: Commit ProtocolSerializationAll serialization uses Avro DataFile API ( On-Disk LayoutTest Coverage (66 tests total, 0 failures)
|
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #451 +/- ##
==========================================
+ Coverage 75.88% 76.87% +0.98%
==========================================
Files 108 117 +9
Lines 9450 10256 +806
Branches 1316 1429 +113
==========================================
+ Hits 7171 7884 +713
- Misses 2279 2372 +93
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
| } | ||
|
|
||
| std::string GenerateUniqueId() { | ||
| static std::mt19937_64 rng(std::random_device{}()); |
There was a problem hiding this comment.
this seems not thread safe
| return *this; | ||
| } | ||
|
|
||
| ActionBuilder& ActionBuilder::AddSegment(const std::string& partition_name, SegmentInfo segment) { |
There was a problem hiding this comment.
should we add deduplication by segment id? in case both transactions want to add the same segment
| return fmt::format("{:016x}", rng()); | ||
| } | ||
|
|
||
| arrow::Result<int64_t> GetLatestMetadataVersion(const milvus_storage::ArrowFileSystemPtr& fs, |
There was a problem hiding this comment.
should we write a version hint file into object storage to avoid LIST operations? The sync operations from Milvus have commit actions frequently
|
/hold |
Implement Iceberg-inspired collection-level table format library
with manifest lists, versioned metadata, schema/index evolution,
snapshot rollback, and OCC transaction commit.
New files under cpp/{include,src,test}/table_format/:
Test plan:
ID, and rollback by timestamp