Skip to content

Conversation

@azevaykin
Copy link
Collaborator

@azevaykin azevaykin commented Dec 6, 2025

Changelog entry

Expose LocksBrokenAsBreaker and LocksBrokenAsVictim statistics in
.sys/query_metrics_one_minute system view.

  • LocksBrokenAsBreaker: Number of locks broken by this transaction.

  • LocksBrokenAsVictim: Number of times this transaction's locks were
    broken by others.

Changelog category

  • Improvement

Description for reviewers

...

@ydbot
Copy link
Collaborator

ydbot commented Dec 6, 2025

Run Extra Tests

Run additional tests for this PR. You can customize:

  • Test Size: small, medium, large (default: all)
  • Test Targets: any directory path (default: ydb/)
  • Sanitizers: ASAN, MSAN, TSAN
  • Coredumps: enable for debugging (default: off)
  • Additional args: custom ya make arguments

▶  Run tests

@github-actions
Copy link

github-actions bot commented Dec 6, 2025

🟢 2025-12-08 09:48:16 UTC The validation of the Pull Request description is successful.

@github-actions
Copy link

github-actions bot commented Dec 6, 2025

2025-12-06 18:52:59 UTC Pre-commit check linux-x86_64-release-asan for 561e35c has started.
2025-12-06 18:53:40 UTC Artifacts will be uploaded here
2025-12-06 18:56:11 UTC ya make is running...
🟡 2025-12-06 20:41:25 UTC Some tests failed, follow the links below. This fail is not in blocking policy yet

Ya make output | Test bloat

TESTS PASSED ERRORS FAILED SKIPPED MUTED?
13551 13486 0 49 7 9

🟢 2025-12-06 20:41:33 UTC Build successful.
🟢 2025-12-06 20:41:56 UTC ydbd size 3.8 GiB changed* by +99.1 KiB, which is < 100.0 KiB vs main: OK

ydbd size dash main: 34c1681 merge: 561e35c diff diff %
ydbd size 4 127 824 864 Bytes 4 127 926 368 Bytes +99.1 KiB +0.002%
ydbd stripped size 1 532 696 344 Bytes 1 532 740 952 Bytes +43.6 KiB +0.003%

*please be aware that the difference is based on comparing your commit and the last completed build from the post-commit, check comparation

@github-actions
Copy link

github-actions bot commented Dec 6, 2025

2025-12-06 18:54:25 UTC Pre-commit check linux-x86_64-relwithdebinfo for 561e35c has started.
2025-12-06 18:54:43 UTC Artifacts will be uploaded here
2025-12-06 18:56:59 UTC ya make is running...
🟡 2025-12-06 21:14:11 UTC Some tests failed, follow the links below. Going to retry failed tests...

Ya make output | Test bloat

TESTS PASSED ERRORS FAILED SKIPPED MUTED?
41838 38743 0 3 3062 30

2025-12-06 21:14:25 UTC ya make is running... (failed tests rerun, try 2)
🟡 2025-12-06 21:26:04 UTC Some tests failed, follow the links below. Going to retry failed tests...

Ya make output | Test bloat | Test bloat

TESTS PASSED ERRORS FAILED SKIPPED MUTED?
288 (only retried tests) 196 0 2 76 14

2025-12-06 21:26:11 UTC ya make is running... (failed tests rerun, try 3)
🔴 2025-12-06 21:33:18 UTC Some tests failed, follow the links below.

Ya make output | Test bloat | Test bloat | Test bloat

TESTS PASSED ERRORS FAILED SKIPPED MUTED?
32 (only retried tests) 17 0 1 0 14

🟢 2025-12-06 21:33:26 UTC Build successful.
🟢 2025-12-06 21:33:49 UTC ydbd size 2.3 GiB changed* by +64.2 KiB, which is < 100.0 KiB vs main: OK

