Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
88974: sql: add support for `DELETE FROM ... USING` r=faizaanmadhani a=faizaanmadhani

See commit messages for details.

Resolves: #40963

89459: metrics: expose pebble flush utilization r=jbowens a=coolcom200

Create a new `GaugeFloat64` metric for pebble’s flush utilization. This
metric is not cumulative, rather, it is the metric over an interval.
This interval is determined by the `interval` parameter of the
`Node.startComputePeriodicMetrics` method.

In order to compute the metric over an interval the previous value of
the metric must be stored. As a result, a map is constructed that takes
a pointer to a store and maps it to a pointer to storage metrics:
`make(map[*kvserver.Store]*storage.Metrics)`. This map is passed to
`node.computeMetricsPeriodically` which gets the store to calculate its
metrics and then updates the previous metrics in the map.

Refactor `store.go`'s metric calculation by separating
`ComputeMetrics(ctx context.Context, tick int) error` into two methods:

* `ComputeMetrics(ctx context.Context) error`
* `ComputeMetricsPeriodically(ctx context.Context, prevMetrics
  *storage.Metrics, tick int) (m storage.Metrics, err error)`

Both methods call the `computeMetrics` which contains the common code
between the two calls. Before this, the process for retrieving metrics
instantaneous was to pass a tick value such as `-1` or `0` to the
`ComputeMetrics(ctx context.Context, tick int)` however it can be
done with a call to `ComputeMetrics(ctx context.Context)`

The `store.ComputeMetricsPeriodically` method will also return the
latest storage metrics. These metrics are used to update the mapping
between stores and metrics used for computing the metric delta over an
interval.

Release Note: None

Resolves part of #85755
Depends on #88972, cockroachdb/pebble#2001
Epic: CRDB-17515


89656: roachtest: introduce admission-control/elastic-cdc r=irfansharif a=irfansharif

Part of #89208. This test sets up a 3-node CRDB cluster on 8vCPU machines running 1000-warehouse TPC-C, and kicks off a few changefeed backfills concurrently. We've observed latency spikes during backfills because of its CPU/scan-heavy nature -- it can elevate CPU scheduling latencies which in turn translates to an increase in foreground latency.

Also in this commit: routing std{err,out} from prometheus/grafana setup that roachtests do to the logger in scope.

Release note: None

Co-authored-by: Faizaan Madhani <[email protected]>
Co-authored-by: Leon Fattakhov <[email protected]>
Co-authored-by: irfan sharif <[email protected]>
  • Loading branch information
4 people committed Oct 17, 2022
4 parents c68e94a + 74ed574 + 8f1d48f + 42d08d8 commit 55aca65
Show file tree
Hide file tree
Showing 36 changed files with 1,472 additions and 166 deletions.
2 changes: 1 addition & 1 deletion docs/generated/sql/bnf/delete_stmt.bnf
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
delete_stmt ::=
( ( 'WITH' ( ( common_table_expr ) ( ( ',' common_table_expr ) )* ) | 'WITH' 'RECURSIVE' ( ( common_table_expr ) ( ( ',' common_table_expr ) )* ) ) | ) 'DELETE' 'FROM' ( ( ( 'ONLY' | ) table_name opt_index_flags ( '*' | ) ) | ( ( 'ONLY' | ) table_name opt_index_flags ( '*' | ) ) table_alias_name | ( ( 'ONLY' | ) table_name opt_index_flags ( '*' | ) ) 'AS' table_alias_name ) ( ( 'WHERE' a_expr ) | ) ( sort_clause | ) ( limit_clause | ) ( 'RETURNING' target_list | 'RETURNING' 'NOTHING' | )
( ( 'WITH' ( ( common_table_expr ) ( ( ',' common_table_expr ) )* ) | 'WITH' 'RECURSIVE' ( ( common_table_expr ) ( ( ',' common_table_expr ) )* ) ) | ) 'DELETE' 'FROM' ( ( ( 'ONLY' | ) table_name opt_index_flags ( '*' | ) ) | ( ( 'ONLY' | ) table_name opt_index_flags ( '*' | ) ) table_alias_name | ( ( 'ONLY' | ) table_name opt_index_flags ( '*' | ) ) 'AS' table_alias_name ) opt_using_clause ( ( 'WHERE' a_expr ) | ) ( sort_clause | ) ( limit_clause | ) ( 'RETURNING' target_list | 'RETURNING' 'NOTHING' | )
166 changes: 85 additions & 81 deletions docs/generated/sql/bnf/stmt_block.bnf
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ create_stmt ::=
| create_external_connection_stmt

