hcrosse opened a new pull request, #1738:
URL: https://github.com/apache/arrow-go/pull/1738

   ### Rationale for this change
   
   `VisitColumnBloomFilter` recycles bloom filter buffers synchronously, and 
`file.Reader` backs them with a `sync.Pool` that does not drain on close. As a 
result, callers checking allocator usage after closing a Parquet reader cannot 
see bloom buffers return to zero until GC drops pool entries and runs 
finalizers. On the writer side, `Writer.Close` and error-discard paths never 
release `FileBloomFilterBuilder` allocations, and 
`blockSplitBloomFilter.Release` does not disarm a pooled buffer's finalizer 
before releasing it.
   
   Adding a release method to `BloomFilter` was previously rejected in #864 
because external types can implement that interface, and `Reader.BufferPool` 
returns a `*sync.Pool` that cannot be iterated on close. To keep v18 interfaces 
intact while making allocator release deterministic, this PR gives 
`BloomFilterReader` a reader-owned tracked freelist drained on `Close` and adds 
`FileBloomFilterBuilder.Release` for terminal writer cleanup.
   
   ### What changes are included in this PR?
   
   - Add `NewBloomFilterReader` and `BloomFilterReader.Close` backed by a 
concurrency-safe tracked freelist wired into reader close, keeping 
`BloomFilter` and the reader buffer pool unchanged.
   - Disarm any buffer finalizer before releasing bloom filter buffers, and use 
value-type cleanup handles so the pre-Go-1.24 fallback avoids self-referential 
finalizer cycles.
   - Add `FileBloomFilterBuilder.Release`, call it in terminal writer close and 
row-group discard paths, and track written row groups so cumulative 
`FlushWithFooter` calls do not rewrite earlier groups.
   
   ### Are these changes tested?
   
   Yes. I added checked-allocator tests covering finalizer disarming under 
assert builds, deterministic reader and writer close cleanup, cumulative footer 
flushes, invalid row-group discard, encrypted bloom filters, concurrent close 
races, and GC fallback.
   
   ### Are there any user-facing changes?
   
   Additive only, with no breaking v18 API changes. 
`metadata.NewBloomFilterReader`, `(*metadata.BloomFilterReader).Close`, and 
`(*metadata.FileBloomFilterBuilder).Release` are newly exported, and closing 
Parquet readers and writers now releases bloom filter buffers deterministically.
   


-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to