ydbd size dash main: 34c1681 merge: 561e35c diff diff %
ydbd size 2 466 169 640 Bytes 2 466 235 336 Bytes +64.2 KiB +0.003%
ydbd stripped size 524 846 208 Bytes 524 864 352 Bytes +17.7 KiB +0.003%

*please be aware that the difference is based on comparing your commit and the last completed build from the post-commit, check comparation

@azevaykin azevaykin force-pushed the QueryMetricsLocksBroken branch from 31243aa to e181532 Compare December 7, 2025 06:00
@github-actions
Copy link

github-actions bot commented Dec 7, 2025

2025-12-07 06:00:59 UTC Pre-commit check linux-x86_64-relwithdebinfo for 4549a45 has started.
2025-12-07 06:02:19 UTC Artifacts will be uploaded here
2025-12-07 06:04:26 UTC ya make is running...
🟡 2025-12-07 07:30:07 UTC Some tests failed, follow the links below. Going to retry failed tests...

Ya make output | Test bloat

TESTS PASSED ERRORS FAILED SKIPPED MUTED?
39673 36735 0 10 2902 26

2025-12-07 07:30:19 UTC ya make is running... (failed tests rerun, try 2)
🟡 2025-12-07 07:40:51 UTC Some tests failed, follow the links below. Going to retry failed tests...

Ya make output | Test bloat | Test bloat

TESTS PASSED ERRORS FAILED SKIPPED MUTED?
56 (only retried tests) 43 0 1 0 12

2025-12-07 07:40:57 UTC ya make is running... (failed tests rerun, try 3)
🟢 2025-12-07 07:48:50 UTC Tests successful.

Ya make output | Test bloat | Test bloat | Test bloat

TESTS PASSED ERRORS FAILED SKIPPED MUTED?
26 (only retried tests) 14 0 0 0 12

🟢 2025-12-07 07:48:56 UTC Build successful.
🟢 2025-12-07 07:49:21 UTC ydbd size 2.3 GiB changed* by +60.1 KiB, which is < 100.0 KiB vs main: OK

ydbd size dash main: 2e3cf85 merge: 4549a45 diff diff %
ydbd size 2 466 081 624 Bytes 2 466 143 208 Bytes +60.1 KiB +0.002%
ydbd stripped size 524 842 944 Bytes 524 856 992 Bytes +13.7 KiB +0.003%

*please be aware that the difference is based on comparing your commit and the last completed build from the post-commit, check comparation

@github-actions
Copy link

github-actions bot commented Dec 7, 2025

2025-12-07 06:01:57 UTC Pre-commit check linux-x86_64-release-asan for 4549a45 has started.
2025-12-07 06:02:44 UTC Artifacts will be uploaded here
2025-12-07 06:04:55 UTC ya make is running...
🟡 2025-12-07 07:09:54 UTC Some tests failed, follow the links below. This fail is not in blocking policy yet

Ya make output | Test bloat

TESTS PASSED ERRORS FAILED SKIPPED MUTED?
11930 11854 0 54 14 8

🟢 2025-12-07 07:10:02 UTC Build successful.
🟢 2025-12-07 07:10:25 UTC ydbd size 3.8 GiB changed* by +99.1 KiB, which is < 100.0 KiB vs main: OK

ydbd size dash main: 2e3cf85 merge: 4549a45 diff diff %
ydbd size 4 127 688 464 Bytes 4 127 789 976 Bytes +99.1 KiB +0.002%
ydbd stripped size 1 532 666 008 Bytes 1 532 710 616 Bytes +43.6 KiB +0.003%

*please be aware that the difference is based on comparing your commit and the last completed build from the post-commit, check comparation

@azevaykin azevaykin marked this pull request as ready for review December 7, 2025 09:21
Copilot AI review requested due to automatic review settings December 7, 2025 09:21
@azevaykin azevaykin requested review from a team as code owners December 7, 2025 09:21
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR adds lock statistics tracking to KQP query metrics by exposing LocksBrokenAsBreaker and LocksBrokenAsVictim counters in the .sys/query_metrics_one_minute system view.

