Repository navigation
Description
Is there an existing issue for the same bug?
- I have checked the existing issues.
Branch and commit
- Discovery branch:
main - Discovery commit:
26903703bb98f67858c2daf32640ae1ecf4ebdc7
Code location
pkg/objectio/writer.go:175-207- Symbols:
objectWriterV1.Write,objectWriterV1.WriteTombstone,objectWriterV1.WriteWithoutSeqnum
Actual behavior
All three public writer entry points call AddBlock/AddTombstone and discard the returned (size, error), then unconditionally return a nil error. The lower-level addBlock can fail while serializing a vector or compressing its bytes. The caller is therefore told that the block was accepted even though it was not appended completely.
Expected behavior
Every object-writer entry point must propagate the lower-level block-write error. A caller must not proceed to WriteEnd after a block serialization/compression failure under the false assumption that the block was accepted.
Steps to reproduce
bat := batch.NewWithSize(1)
bat.Vecs[0] = vector.NewVec(types.T_int64.ToType())
bat.Vecs[0].SetLength(1) // malformed: logical row without fixed-width backing data
bat.SetRowCount(1)
writer, err := objectio.NewObjectWriterSpecial(objectio.WriterNormal, path, fs)
require.NoError(t, err)
_, err = writer.Write(bat)
require.Error(t, err) // currently err is nilvec.MarshalBinaryWithBuffer rejects this vector because its data is shorter than the encoded logical length. addBlock returns that error at the serialization boundary, but Write discards it. Equivalent tests apply to WriteTombstone and WriteWithoutSeqnum.
Evidence
Confirmed code facts
Write,WriteTombstone, andWriteWithoutSeqnumignore the result of the lower-level block call and returnnil.addBlockexplicitly returns errors fromMarshalBinaryWithBufferandWriteWithCompress.addBlockappends the completed block only after all columns serialize, so an early error leaves the writer without the advertised block while the public method still reports success.
Inference
A caller that continues with WriteEnd can persist an empty or incomplete object and publish success for an operation whose block was rejected. The precise SQL/storage paths that can naturally produce a serialization or compression error still need caller-level validation.
Impact
Silent error loss at a storage boundary can turn a detectable write failure into missing object data, incorrect metadata, or delayed read failures.
Unverified assumptions
- A production SQL path that naturally constructs a malformed vector has not been demonstrated.
- Compression-error reachability under valid input has not been demonstrated.
Additional information
- Duplicate searches:
objectWriter AddBlock error,objectio writer error,MarshalBinaryWithBuffer objectioin open and closed issues/PRs; no matching issue found. - Reproduction status: deterministic code-level counterexample; not yet added as a committed unit test.
- Suggested validation: add table-driven tests for all three entry points with a vector whose marshal validation fails, then return the exact
AddBlock/AddTombstoneerror.
Activity
LeftHandCold commentedon Sep 1, 2026
Current-main root-cause verification (2026-09-01)
Classification: proven historical root cause; production code is already fixed on current
main.I reproduced the same deterministic malformed-vector counterexample on the real
default-branch commit at this issue's creation time,
1d00cca77012a2fac20c94bbbd170579e715d217:objectWriterV1.Writereturned a non-nil block and a nil error.objectWriterV1.WriteWithoutSeqnumreturned a non-nil block and a nil error.addBlockhad already returnedvector data is shorter than its marshal length.The violated invariant was therefore exact: the two public wrappers discarded
the
AddBlockresult and advertised acceptance after serialization rejected theblock. Callers such as
BlockWriter.WriteBatch, GC metadata writers, andsnapshot metadata writers already had error branches, but those branches were
unreachable for this lower-level failure.
Baseline correction
The issue's stated discovery SHA
26903703bb98f67858c2daf32640ae1ecf4ebdc7is a 2024 side-branch commit and isnot an ancestor of current
main. The core finding still holds on the actual2026-08-09 main SHA above, but the third entry point in the report does not:
WriteTombstonehad already been removed from the current production writerpath by #19075.
Current status
#26616 incidentally fixed both active wrappers in
ed4a810a539d8b7feae95711d37e7d7d9449d89fby returning theAddBlockerror. On current main
33af6ae3c0c23e4f277137460577ea64678f7ecf,the same two-entry counterexample passes, and the complete
pkg/objectiopackage test passes.
PR #27949 adds the missing permanent regression subcase for
WriteWithoutSeqnum; the existing #26616 test covered onlyWrite.Impact boundary
The API contract defect was real. The worst storage consequence was conditional
on an upstream invalid/oversized vector or another actual serialization failure.
No natural valid-SQL path or observed production data corruption was established
by the issue evidence. The deterministic proof uses the marshal validator; an
LZ4 failure under valid input remains unproven because the writer allocates
CompressBlockBoundbefore compression.test(objectio): cover marshal errors in writer entry points (#27949)
test(objectio): cover marshal errors in writer entry points (matrixor…
test(objectio): cover marshal errors in writer entry points (matrixor…
test(objectio): cover marshal errors in writer entry points (matrixor…