Cherry-pick: Encode duration as bigint for pgx simple protocol (#10529)#10557
Open
fretz12 wants to merge 2 commits into
Open
Cherry-pick: Encode duration as bigint for pgx simple protocol (#10529)#10557fretz12 wants to merge 2 commits into
fretz12 wants to merge 2 commits into
Conversation
## What changed? Remap `time.Duration` to Postgres int8 (bigint) on pgx connections. ## Why? See #10514. By default pgx encodes time.Duration as an interval (e.g. 00:00:05). Currently, there is a single Duration column VisibilityRow execution_duration which is written as a BigInt. Under the simple query protocol (PgBouncer transaction pooling) the write is rejected with invalid input syntax for type bigint. int8 sends the underlying int64 nanosecond count instead. ## How did you test it? - [X] built - [X] run locally and tested manually - [ ] covered by existing tests - [ ] added new unit test(s) - [X] added new functional test(s) ## Potential risks The time.Duration → int8 mapping is changed for pgx driver, so not scoped to simple protocol. This should be fine, as tests exercise it with existing asserts and new `s.Equal(req.ExecutionDuration, resp.GetExecutionDuration().AsDuration())` --------- Co-authored-by: rodrigozhou <rodrigo.zhou@temporal.io> (cherry picked from commit 3c7e505)
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Backport of #10529 to release/v1.31.x for the v1.31.1 patch.