Skip to content

Commit 49a1621

Browse files
authored
fix(bigquery/storage/managedwriter): schema evolution improvements (#7838)
This PR reorders the checks during append processing to ensure we handle schema evolution for both the multiplex and explicit connections correctly.
1 parent a686cfc commit 49a1621

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

β€Žbigquery/storage/managedwriter/connection.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -362,14 +362,14 @@ func (co *connection) lockingAppend(pw *pendingWrite) error {
362362
var ch chan *pendingWrite
363363
var err error
364364

365-
// We still need to reconnect if we need to signal a new schema for explicit streams.
366-
// Rather than adding more state to the connection, we just look at the request as we
367-
// do not allow multiplexing to include explicit streams.
365+
// Handle promotion of per-request schema to default schema in the case of updates.
366+
// Additionally, we check multiplex status as schema changes for explicit streams
367+
// require reconnect, whereas multiplex does not.
368368
forceReconnect := false
369-
if !canMultiplex(pw.writeStreamID) {
370-
if pw.writer != nil && pw.descVersion != nil && pw.descVersion.isNewer(pw.writer.curDescVersion) {
369+
if pw.writer != nil && pw.descVersion != nil && pw.descVersion.isNewer(pw.writer.curDescVersion) {
370+
pw.writer.curDescVersion = pw.descVersion
371+
if !canMultiplex(pw.writeStreamID) {
371372
forceReconnect = true
372-
pw.writer.curDescVersion = pw.descVersion
373373
}
374374
}
375375

0 commit comments

Comments
 (0)