Skip to content

Commit d7b6a8f

Browse files
committed
Address review: drop concurrency framing from compress() comment
The previous comment said the captured writerIndex() guarded against the buffer being a 'shared reference to a vector's internal buffer'. As @lidavidm pointed out, Arrow vectors are not safe for concurrent use, so that framing implied a guarantee we do not provide. Tighten the comment to state only the engineering invariant: the three in-method consumers (empty-buffer check, size comparison, and the uncompressed-length prefix) must all see the same value. Reference GH-1116 for context.
1 parent 4c754b1 commit d7b6a8f

1 file changed

Lines changed: 2 additions & 5 deletions

File tree

vector/src/main/java/org/apache/arrow/vector/compression/AbstractCompressionCodec.java

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -29,11 +29,8 @@ public abstract class AbstractCompressionCodec implements CompressionCodec {
2929

3030
@Override
3131
public ArrowBuf compress(BufferAllocator allocator, ArrowBuf uncompressedBuffer) {
32-
// Capture the uncompressed length once upfront to avoid any inconsistency from
33-
// re-reading writerIndex() at different points. Since the uncompressedBuffer may be
34-
// a shared reference to a vector's internal buffer, reading writerIndex() only once
35-
// ensures the same value is used for the empty-buffer check, compression, size
36-
// comparison, and the 8-byte uncompressed-length prefix.
32+
// GH-1116: capture writerIndex() once so the empty-buffer check, size
33+
// comparison, and uncompressed-length prefix all see the same value.
3734
long uncompressedLength = uncompressedBuffer.writerIndex();
3835

3936
if (uncompressedLength == 0L) {

0 commit comments

Comments
 (0)