delete_stmt ::=
opt_with_clause 'DELETE' 'FROM' table_expr_opt_alias_idx opt_where_clause opt_sort_clause opt_limit_clause returning_clause
opt_with_clause 'DELETE' 'FROM' table_expr_opt_alias_idx opt_using_clause opt_where_clause opt_sort_clause opt_limit_clause returning_clause

drop_stmt ::=
drop_ddl_stmt
Expand Down Expand Up @@ -597,6 +597,10 @@ table_expr_opt_alias_idx ::=
| table_name_opt_idx table_alias_name
| table_name_opt_idx 'AS' table_alias_name

opt_using_clause ::=
'USING' from_list
|

opt_sort_clause ::=
sort_clause
|
Expand Down Expand Up @@ -1771,6 +1775,9 @@ with_clause ::=
table_name_opt_idx ::=
opt_only table_name opt_index_flags opt_descendant

from_list ::=
( table_ref ) ( ( ',' table_ref ) )*

sort_clause ::=
'ORDER' 'BY' sortby_list

Expand Down Expand Up @@ -1971,9 +1978,6 @@ set_clause ::=
single_set_clause
| multiple_set_clause

from_list ::=
( table_ref ) ( ( ',' table_ref ) )*

simple_db_object_name ::=
db_object_name_component

Expand Down Expand Up @@ -2487,6 +2491,16 @@ opt_descendant ::=
'*'
|

table_ref ::=
relation_expr opt_index_flags opt_ordinality opt_alias_clause
| select_with_parens opt_ordinality opt_alias_clause
| 'LATERAL' select_with_parens opt_ordinality opt_alias_clause
| joined_table
| '(' joined_table ')' opt_ordinality alias_clause
| func_table opt_ordinality opt_func_alias_clause
| 'LATERAL' func_table opt_ordinality opt_alias_clause
| '[' row_source_extension_stmt ']' opt_ordinality opt_alias_clause

sortby_list ::=
( sortby ) ( ( ',' sortby ) )*

Expand Down Expand Up @@ -2602,16 +2616,6 @@ single_set_clause ::=
multiple_set_clause ::=
'(' insert_column_list ')' '=' in_expr

table_ref ::=
relation_expr opt_index_flags opt_ordinality opt_alias_clause
| select_with_parens opt_ordinality opt_alias_clause
| 'LATERAL' select_with_parens opt_ordinality opt_alias_clause
| joined_table
| '(' joined_table ')' opt_ordinality alias_clause
| func_table opt_ordinality opt_func_alias_clause
| 'LATERAL' func_table opt_ordinality opt_alias_clause
| '[' row_source_extension_stmt ']' opt_ordinality opt_alias_clause

type_func_name_crdb_extra_keyword ::=
'FAMILY'

Expand Down Expand Up @@ -3062,6 +3066,43 @@ common_table_expr ::=
index_flags_param_list ::=
( index_flags_param ) ( ( ',' index_flags_param ) )*

opt_ordinality ::=
'WITH' 'ORDINALITY'
|

opt_alias_clause ::=
alias_clause
|

joined_table ::=
'(' joined_table ')'
| table_ref 'CROSS' opt_join_hint 'JOIN' table_ref
| table_ref join_type opt_join_hint 'JOIN' table_ref join_qual
| table_ref 'JOIN' table_ref join_qual
| table_ref 'NATURAL' join_type opt_join_hint 'JOIN' table_ref
| table_ref 'NATURAL' 'JOIN' table_ref

alias_clause ::=
'AS' table_alias_name opt_col_def_list_no_types
| table_alias_name opt_col_def_list_no_types

func_table ::=
func_expr_windowless
| 'ROWS' 'FROM' '(' rowsfrom_list ')'

opt_func_alias_clause ::=
func_alias_clause
|

row_source_extension_stmt ::=
delete_stmt
| explain_stmt
| insert_stmt
| select_stmt
| show_stmt
| update_stmt
| upsert_stmt

