sql: fix and rename sql stats session transaction received time#83590
sql: fix and rename sql stats session transaction received time#83590craig[bot] merged 1 commit intocockroachdb:masterfrom
Conversation
819d811 to
414a5e7
Compare
xinhaoz
left a comment
There was a problem hiding this comment.
Reviewable status:
complete! 0 of 0 LGTMs obtained (waiting on @rafiss and @THardy98)
pkg/sql/conn_executor_exec.go line 2186 at r1 (raw file):
// Transaction received time is the time at which the statement that prompted // the creation of this transaction was received.
Should we change this comment? Also maybe we should include a test with the failing case Rafi saw using a query executing with the extended protocol
Code quote:
// Transaction received time is the time at which the statement that prompted
// the creation of this transaction was received.
rafiss
left a comment
There was a problem hiding this comment.
Reviewable status:
complete! 0 of 0 LGTMs obtained (waiting on @rafiss and @xinhaoz)
pkg/sql/conn_executor_exec.go line 2186 at r1 (raw file):
Previously, xinhaoz (Xin Hao Zhang) wrote…
Should we change this comment? Also maybe we should include a test with the failing case Rafi saw using a query executing with the extended protocol
Yeah, and maybe instead of SessionTransactionReceived we should call it SessionTransactionStarted. the comment would be something about how it's the time the connExecutor created the transaction
414a5e7 to
e39c947
Compare
9bd6865 to
4fe1f17
Compare
THardy98
left a comment
There was a problem hiding this comment.
Reviewable status:
complete! 0 of 0 LGTMs obtained (waiting on @rafiss and @xinhaoz)
pkg/sql/conn_executor_exec.go line 2186 at r1 (raw file):
Previously, rafiss (Rafi Shamim) wrote…
Yeah, and maybe instead of
SessionTransactionReceivedwe should call itSessionTransactionStarted. the comment would be something about how it's the time the connExecutor created the transaction
Yeah, renamed to SessionTransactionStarted, removed the comment in conn_executor_exec.go, the variable names are pretty self-explanatory now.
Added a test to sql_stats_test.go 👍
|
Added use of the Hmm, test passes whether I use |
4fe1f17 to
019cf0b
Compare
019cf0b to
63d6859
Compare
|
Even when I specify |
|
@THardy98 I believe in your testCase loop you might be accessing the copy of phaseTimes from the start of the loop execution, and not the version from after your test case is executed, so it might be the phase times from an internal query. Maybe try accessing it via the index to get the up to date version and also not copy the times from internal queries. |
63d6859 to
76976db
Compare
Yup that was exactly it, muchos gracias :) |
76976db to
f20a1f3
Compare
438d80d to
d264d23
Compare
Resolves: cockroachdb#82894 Due to a change from cockroachdb#76792, implicit transactions can start before `SessionQueryReceived` session phase time is set by the sqlstats system. In turn, this caused the `SessionTransactionReceived` (now renamed as `SessionTransactionStarted`) session phase time to be recorded incorrectly, causing extremely large transactions times on the UI. This change fixes this mistake by setting the actual transaction start time as the `SessionTransactionStarted` session phase time, instead of `SessionQueryReceived`. Release note (bug fix): The `SessionTransactionReceived` session phase time is no longer recorded incorrectly, fixing large transaction times from appearing on the UI, also renamed to `SessionTransactionStarted`.
d264d23 to
f8f7459
Compare
maryliag
left a comment
There was a problem hiding this comment.
Reviewed 1 of 4 files at r2, 1 of 3 files at r4, 3 of 3 files at r5, all commit messages.
Reviewable status:complete! 1 of 0 LGTMs obtained (waiting on @xinhaoz)
|
Bazel CI failing on a flaky test, going to merge TYFR :) |
|
bors r+ |
|
Build succeeded: |
Resolves: #82894
Due to a change from #76792, implicit transactions can start before
SessionQueryReceivedsession phase time is set by the sqlstats system.In turn, this caused the
SessionTransactionReceived(now renamed asSessionTransactionStarted) session phase time to be recordedincorrectly, causing extremely large transactions times on the UI. This
change fixes this mistake by setting the actual transaction start time
as the
SessionTransactionStartedsession phase time, instead ofSessionQueryReceived.Release note (bug fix): The
SessionTransactionReceivedsession phasetime is no longer recorded incorrectly, fixing large transaction times
from appearing on the UI, also renamed to
SessionTransactionStarted.