Key Changes:

  • Datashard execution units now track and report the number of locks broken by a transaction (LocksBrokenAsBreaker)
  • KQP executer and write actors track when transactions have their locks broken by others (LocksBrokenAsVictim)
  • System view schemas updated to store and expose both lock statistics

Reviewed changes

Copilot reviewed 23 out of 23 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
ydb/core/tx/datashard/execute_write_unit.cpp Sets LocksBrokenAsBreaker stat in write operation results; includes whitespace cleanup
ydb/core/tx/datashard/execute_kqp_data_tx_unit.cpp Sets LocksBrokenAsBreaker stat in KQP data transaction results with added comment
ydb/core/tx/datashard/execute_data_tx_unit.cpp Sets LocksBrokenAsBreaker stat in data transaction results
ydb/core/tx/datashard/datashard_ut_write.cpp Adds unit test verifying LocksBrokenAsBreaker stat for write operations
ydb/core/tx/datashard/datashard_ut_order.cpp Adds unit test verifying LocksBrokenAsBreaker stat for out-of-order transactions
ydb/core/sys_view/ut_registry.cpp Updates schema to include LocksBrokenAsBreaker and LocksBrokenAsVictim columns
ydb/core/sys_view/ut_kqp.cpp Adds comprehensive test for both lock statistics in query metrics system view
ydb/core/sys_view/service/query_interval.cpp Implements aggregation logic for lock statistics
ydb/core/sys_view/query_stats/query_metrics.cpp Adds extractors for LocksBrokenAsBreaker and LocksBrokenAsVictim columns
ydb/core/sys_view/common/registry.h Updates QueryMetrics schema with lock statistics columns
ydb/core/protos/sys_view.proto Adds LocksBrokenAsBreaker and LocksBrokenAsVictim fields to protobuf messages
ydb/core/protos/query_stats.proto Adds LocksBrokenAsBreaker field to TTxStats
ydb/core/protos/kqp_stats.proto Adds TKqpLockStats message with breaker and victim counters
ydb/core/kqp/session_actor/kqp_session_actor.cpp Accumulates lock statistics in query state
ydb/core/kqp/session_actor/kqp_query_stats.h Adds lock statistics fields to TKqpQueryStats
ydb/core/kqp/session_actor/kqp_query_stats.cpp Propagates lock statistics to query stats collection
ydb/core/kqp/session_actor/kqp_query_state.h Adds lock statistics tracking to query state
ydb/core/kqp/runtime/kqp_write_actor.cpp Tracks and propagates lock statistics through write actors and task stats
ydb/core/kqp/executer_actor/kqp_executer_stats.h Adds lock statistics fields to TQueryExecutionStats
ydb/core/kqp/executer_actor/kqp_executer_stats.cpp Aggregates lock statistics from datashard and buffer stats
ydb/core/kqp/executer_actor/kqp_executer.h Adds lock statistics fields to TEvExecuterTxResponse
ydb/core/kqp/executer_actor/kqp_data_executer.cpp Overrides ReplyErrorAndDie to populate lock stats; tracks LocksBrokenAsVictim
ydb/core/grpc_services/rpc_cluster_state.cpp Updates schema description to include lock statistics columns

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@azevaykin azevaykin force-pushed the QueryMetricsLocksBroken branch from e181532 to f9fd2f6 Compare December 7, 2025 09:43
@azevaykin azevaykin requested a review from Copilot December 7, 2025 09:45
@github-actions
Copy link

github-actions bot commented Dec 7, 2025

2025-12-07 09:45:38 UTC Pre-commit check linux-x86_64-release-asan for 4bc71b5 has started.
2025-12-07 09:45:54 UTC Artifacts will be uploaded here
2025-12-07 09:48:01 UTC ya make is running...
🟡 2025-12-07 11:01:59 UTC Some tests failed, follow the links below. This fail is not in blocking policy yet

