Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

server: return elapsed time for active executions #88384

Merged
merged 1 commit into from
Sep 22, 2022

Conversation

xinhaoz
Copy link
Member

@xinhaoz xinhaoz commented Sep 21, 2022

Previously, we calculated the time elapsed for an active stmt or txn based on the start time returned from the server and the time the response was last received. Calculating this value on the client is not reliable and can lead to negative values when the server time is slightly ahead. This commit fixes this issue by including the time elapsed as part of the active txns and stmts response.

Release note (bug fix): time elapsed for active txns and stmts is never negative.

@xinhaoz xinhaoz requested a review from a team September 21, 2022 20:06
@xinhaoz xinhaoz requested review from a team as code owners September 21, 2022 20:06
@xinhaoz xinhaoz requested a review from a team September 21, 2022 20:06
@cockroach-teamcity
Copy link
Member

This change is Reviewable

@xinhaoz xinhaoz force-pushed the fix-elapsed-time-negative branch from b9a80ca to cb8eda2 Compare September 21, 2022 20:20
Copy link
Contributor

@maryliag maryliag left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you added the label to backport to 22.1, but this feature didn't exist on 22.1

:lgtm:

Reviewed 12 of 12 files at r1, all commit messages.
Reviewable status: :shipit: complete! 1 of 0 LGTMs obtained (waiting on @xinhaoz)

Previously, we calculated the time elapsed for an active
stmt or txn based on the start time returned from the
server and the time the response was last received.
Calculating this value on the client is not reliable and
can lead to negative values when the server time is slightly
ahead. This commit fixes this issue by including the time
elapsed as part of the active txns and stmts response.

Release note (bug fix): time elapsed for active txns and stmts
is never negative.
@xinhaoz xinhaoz force-pushed the fix-elapsed-time-negative branch from cb8eda2 to ac0d5b7 Compare September 21, 2022 21:23
Copy link
Contributor

@matthewtodd matthewtodd left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewable status: :shipit: complete! 0 of 0 LGTMs obtained (and 1 stale) (waiting on @maryliag and @xinhaoz)


pkg/ui/workspaces/cluster-ui/src/activeExecutions/execTableCommon.tsx line 191 at r2 (raw file):

      title: executionsTableTitles.elapsedTime(execType),
      cell: (item: ActiveExecution) =>
        Duration(item.elapsedTime.asMilliseconds() * 1e6),

Hmm, I see it was like this before, but is it a bug that we multiply milliseconds by 1,000,000? I'd expect to see 1,000.

@xinhaoz
Copy link
Member Author

xinhaoz commented Sep 22, 2022

pkg/ui/workspaces/cluster-ui/src/activeExecutions/execTableCommon.tsx line 191 at r2 (raw file):

Previously, matthewtodd (Matthew Todd) wrote…

Hmm, I see it was like this before, but is it a bug that we multiply milliseconds by 1,000,000? I'd expect to see 1,000.

Yep, I want nanoseconds here since that is what the Duration function expects so that's why I used 1e6. There's no asNanoseconds function for durations unfortunately :(

@xinhaoz
Copy link
Member Author

xinhaoz commented Sep 22, 2022

Test failure unrelated.
bors r+

@craig
Copy link
Contributor

craig bot commented Sep 22, 2022

Build succeeded:

@craig craig bot merged commit 7278468 into cockroachdb:master Sep 22, 2022
@matthewtodd
Copy link
Contributor

pkg/ui/workspaces/cluster-ui/src/activeExecutions/execTableCommon.tsx line 191 at r2 (raw file):

Previously, xinhaoz (Xin Hao Zhang) wrote…

Yep, I want nanoseconds here since that is what the Duration function expects so that's why I used 1e6. There's no asNanoseconds function for durations unfortunately :(

Oh, right, I was thinking backwards. Thank you!

@xinhaoz xinhaoz deleted the fix-elapsed-time-negative branch November 21, 2022 19:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants