You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@iceberg.apache.org by "CaptainAni187 (via GitHub)" <gi...@apache.org> on 2026/10/02 23:14:51 UTC
[I] Make MetadataBuilder.Build side-effect free for the view version log and the table snapshot log [iceberg-go]
CaptainAni187 opened a new issue, #2108:
URL: https://github.com/apache/iceberg-go/issues/2108
Follow-up to #2095, as discussed in its review. That PR made `table.MetadataBuilder.Build()` leave the metadata log unchanged. Three related spots still write builder state during `Build()`:
**1. `view.MetadataBuilder.Build` appends to the version log on every call.** `view/metadata_builder.go:438-440` appends `versionHistoryEntry` to `b.versionLog` and never clears it, so building the same builder twice duplicates the entry:
```go
b := newTestBuilder().SetLoc("location").AddSchema(newTestSchema(1)).
AddVersion(newTestVersion(1, LastAddedID)).SetCurrentVersionID(LastAddedID)
b.Build() // VersionLog() has 1 entry
b.Build() // 2 entries
b.Build() // 3 entries
```
This is the same pattern #2091 had for tables. The fix would be the same: append to a copy.
**2. `table.MetadataBuilder.updateSnapshotLog` writes back `b.snapshotLog`** (`table/metadata.go`, the `b.snapshotLog = newSnapsLog` assignment). As far as I can tell, running it again removes nothing more, so the result doesn't change, but it is still a side effect of `Build()`. It could compute the log on a copy and pass it into `commonMetadata`, like the metadata log now does.
**3. `buildCommonMetadata` sets `b.lastUpdatedMS` on the first `Build()`**, so later builds and any builder cloned afterwards reuse that timestamp. Repeated builds returning the same timestamp seems reasonable, so I'd keep the behaviour and document it rather than change it, unless you'd prefer otherwise.
I'm happy to take this.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org
Re: [I] Make MetadataBuilder.Build side-effect free for the view version log and the table snapshot log [iceberg-go]
Posted by "laskoviymishka (via GitHub)" <gi...@apache.org>.
laskoviymishka closed issue #2108: Make MetadataBuilder.Build side-effect free for the view version log and the table snapshot log
URL: https://github.com/apache/iceberg-go/issues/2108
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org