Commit 05d910a
committed
fix(bigtable): preserve defaultCluster sentinel in ingestMetadata on missing headers
ingestMetadata gated the entire extractLocation stamping block on
err == nil. extractLocation returns (defaultCluster, defaultZone, err)
when the LocationMDKey header is absent, and RecordAttemptCompletion's
connectivity_error_count check reads
isLocationEmpty := currAttempt.clusterID == defaultCluster
as the "no server-side signals" marker. With the gate, an attempt
without location headers left clusterID as "" (fresh AttemptTracer zero
value); the check evaluated "" == "<unspecified>" → false, and the
counter never incremented. TestConnectivityErrorCount caught this:
metrics_test.go:592: Metric connectivity_error_count for status
Unavailable: got cumulative value 0, want 1
Fix drops the err == nil gate around the stamping block so the
sentinel is applied on missing-header attempts (matching the pre-race-
fix behaviour), and only sets locationExtracted = true when err == nil
so a later InTrailer carrying real data can still overwrite the
sentinel on the same attempt.
Verified:
go test -run TestConnectivityErrorCount -count=1 ./bigtable/ → pass
go test -race -count=3 -run TestHandleRPC_ConcurrentInTrailerAndEnd_NoRace
./bigtable/internal/metrics/ → pass
go test -race -count=1 ./bigtable/internal/metrics/... → pass1 parent bb8b285 commit 05d910a
1 file changed
Lines changed: 28 additions & 21 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
555 | 555 | | |
556 | 556 | | |
557 | 557 | | |
558 | | - | |
559 | | - | |
560 | | - | |
561 | | - | |
562 | | - | |
563 | | - | |
564 | | - | |
565 | | - | |
566 | | - | |
567 | | - | |
568 | | - | |
569 | | - | |
570 | | - | |
571 | | - | |
| 558 | + | |
| 559 | + | |
| 560 | + | |
| 561 | + | |
| 562 | + | |
| 563 | + | |
| 564 | + | |
| 565 | + | |
| 566 | + | |
| 567 | + | |
| 568 | + | |
| 569 | + | |
| 570 | + | |
| 571 | + | |
| 572 | + | |
| 573 | + | |
572 | 574 | | |
573 | | - | |
574 | | - | |
575 | | - | |
576 | | - | |
577 | | - | |
578 | | - | |
579 | | - | |
| 575 | + | |
| 576 | + | |
580 | 577 | | |
| 578 | + | |
| 579 | + | |
| 580 | + | |
| 581 | + | |
| 582 | + | |
| 583 | + | |
| 584 | + | |
| 585 | + | |
| 586 | + | |
| 587 | + | |
581 | 588 | | |
582 | 589 | | |
583 | 590 | | |
| |||
0 commit comments