-
Notifications
You must be signed in to change notification settings - Fork 3.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
137479: protobuf: don't serialize zero-valued std duration r=nvanbenschoten a=nvanbenschoten Picks up cockroachdb/gogoproto#10. > This commit updates the serialization of `time.Duration` (see `gogo.stdduration`) to avoid serializing the default (zero) value in proto3. In Go, `time.Duration` is a typedef of int64, so it was surprising that unlike int64, the zero value of time.Duration fields were being put on the wire. > > While here, we also fix `DurationFromProto` to not cause its input to escape to the heap by passing it through `fmt.Errorf`. This function is called from `StdDurationUnmarshal` and its unintentional heap allocation what alerted me to the zero-value serialization issue. Performance improvement on sysbench microbenchmarks: ``` name old time/op new time/op delta Sysbench/SQL/1node_remote/oltp_read_only-10 3.09ms ±12% 3.08ms ± 9% ~ (p=0.905 n=9+10) Sysbench/SQL/1node_remote/oltp_write_only-10 1.97ms ± 4% 1.96ms ± 3% ~ (p=0.278 n=9+10) Sysbench/SQL/1node_remote/oltp_read_write-10 5.73ms ± 1% 5.73ms ± 1% ~ (p=1.000 n=7+8) Sysbench/SQL/1node_remote/oltp_point_select-10 180µs ± 6% 181µs ±14% ~ (p=0.853 n=10+10) Sysbench/KV/1node_remote/oltp_read_only-10 736µs ± 3% 729µs ± 3% ~ (p=0.190 n=10+10) Sysbench/KV/1node_remote/oltp_write_only-10 594µs ± 2% 587µs ± 4% ~ (p=0.211 n=9+10) Sysbench/KV/1node_remote/oltp_read_write-10 1.44ms ± 6% 1.42ms ± 3% ~ (p=0.156 n=10+9) Sysbench/KV/1node_remote/oltp_point_select-10 33.7µs ±11% 34.9µs ± 9% ~ (p=0.247 n=10+10) name old alloc/op new alloc/op delta Sysbench/KV/1node_remote/oltp_point_select-10 6.69kB ± 1% 6.61kB ± 1% -1.18% (p=0.001 n=10+9) Sysbench/SQL/1node_remote/oltp_point_select-10 30.0kB ± 0% 29.7kB ± 1% -0.87% (p=0.000 n=8+10) Sysbench/SQL/1node_remote/oltp_write_only-10 476kB ± 0% 474kB ± 0% -0.61% (p=0.000 n=10+9) Sysbench/KV/1node_remote/oltp_write_only-10 230kB ± 0% 229kB ± 0% -0.53% (p=0.000 n=10+10) Sysbench/SQL/1node_remote/oltp_read_write-10 1.62MB ± 0% 1.62MB ± 0% -0.34% (p=0.000 n=10+10) Sysbench/KV/1node_remote/oltp_read_only-10 647kB ± 0% 645kB ± 0% -0.25% (p=0.000 n=10+10) Sysbench/KV/1node_remote/oltp_read_write-10 872kB ± 0% 870kB ± 0% -0.25% (p=0.000 n=10+9) Sysbench/SQL/1node_remote/oltp_read_only-10 1.15MB ± 0% 1.15MB ± 0% -0.23% (p=0.000 n=10+10) name old allocs/op new allocs/op delta Sysbench/KV/1node_remote/oltp_point_select-10 57.0 ± 0% 55.0 ± 0% -3.51% (p=0.000 n=10+9) Sysbench/KV/1node_remote/oltp_read_only-10 1.83k ± 0% 1.80k ± 0% -1.54% (p=0.000 n=10+10) Sysbench/KV/1node_remote/oltp_read_write-10 3.33k ± 0% 3.29k ± 0% -1.43% (p=0.000 n=10+9) Sysbench/SQL/1node_remote/oltp_write_only-10 3.79k ± 0% 3.74k ± 0% -1.38% (p=0.000 n=10+9) Sysbench/KV/1node_remote/oltp_write_only-10 1.51k ± 0% 1.49k ± 0% -1.37% (p=0.000 n=10+10) Sysbench/SQL/1node_remote/oltp_read_write-10 8.40k ± 0% 8.31k ± 0% -1.13% (p=0.000 n=10+10) Sysbench/SQL/1node_remote/oltp_point_select-10 253 ± 0% 251 ± 1% -1.03% (p=0.000 n=10+10) Sysbench/SQL/1node_remote/oltp_read_only-10 4.60k ± 0% 4.56k ± 0% -0.89% (p=0.000 n=10+10) ``` Epic: None Release note: None 137532: metrics: address race in MetricVec collection code path r=kyle-a-wong a=MattWhelan The *Vec metrics employ a RWLock to control concurrent access to the set of labels they maintain, but we were reading that set without holding the lock during metric collections. Fixes: #137396 Release note: None Co-authored-by: Nathan VanBenschoten <nvanbenschoten@gmail.com> Co-authored-by: Matt Whelan <matt.whelan@cockroachlabs.com>
- Loading branch information
Showing
10 changed files
with
36 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters