Repository navigation
Conversation
18bade1 to
7de6949
Compare
5c1ee1f to
dd9c7e6
Compare
dd9c7e6 to
3736bc1
Compare
3736bc1 to
ecc0058
Compare
| /// snapshot and reattempting the commit. | ||
| class ICEBERG_EXPORT RewriteManifests : public SnapshotUpdate { | ||
| public: | ||
| using ClusterByFunc = std::function<std::string(const DataFile&)>; |
There was a problem hiding this comment.
Why this function returns string instead of size_t just like what C++ hash function does?
There was a problem hiding this comment.
I think a hash could merge distinct keys on collisions(though little chance). Java accepts an Object key, so I used string here.
| return *this; | ||
| } | ||
|
|
||
| Status RewriteManifests::ValidateTargetBranch(const std::string& branch) const { |
There was a problem hiding this comment.
Why do we need this? I didn't find this in the Java code.
There was a problem hiding this comment.
This preserves Java's behavior: SnapshotUpdate.toBranch() defaults to throwing UnsupportedOperationException, and BaseRewriteManifests does not override it. Since the C++ base class provides a shared ToBranch implementation, RewriteManifests needs this check to preserve that restriction
| return self.AddError(ErrorKind::kInvalidArgument, "Branch name cannot be empty"); | ||
| } | ||
|
|
||
| if (auto status = static_cast<SnapshotUpdate&>(self).ValidateTargetBranch(branch); |
There was a problem hiding this comment.
This hook lets derived snapshot updates validate branch support while reusing ToBranch. RewriteManifests uses it to preserve Java's unsupported-branch behavior.
wgtmac
left a comment
There was a problem hiding this comment.
These comments are about the standalone update lifecycle:
- Registration must be mandatory so commit retries reapply the update.
- The temporary transaction must stay detached so its expired weak pointer does not break a later
Commit(). - No-op commits must still call
Finalize()because cleanup is now delegated toTransaction.
Together, these keep one ownership, retry, and finalization path for standalone and explicit transactions.
I think this standalone update lifecycle logic deserves a dedicated PR, so I do that in #868, please take a look |
|
This pull request has been marked as stale due to 30 days of inactivity. It will be closed in 1 week if no further activity occurs. If you think that’s incorrect or this pull request requires a review, please simply write any comment. If closed, you can revive the PR at any time and @mention a reviewer or discuss it on the dev@iceberg.apache.org list. Thank you for your contributions. |
|
This pull request has been closed due to lack of activity. This is not a judgement on the merit of the PR in any way. It is just a way of keeping the PR queue manageable. If you think that is incorrect, or the pull request requires review, you can revive the PR at any time. |
ecc0058 to
d8fd08b
Compare
|
@zhjwpku could you please revive this PR? |
OK, I plan to work on this tomorrow, thanks for the reminder :) |
d8fd08b to
d83d0a8
Compare
| return writer->ToManifestFile(); | ||
| } | ||
|
|
||
| Result<ManifestFile> CopyRewriteManifest( |
There was a problem hiding this comment.
This has duplicate logic with CopyAddendManifest. It'd better to be put into a common helper.
There was a problem hiding this comment.
I took a closer look at CopyAppendManifest. The implementations are similar, but their parameters and behavior differ, I don't see a clean way to extract a common helper :(
| Status ValidateTargetBranch(const std::string& branch) const override; | ||
|
|
||
| private: | ||
| std::string table_name_; |
There was a problem hiding this comment.
This follows the existing pattern: several update operations retain this field without using it. We could revisit these fields together in a follow-up PR.
| ICEBERG_BUILDER_CHECK(manifest.sequence_number == kInvalidSequenceNumber, | ||
| "Sequence number must be assigned during commit"); | ||
|
|
||
| if (can_inherit_snapshot_id()) { |
There was a problem hiding this comment.
We need to check !manifest.added_snapshot_id.has_value() here as well.
There was a problem hiding this comment.
Agreed, Java impl does this, will fix.
| return summary_.Build(); | ||
| } | ||
|
|
||
| void RewriteManifests::SetSummaryProperty(const std::string& property, |
There was a problem hiding this comment.
This might be worth moving to SnapshotUpdate as a follow-up.
There was a problem hiding this comment.
Will create a follow-up PR once this got merged.
| } | ||
|
|
||
| Result<std::vector<ManifestEntry>> ReadManifestEntries(const ManifestFile& manifest) { | ||
| return ReadManifestEntries(std::span<const ManifestFile>(&manifest, 1)); |
There was a problem hiding this comment.
Might be worth replacing duplicates in fast_apend_test.cc with this as a follow-up.
There was a problem hiding this comment.
Agreed. Reusing these helpers in fast_append_test.cc would be a useful follow-up cleanup, will do.
| /// If manifest entries are allowed to inherit the snapshot ID assigned on | ||
| /// commit, the manifest should never be deleted manually if the commit succeeds | ||
| /// as it will become part of the table metadata and will be cleaned up on | ||
| /// expiry. If the manifest gets merged with others while preparing a new |
There was a problem hiding this comment.
Manifests are neither merged nor deleted in AddManifest.
There was a problem hiding this comment.
Updated the docs to remove the merge/delete description and clarify ownership of the original manifest and its copy.
Normalize legacy replacement sequence numbers on format upgrades, invalidate cached output when rewrite settings change, and compute manifest counts in Summary. Require an unset snapshot ID for manifest reuse, clarify AddManifest ownership, and add regression coverage.
| /// be cleaned up on expiry. This update does not delete the original on failure. | ||
| RewriteManifests& AddManifest(const ManifestFile& manifest); | ||
|
|
||
| std::string operation() override; |
There was a problem hiding this comment.
The methods from here should not be public interfaces.
No description provided.