sortby ::=
a_expr opt_asc_desc opt_nulls_order
| 'PRIMARY' 'KEY' table_name opt_asc_desc
Expand Down Expand Up @@ -3121,43 +3162,6 @@ var_list ::=
schema_wildcard ::=
wildcard_pattern

opt_ordinality ::=
'WITH' 'ORDINALITY'
|

opt_alias_clause ::=
alias_clause
|

joined_table ::=
'(' joined_table ')'
| table_ref 'CROSS' opt_join_hint 'JOIN' table_ref
| table_ref join_type opt_join_hint 'JOIN' table_ref join_qual
| table_ref 'JOIN' table_ref join_qual
| table_ref 'NATURAL' join_type opt_join_hint 'JOIN' table_ref
| table_ref 'NATURAL' 'JOIN' table_ref

alias_clause ::=
'AS' table_alias_name opt_col_def_list_no_types
| table_alias_name opt_col_def_list_no_types

func_table ::=
func_expr_windowless
| 'ROWS' 'FROM' '(' rowsfrom_list ')'

opt_func_alias_clause ::=
func_alias_clause
|

row_source_extension_stmt ::=
delete_stmt
| explain_stmt
| insert_stmt
| select_stmt
| show_stmt
| update_stmt
| upsert_stmt

type_func_name_no_crdb_extra_keyword ::=
'AUTHORIZATION'
| 'COLLATION'
Expand Down Expand Up @@ -3488,6 +3492,30 @@ index_flags_param ::=
| 'FORCE_ZIGZAG'
| 'FORCE_ZIGZAG' '=' index_name

opt_join_hint ::=
'HASH'
| 'MERGE'
| 'LOOKUP'
| 'INVERTED'
|

join_type ::=
'FULL' join_outer
| 'LEFT' join_outer
| 'RIGHT' join_outer
| 'INNER'

join_qual ::=
'USING' '(' name_list ')'
| 'ON' a_expr

rowsfrom_list ::=
( rowsfrom_item ) ( ( ',' rowsfrom_item ) )*

func_alias_clause ::=
'AS' table_alias_name opt_col_def_list
| table_alias_name opt_col_def_list

opt_asc_desc ::=
'ASC'
| 'DESC'
Expand Down Expand Up @@ -3520,30 +3548,6 @@ opt_nowait_or_skip ::=
wildcard_pattern ::=
name '.' '*'

opt_join_hint ::=
'HASH'
| 'MERGE'
| 'LOOKUP'
| 'INVERTED'
|

join_type ::=
'FULL' join_outer
| 'LEFT' join_outer
| 'RIGHT' join_outer
| 'INNER'

join_qual ::=
'USING' '(' name_list ')'
| 'ON' a_expr

rowsfrom_list ::=
( rowsfrom_item ) ( ( ',' rowsfrom_item ) )*

func_alias_clause ::=
'AS' table_alias_name opt_col_def_list
| table_alias_name opt_col_def_list

func_arg ::=
func_arg_class param_name func_arg_type
| param_name func_arg_class func_arg_type
Expand Down Expand Up @@ -3759,12 +3763,6 @@ func_as ::=
col_def_list_no_types ::=
( name ) ( ( ',' name ) )*

group_by_item ::=
a_expr

window_definition ::=
window_name 'AS' window_specification

join_outer ::=
'OUTER'
|
Expand All @@ -3775,6 +3773,12 @@ rowsfrom_item ::=
opt_col_def_list ::=
'(' col_def_list ')'

group_by_item ::=
a_expr

window_definition ::=
window_name 'AS' window_specification

func_arg_class ::=
'IN'

Expand Down
1 change: 1 addition & 0 deletions pkg/cmd/roachtest/tests/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ go_library(
"activerecord_blocklist.go",
"admission_control.go",
"admission_control_elastic_backup.go",
"admission_control_elastic_cdc.go",
"admission_control_multi_store_overload.go",
"admission_control_snapshot_overload.go",
"admission_control_tpcc_overload.go",
Expand Down
1 change: 1 addition & 0 deletions pkg/cmd/roachtest/tests/admission_control.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ func registerAdmission(r registry.Registry) {
// over some latency threshold. Will be Useful to track over time.

registerElasticControlForBackups(r)
registerElasticControlForCDC(r)
registerMultiStoreOverload(r)
registerSnapshotOverload(r)
registerTPCCOverload(r)
Expand Down
Loading

0 comments on commit 55aca65

Please sign in to comment.