Ya make output | Test bloat

TESTS PASSED ERRORS FAILED SKIPPED MUTED?
12213 12109 0 79 10 15

🟢 2025-12-07 11:02:07 UTC Build successful.
🟡 2025-12-07 11:02:35 UTC ydbd size 3.8 GiB changed* by +109.9 KiB, which is >= 100.0 KiB vs main: Warning

ydbd size dash main: 9e8876b merge: 4bc71b5 diff diff %
ydbd size 4 127 637 528 Bytes 4 127 750 104 Bytes +109.9 KiB +0.003%
ydbd stripped size 1 532 649 496 Bytes 1 532 694 360 Bytes +43.8 KiB +0.003%

*please be aware that the difference is based on comparing your commit and the last completed build from the post-commit, check comparation

@github-actions
Copy link

github-actions bot commented Dec 7, 2025

2025-12-07 09:47:29 UTC Pre-commit check linux-x86_64-relwithdebinfo for 4bc71b5 has started.
2025-12-07 09:47:46 UTC Artifacts will be uploaded here
2025-12-07 09:49:56 UTC ya make is running...
🟡 2025-12-07 11:22:30 UTC Some tests failed, follow the links below. Going to retry failed tests...

Ya make output | Test bloat

TESTS PASSED ERRORS FAILED SKIPPED MUTED?
39948 37021 0 2 2903 22

2025-12-07 11:22:43 UTC ya make is running... (failed tests rerun, try 2)
🟢 2025-12-07 11:33:19 UTC Tests successful.

Ya make output | Test bloat | Test bloat

TESTS PASSED ERRORS FAILED SKIPPED MUTED?
41 (only retried tests) 28 0 0 0 13

🟢 2025-12-07 11:33:25 UTC Build successful.
🟢 2025-12-07 11:33:47 UTC ydbd size 2.3 GiB changed* by +31.3 KiB, which is < 100.0 KiB vs main: OK

ydbd size dash main: 2e3cf85 merge: 4bc71b5 diff diff %
ydbd size 2 466 081 624 Bytes 2 466 113 704 Bytes +31.3 KiB +0.001%
ydbd stripped size 524 842 944 Bytes 524 848 672 Bytes +5.6 KiB +0.001%

*please be aware that the difference is based on comparing your commit and the last completed build from the post-commit, check comparation

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 23 out of 23 changed files in this pull request and generated no new comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@github-actions
Copy link

github-actions bot commented Dec 8, 2025

2025-12-08 09:38:52 UTC Pre-commit check linux-x86_64-relwithdebinfo for 07c1c30 has started.
2025-12-08 09:38:56 UTC Artifacts will be uploaded here
2025-12-08 09:40:13 UTC ya make is running...
2025-12-08 09:45:10 UTC Check cancelled

@github-actions
Copy link

github-actions bot commented Dec 8, 2025

2025-12-08 09:40:19 UTC Pre-commit check linux-x86_64-release-asan for 07c1c30 has started.
2025-12-08 09:40:35 UTC Artifacts will be uploaded here
2025-12-08 09:42:40 UTC ya make is running...
2025-12-08 09:45:11 UTC Check cancelled

@github-actions
Copy link

github-actions bot commented Dec 8, 2025

2025-12-08 09:46:36 UTC Pre-commit check linux-x86_64-relwithdebinfo for aa058f0 has started.
2025-12-08 09:46:51 UTC Artifacts will be uploaded here
2025-12-08 09:48:05 UTC Check cancelled

@github-actions
Copy link

github-actions bot commented Dec 8, 2025

2025-12-08 09:46:36 UTC Pre-commit check linux-x86_64-release-asan for aa058f0 has started.
2025-12-08 09:46:53 UTC Artifacts will be uploaded here
2025-12-08 09:48:05 UTC Check cancelled

