Repository navigation
fix(table): close underlying counter in manifest creation - #683
Conversation
5411bea to
2152dec
Compare
related to apache#644, fixes apache#681 Signed-off-by: ferhat elmas <[email protected]>
2152dec to
cee9954
Compare
|
Was the test able to confirm the case where it didn't close the file without this change? |
|
Yes, by reverting source changes: |
| out, path, err := sp.newManifestOutput() | ||
| if err != nil { | ||
| return nil, "", nil, err | ||
| return nil, "", nil, nil, err | ||
| } | ||
|
|
||
| counter := &internal.CountingWriter{W: out} | ||
| wr, err := iceberg.NewManifestWriter(sp.txn.meta.formatVersion, counter, spec, | ||
| sp.txn.meta.CurrentSchema(), sp.snapshotID) |
There was a problem hiding this comment.
Hmm, so the issue is that closing the manifest writer isn't sufficient to close the underlying output writer. Could modify the CountingWriter so that it is an io.WriteCloser and propagates a call to Close to the underlying writer, and then update the ManifestWriter to properly call close on the underlying writer when Close is called? That way we don't need to return the separate closer?
Is that worthwhile over this current solution?
There was a problem hiding this comment.
I looked into that option, because it seems better at first but the way of CountingWriter usage in certain cases would require bigger refactoring. Since this approach was already used by manifests method, sticked to this.
There was a problem hiding this comment.
Makes sense. sounds good. Thanks!
zeroshade
left a comment
There was a problem hiding this comment.
Thanks for tracking this down and fixing this!
* more straightforward resource management * for loops don't accumulate defers * runs on panics related to apache#644, apache#683 Signed-off-by: ferhat elmas <[email protected]>
related to #644, fixes #681