Commit b29912f
authored
feat(bigquery/storage/managedwriter): graceful connection drains (#11463)
* feat(bigquery/storage/managedwriter): graceful connection drains
This PR enables a more graceful shutdown when we're doing client
initiated reconnects, typically in response to things like schema
changes.
With this PR, rather than immediately cancelling the previous connection
context, we instead use a goroutine to defer this by a fixed interval,
which gives our recv goroutine more time to process any incoming
notifications from the service.
This can yield a net reduction in duplicate rows for some scenarios,
particularly when EnableWriteRetries is enabled and we see sequential
disconnects (e.g. a multiplex connection observing a number of schema
updates).
It does, however, yield possible short term increases in resource usage,
as we're now potentially retaining goroutines/channels/connections for a
longer interval during these reconnect events. This PR updates testing
that looks for leaking resources with this new understanding
accordingly.1 parent d7ee725 commit b29912f
File tree
2 files changed
+25
-3
lines changed- bigquery/storage/managedwriter
2 files changed
+25
-3
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
20 | 20 | | |
21 | 21 | | |
22 | 22 | | |
| 23 | + | |
23 | 24 | | |
24 | 25 | | |
25 | 26 | | |
| |||
36 | 37 | | |
37 | 38 | | |
38 | 39 | | |
| 40 | + | |
| 41 | + | |
39 | 42 | | |
40 | 43 | | |
41 | 44 | | |
| |||
489 | 492 | | |
490 | 493 | | |
491 | 494 | | |
492 | | - | |
| 495 | + | |
| 496 | + | |
| 497 | + | |
| 498 | + | |
| 499 | + | |
| 500 | + | |
493 | 501 | | |
494 | 502 | | |
495 | 503 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
519 | 519 | | |
520 | 520 | | |
521 | 521 | | |
| 522 | + | |
| 523 | + | |
522 | 524 | | |
523 | 525 | | |
524 | 526 | | |
525 | 527 | | |
526 | | - | |
| 528 | + | |
527 | 529 | | |
528 | 530 | | |
529 | 531 | | |
| |||
539 | 541 | | |
540 | 542 | | |
541 | 543 | | |
542 | | - | |
| 544 | + | |
| 545 | + | |
| 546 | + | |
| 547 | + | |
| 548 | + | |
543 | 549 | | |
544 | 550 | | |
545 | 551 | | |
546 | 552 | | |
547 | 553 | | |
| 554 | + | |
| 555 | + | |
| 556 | + | |
| 557 | + | |
| 558 | + | |
| 559 | + | |
| 560 | + | |
| 561 | + | |
548 | 562 | | |
549 | 563 | | |
550 | 564 | | |
| |||
0 commit comments