@azevaykin azevaykin force-pushed the QueryMetricsLocksBroken branch from 750fd25 to 06147a7 Compare December 8, 2025 09:47
@github-actions
Copy link

github-actions bot commented Dec 8, 2025

2025-12-08 09:49:29 UTC Pre-commit check linux-x86_64-release-asan for b393fbd has started.
2025-12-08 09:49:47 UTC Artifacts will be uploaded here
2025-12-08 09:51:53 UTC ya make is running...
2025-12-08 10:17:54 UTC Check cancelled

@github-actions
Copy link

github-actions bot commented Dec 8, 2025

2025-12-08 09:49:29 UTC Pre-commit check linux-x86_64-relwithdebinfo for b393fbd has started.
2025-12-08 09:49:47 UTC Artifacts will be uploaded here
2025-12-08 09:51:55 UTC ya make is running...
2025-12-08 10:17:54 UTC Check cancelled

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 27 out of 27 changed files in this pull request and generated 2 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@azevaykin azevaykin requested a review from nikvas0 December 8, 2025 10:18
@github-actions
Copy link

github-actions bot commented Dec 8, 2025

2025-12-08 10:18:23 UTC Pre-commit check linux-x86_64-relwithdebinfo for 55d7687 has started.
2025-12-08 10:18:39 UTC Artifacts will be uploaded here
2025-12-08 10:19:59 UTC ya make is running...
🟡 2025-12-08 12:28:50 UTC Some tests failed, follow the links below. Going to retry failed tests...

Ya make output | Test bloat

TESTS PASSED ERRORS FAILED SKIPPED MUTED?
41843 38914 0 3 2902 24

2025-12-08 12:29:02 UTC ya make is running... (failed tests rerun, try 2)
🟢 2025-12-08 12:38:33 UTC Tests successful.

Ya make output | Test bloat | Test bloat

TESTS PASSED ERRORS FAILED SKIPPED MUTED?
48 (only retried tests) 36 0 0 0 12

🟢 2025-12-08 12:38:39 UTC Build successful.
🟡 2025-12-08 12:38:59 UTC ydbd size 2.3 GiB changed* by +746.4 KiB, which is >= 100.0 KiB vs main: Warning

ydbd size dash main: 357aebf merge: 55d7687 diff diff %
ydbd size 2 466 744 856 Bytes 2 467 509 144 Bytes +746.4 KiB +0.031%
ydbd stripped size 524 944 992 Bytes 525 051 520 Bytes +104.0 KiB +0.020%

*please be aware that the difference is based on comparing your commit and the last completed build from the post-commit, check comparation

@github-actions
Copy link

github-actions bot commented Dec 8, 2025

2025-12-08 10:19:19 UTC Pre-commit check linux-x86_64-release-asan for 55d7687 has started.
2025-12-08 10:19:36 UTC Artifacts will be uploaded here
2025-12-08 10:21:49 UTC ya make is running...
🟡 2025-12-08 12:12:54 UTC Some tests failed, follow the links below. This fail is not in blocking policy yet

Ya make output | Test bloat

TESTS PASSED ERRORS FAILED SKIPPED MUTED?
13552 13473 0 61 7 11

🟢 2025-12-08 12:13:03 UTC Build successful.
🟡 2025-12-08 12:13:31 UTC ydbd size 3.8 GiB changed* by +1.9 MiB, which is >= 100.0 KiB vs main: Warning

ydbd size dash main: 357aebf merge: 55d7687 diff diff %
ydbd size 4 128 799 760 Bytes 4 130 841 592 Bytes +1.9 MiB +0.049%
ydbd stripped size 1 532 947 288 Bytes 1 533 378 936 Bytes +421.5 KiB +0.028%

*please be aware that the difference is based on comparing your commit and the last completed build from the post-commit, check comparation

Copy link
Collaborator

@nikvas0 nikvas0 left a comment

Choose a reason for hiding this comment

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

kqp ok

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants