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

   ### Rationale for this change
   
   Closes #55.
   
   `arrow/ipc.Writer` and `arrow/ipc.FileWriter` wrap an arbitrary `io.Writer` 
and write to it without any internal synchronization. Calling `Write` (or 
`Close`) concurrently from multiple goroutines therefore races on both the 
underlying sink and the writer's own state, which can interleave output and 
corrupt the IPC stream — for example writing the schema header more than once, 
as reported in #55.
   
   Because an arbitrary `io.Writer` cannot be assumed to be safe for concurrent 
use, the writer cannot make this safe on the caller's behalf. The expectation 
that callers serialize writes was simply undocumented.
   
   ### What changes are included in this PR?
   
   Documentation only. The type doc comments on `Writer` and `FileWriter` now 
state that they are **not** safe for concurrent use, explain why 
(interleaved/duplicated output via an unsynchronized `io.Writer`), and direct 
callers that produce records from multiple goroutines to serialize writes 
themselves — for example by funneling records through a channel to a single 
goroutine that owns the writer.
   
   No code or behavior changes.
   
   ### Are these changes tested?
   
   No tests are needed — this is a documentation-only change. `gofmt`, `go 
build`, and `go vet` are clean for `arrow/ipc`.
   
   ### Are there any user-facing changes?
   
   No API or behavior changes; only added godoc on `ipc.Writer` and 
`ipc.FileWriter`.
   


-- 
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