Commit 2eff7bd
145893: isession: create internal session r=jeffswenson a=jeffswenson
This introduces the InternalSession. The immediate motivation for this
is to improve the performance of LDR. LDR currently depends on the
internal executor. Every statement executed with the internal executor
creates its own connExecutor instance. This prevents LDR from taking
advantage of prepared statements and generic query plans.
Long term, the idea is to have InternalSession replace the internal
executor. But it was developed as a stand alone conn executor wrapper in
order to minimize the risk of breaking existing clients of the internal
executor.
One key design feature of the InternalSession is the state machine was
moved from a separate goroutine to the goroutine that is requesting the
statement execution. This makes CPU profiles for internal processes much
easier to read because it is obvious which call stack is using the SQL
layer. It may also help with integrating LDR's SQL CPU usage with
elastic admission control since the CPU time is accounted to the calling
goroutine.
Release note: none
Informs: #148310
153995: sql/hints: add per-node cache for system.statement_hints r=DrewKimball a=DrewKimball
#### sql/hints: change StatementHint protobuf struct to union
This commit makes a few changes to the protobuf message used for
serializing statement hints in the `system.statement_hints` table to
prepare for future commits/PRs. No release note or migrations are
necessary, since nothing is currently store nor read from the table.
Epic: None
Release note: None
#### sql/hints: add per-node cache for system.statement_hints
This commit adds a per-node cache for the `system.statement_hints` table,
similar to the table stats cache. The cache tracks the set of all statement
fingerprint hashes that have hints in a map kept up-to-date via rangefeed.
This allows queries to quickly determine whether they have hints, minimizing
the overhead for unhinted queries. Hints are kept in a separate
limited-capacity LRU cache. The LRU cache size can be configured by setting
the `sql.hints.statement_hints_cache_size` cluster setting.
Fixes #148160
Release note: None
#### sql/hints: wait for initial scan during server startup
Server startup will now block until the initial scan of the
`system.statement_hints` table for the hints cache has finished.
This ensures that the node will not accept queries until `hintedHashes`
is initialized, which means that queries without hints will not have
to perform system table reads.
It is possible for the initial scan to fail, in which case server startup
will unblock while the scan restarts. In this rare error scenario,
queries will have to read from the system table on the first execution
even if they don't have hints until the scan finishes. This is
considered preferable to blocking startup across retries, since the
`hintedHashes` map is only an optimization.
Epic: None
Release note: None
#### sql/hints: add tests for statement hints cache
This commit adds a set of tests for the behavior of the hint cache.
The tests verify that the cache is correctly populated in response
to existing hints as well as new insertions and deletions.
Epic: None
Release note: None
154990: sql/schemachanger: add dml injection tests for vector indexes r=fqazi a=fqazi
Previously, we didn't have DML injection tests for creating vector
indexes or changing the primary key on tables with vector indexes. We
now add these.
This patch also addresses one more issue in the secondary index recreation logic that can lead to selecting the wrong target index ID, when index chains are being folded.
Informs: #144443
Release notes: none
Co-authored-by: Jeff Swenson <[email protected]>
Co-authored-by: Drew Kimball <[email protected]>
Co-authored-by: Faizan Qazi <[email protected]>
File tree
104 files changed
+7726
-987
lines changed- .github
- build/bazelutil
- pkg
- ccl/schemachangerccl/sctestbackupccl
- server
- sql
- catalog/systemschema
- hints
- importer
- isession
- isql
- opt/exec/execbuilder/testdata
- schemachanger
- scbuild/internal/scbuildstmt
- testdata/end_to_end
- alter_table_alter_primary_key_using_hash
- alter_table_alter_primary_key_vanilla
- alter_table_alter_primary_key_vector
- create_vector_index
- stmtdiagnostics
Some content is hidden
Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
104 files changed
+7726
-987
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
70 | 70 | | |
71 | 71 | | |
72 | 72 | | |
| 73 | + | |
73 | 74 | | |
74 | 75 | | |
75 | 76 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
144 | 144 | | |
145 | 145 | | |
146 | 146 | | |
| 147 | + | |
147 | 148 | | |
148 | 149 | | |
149 | 150 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
506 | 506 | | |
507 | 507 | | |
508 | 508 | | |
| 509 | + | |
509 | 510 | | |
510 | 511 | | |
511 | 512 | | |
512 | 513 | | |
513 | 514 | | |
514 | 515 | | |
| 516 | + | |
515 | 517 | | |
516 | 518 | | |
517 | 519 | | |
| |||
2066 | 2068 | | |
2067 | 2069 | | |
2068 | 2070 | | |
| 2071 | + | |
2069 | 2072 | | |
2070 | 2073 | | |
2071 | 2074 | | |
| |||
2076 | 2079 | | |
2077 | 2080 | | |
2078 | 2081 | | |
| 2082 | + | |
| 2083 | + | |
2079 | 2084 | | |
2080 | 2085 | | |
2081 | 2086 | | |
| |||
Lines changed: 56 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
242 | 242 | | |
243 | 243 | | |
244 | 244 | | |
| 245 | + | |
245 | 246 | | |
246 | 247 | | |
247 | 248 | | |
| 249 | + | |
248 | 250 | | |
249 | 251 | | |
250 | 252 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
101 | 101 | | |
102 | 102 | | |
103 | 103 | | |
| 104 | + | |
104 | 105 | | |
105 | 106 | | |
106 | 107 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
83 | 83 | | |
84 | 84 | | |
85 | 85 | | |
| 86 | + | |
86 | 87 | | |
87 | 88 | | |
88 | 89 | | |
| |||
1039 | 1040 | | |
1040 | 1041 | | |
1041 | 1042 | | |
1042 | | - | |
| 1043 | + | |
| 1044 | + | |
| 1045 | + | |
| 1046 | + | |
1043 | 1047 | | |
1044 | 1048 | | |
1045 | 1049 | | |
| |||
1775 | 1779 | | |
1776 | 1780 | | |
1777 | 1781 | | |
| 1782 | + | |
| 1783 | + | |
| 1784 | + | |
1778 | 1785 | | |
1779 | 1786 | | |
1780 | 1787 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
145 | 145 | | |
146 | 146 | | |
147 | 147 | | |
| 148 | + | |
148 | 149 | | |
149 | 150 | | |
150 | 151 | | |
| |||
441 | 442 | | |
442 | 443 | | |
443 | 444 | | |
| 445 | + | |
444 | 446 | | |
445 | 447 | | |
446 | 448 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
5433 | 5433 | | |
5434 | 5434 | | |
5435 | 5435 | | |
5436 | | - | |
5437 | | - | |
5438 | | - | |
| 5436 | + | |
| 5437 | + | |
| 5438 | + | |
5439 | 5439 | | |
5440 | 5440 | | |
5441 | 5441 | | |
| |||
5465 | 5465 | | |
5466 | 5466 | | |
5467 | 5467 | | |
5468 | | - | |
| 5468 | + | |
5469 | 5469 | | |
5470 | 5470 | | |
5471 | 5471 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3503 | 3503 | | |
3504 | 3504 | | |
3505 | 3505 | | |
3506 | | - | |
| 3506 | + | |
3507 | 3507 | | |
3508 | | - | |
| 3508 | + | |
3509 | 3509 | | |
3510 | 3510 | | |
3511 | 3511 | | |
| |||
3563 | 3563 | | |
3564 | 3564 | | |
3565 | 3565 | | |
3566 | | - | |
| 3566 | + | |
3567 | 3567 | | |
3568 | 3568 | | |
3569 | 3569 | | |
| |||
0 commit comments