Skip to content

Commit f2773ad

Browse files
authored
fix(arrow/flight/flightsql): drain channel in flightSqlServer.DoGet (#437)
### Rationale for this change This PR fixes #435. If writing to the RecordWriter fails, the current implementation does not drain the channel when an error occurs while writing to the record writer. ### What changes are included in this PR? We add a deferred function that will drain the channel and call `.Release()` on the underlying `StreamChunks` in order to be able to release the RecordReader. ### Are these changes tested? @zeroshade as you suggested, I'll gladly accept a recommendation for the test setup. ### Are there any user-facing changes? No.
1 parent 542afb6 commit f2773ad

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

arrow/flight/flightsql/server.go

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -916,6 +916,14 @@ func (f *flightSqlServer) DoGet(request *flight.Ticket, stream flight.FlightServ
916916
return err
917917
}
918918

919+
defer func() {
920+
for chunk := range cc {
921+
if chunk.Data != nil {
922+
chunk.Data.Release()
923+
}
924+
}
925+
}()
926+
919927
wr := flight.NewRecordWriter(stream, ipc.WithSchema(sc))
920928
defer wr.Close()
921929

0 commit comments

Comments
 (0)