Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
132857: kvserver/rangefeed: process unregister requests asyncronously r=stevendanna a=stevendanna

After the output loop completes, 2 cleanup steps are performed:

1) The registration is removed from the processor's registry, and
2) The process is potentially stopped and removed from the replica.

Before this change, both of these happened syncronously after the output loop finished.

With this change, step (1) happens asyncronously. To facilitate this, an overflow mechanism for requests is provided. This overflow mechanism potentially allocates. Note that we expect that the number of requests is relatively small and should be O(rangefeeds_on_range) so hopefully this mechanism won't be used often.

Step (2) is now handled by the processor itself. After processing an unregister request, if the set of registrations falls to zero, we enqueue a Stop event for ourselves. Then, when processing the Stop, we unregister ourselves from the replica.

Note that this may look like a small semantics change since the previous unregister callback called Stop() which processes all events. However, note that a Stopped event is processed after all other events, so any events in the queue at the point of processing the unregistration that enqueued the stop will be processed.

The motivation for this change is to eventually allow cleanup step (1) to be run as part of registration.disconnect(), which needs to be non-blocking. This is desired for a future change in which there is not a dedicated goroutine to perform this cleanup.

Epic: none
Release note: None

135889: roachtest: add openmetrics emission to sysbench r=DarrylWong a=sambhav-jain-16

This change adds capability of emitting openmetrics from sysbench benchmark

Epic: none

Release note: None

136264: kvserver: add TestFlowControlSendQueueRangeMigrate test  r=sumeerbhola a=kvoli

First commit from #136330.

---

Add a new rac2 flow control integration test,
`TestFlowControlSendQueueRangeMigrate`.

This test takes the following steps:

```sql
-- We will exhaust the tokens across all streams while admission is blocked on
-- n3, using a single 4 MiB (deduction, the write itself is small) write. Then,
-- we will write a 1 MiB put to the range, migrate the range, and write a 1 MiB
-- put to the migrated range. We expect that the migration will trigger a force
-- flush of the send queue.
```

Part of: #132614
Release note: None

136332: kvstreamer: add some metrics r=yuzefovich a=yuzefovich

This commit adds the following metrics:
- `kv.streamer.operators.active` tracks how many active streamer operators are out there currently
- `kv.streamer.batches.count` tracks total number of BatchRequests sent by all streamer instances
- `kv.streamer.batches.in_progress` tracks how many BatchRequests are in flight currently, across all streamer instances
- `kv.streamer.batches.throttled` tracks how many BatchRequests are being currently throttled (queued) due to reaching the streamer concurrency limit, across all streamer instances.

It also includes a couple of recently added dist sender metrics into roachprod opentelemetry registry.

Fixes: #131126.

Release note: None

136514: rolemembershipcache: extract cache to new package r=rafiss a=rafiss

The caching logic was getting to be quite large, and it already was
nicely contained in an easy to move struct.

This is a purely mechanical refactor.

---

### sql, sessioninit: lookup tables by ID, not name

These tables all have fixed IDs, so looking them up by name is not
necessary.

---

Epic: None
Release note: None

136521: orchestration: released CockroachDB version 24.3.0. Next version: 24.3.1 r=mw5h a=cockroach-teamcity


Release note: None
Epic: None
Release justification: non-production (release infra) change.


136543: cmd/reduce: add options to specify http and sql ports r=yuzefovich a=yuzefovich

This will allow us to use the reduce utility concurrently from the same host (by allowing concurrent demo sessions when different ports are provided).

Epic: None

Release note: None

Co-authored-by: Steven Danna <[email protected]>
Co-authored-by: Sambhav Jain <[email protected]>
Co-authored-by: Austen McClernon <[email protected]>
Co-authored-by: Yahor Yuzefovich <[email protected]>
Co-authored-by: Rafi Shamim <[email protected]>
Co-authored-by: Justin Beaver <[email protected]>
  • Loading branch information
7 people committed Dec 3, 2024
8 parents 2e1a81d + bbfbaa1 + d84cf6f + e5c50fc + 568266c + 97edf1f + 49a190d + a6d5403 commit ef46c67
Show file tree
Hide file tree
Showing 74 changed files with 1,292 additions and 623 deletions.
2 changes: 1 addition & 1 deletion cloud/kubernetes/bring-your-own-certs/client.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ spec:
serviceAccountName: cockroachdb
containers:
- name: cockroachdb-client
image: cockroachdb/cockroach:v24.2.5
image: cockroachdb/cockroach:v24.3.0
# Keep a pod open indefinitely so kubectl exec can be used to get a shell to it
# and run cockroach client commands, such as cockroach sql, cockroach node status, etc.
command:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ spec:
topologyKey: kubernetes.io/hostname
containers:
- name: cockroachdb
image: cockroachdb/cockroach:v24.2.5
image: cockroachdb/cockroach:v24.3.0
imagePullPolicy: IfNotPresent
# TODO: Change these to appropriate values for the hardware that you're running. You can see
# the resources that can be allocated on each of your Kubernetes nodes by running:
Expand Down
2 changes: 1 addition & 1 deletion cloud/kubernetes/client-secure.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ spec:
mountPath: /cockroach-certs
containers:
- name: cockroachdb-client
image: cockroachdb/cockroach:v24.2.5
image: cockroachdb/cockroach:v24.3.0
imagePullPolicy: IfNotPresent
volumeMounts:
- name: client-certs
Expand Down
2 changes: 1 addition & 1 deletion cloud/kubernetes/cluster-init-secure.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ spec:
mountPath: /cockroach-certs
containers:
- name: cluster-init
image: cockroachdb/cockroach:v24.2.5
image: cockroachdb/cockroach:v24.3.0
imagePullPolicy: IfNotPresent
volumeMounts:
- name: client-certs
Expand Down
2 changes: 1 addition & 1 deletion cloud/kubernetes/cluster-init.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ spec:
spec:
containers:
- name: cluster-init
image: cockroachdb/cockroach:v24.2.5
image: cockroachdb/cockroach:v24.3.0
imagePullPolicy: IfNotPresent
command:
- "/cockroach/cockroach"
Expand Down
2 changes: 1 addition & 1 deletion cloud/kubernetes/cockroachdb-statefulset-secure.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@ spec:
topologyKey: kubernetes.io/hostname
containers:
- name: cockroachdb
image: cockroachdb/cockroach:v24.2.5
image: cockroachdb/cockroach:v24.3.0
imagePullPolicy: IfNotPresent
# TODO: Change these to appropriate values for the hardware that you're running. You can see
# the resources that can be allocated on each of your Kubernetes nodes by running:
Expand Down
2 changes: 1 addition & 1 deletion cloud/kubernetes/cockroachdb-statefulset.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ spec:
topologyKey: kubernetes.io/hostname
containers:
- name: cockroachdb
image: cockroachdb/cockroach:v24.2.5
image: cockroachdb/cockroach:v24.3.0
imagePullPolicy: IfNotPresent
# TODO: Change these to appropriate values for the hardware that you're running. You can see
# the resources that can be allocated on each of your Kubernetes nodes by running:
Expand Down
2 changes: 1 addition & 1 deletion cloud/kubernetes/multiregion/client-secure.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ spec:
serviceAccountName: cockroachdb
containers:
- name: cockroachdb-client
image: cockroachdb/cockroach:v24.2.5
image: cockroachdb/cockroach:v24.3.0
imagePullPolicy: IfNotPresent
volumeMounts:
- name: client-certs
Expand Down
2 changes: 1 addition & 1 deletion cloud/kubernetes/multiregion/cluster-init-secure.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ spec:
serviceAccountName: cockroachdb
containers:
- name: cluster-init
image: cockroachdb/cockroach:v24.2.5
image: cockroachdb/cockroach:v24.3.0
imagePullPolicy: IfNotPresent
volumeMounts:
- name: client-certs
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ spec:
topologyKey: kubernetes.io/hostname
containers:
- name: cockroachdb
image: cockroachdb/cockroach:v24.2.5
image: cockroachdb/cockroach:v24.3.0
imagePullPolicy: IfNotPresent
ports:
- containerPort: 26257
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ spec:
name: cockroach-env
containers:
- name: cockroachdb
image: cockroachdb/cockroach:v24.2.5
image: cockroachdb/cockroach:v24.3.0
imagePullPolicy: IfNotPresent
# TODO: Change these to appropriate values for the hardware that you're running. You can see
# the resources that can be allocated on each of your Kubernetes nodes by running:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ spec:
hostNetwork: true
containers:
- name: cockroachdb
image: cockroachdb/cockroach:v24.2.5
image: cockroachdb/cockroach:v24.3.0
imagePullPolicy: IfNotPresent
# TODO: If you configured taints to give CockroachDB exclusive access to nodes, feel free
# to remove the requests and limits sections. If you didn't, you'll need to change these to
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ spec:
topologyKey: kubernetes.io/hostname
containers:
- name: cockroachdb
image: cockroachdb/cockroach:v24.2.5
image: cockroachdb/cockroach:v24.3.0
imagePullPolicy: IfNotPresent
# TODO: If you configured taints to give CockroachDB exclusive access to nodes, feel free
# to remove the requests and limits sections. If you didn't, you'll need to change these to
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ spec:
- name: cockroachdb
# NOTE: Always use the most recent version of CockroachDB for the best
# performance and reliability.
image: cockroachdb/cockroach:v24.2.5
image: cockroachdb/cockroach:v24.3.0
imagePullPolicy: IfNotPresent
# TODO: Change these to appropriate values for the hardware that you're running. You can see
# the resources that can be allocated on each of your Kubernetes nodes by running:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,7 @@ spec:
- name: cockroachdb
# NOTE: Always use the most recent version of CockroachDB for the best
# performance and reliability.
image: cockroachdb/cockroach:v24.2.5
image: cockroachdb/cockroach:v24.3.0
imagePullPolicy: IfNotPresent
# TODO: Change these to appropriate values for the hardware that you're running. You can see
# the resources that can be allocated on each of your Kubernetes nodes by running:
Expand Down
2 changes: 1 addition & 1 deletion cloud/kubernetes/v1.6/client-secure.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ spec:
mountPath: /cockroach-certs
containers:
- name: cockroachdb-client
image: cockroachdb/cockroach:v24.2.5
image: cockroachdb/cockroach:v24.3.0
imagePullPolicy: IfNotPresent
volumeMounts:
- name: client-certs
Expand Down
2 changes: 1 addition & 1 deletion cloud/kubernetes/v1.6/cluster-init-secure.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ spec:
mountPath: /cockroach-certs
containers:
- name: cluster-init
image: cockroachdb/cockroach:v24.2.5
image: cockroachdb/cockroach:v24.3.0
imagePullPolicy: IfNotPresent
volumeMounts:
- name: client-certs
Expand Down
2 changes: 1 addition & 1 deletion cloud/kubernetes/v1.6/cluster-init.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ spec:
spec:
containers:
- name: cluster-init
image: cockroachdb/cockroach:v24.2.5
image: cockroachdb/cockroach:v24.3.0
imagePullPolicy: IfNotPresent
command:
- "/cockroach/cockroach"
Expand Down
2 changes: 1 addition & 1 deletion cloud/kubernetes/v1.6/cockroachdb-statefulset-secure.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ spec:
topologyKey: kubernetes.io/hostname
containers:
- name: cockroachdb
image: cockroachdb/cockroach:v24.2.5
image: cockroachdb/cockroach:v24.3.0
imagePullPolicy: IfNotPresent
ports:
- containerPort: 26257
Expand Down
2 changes: 1 addition & 1 deletion cloud/kubernetes/v1.6/cockroachdb-statefulset.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ spec:
topologyKey: kubernetes.io/hostname
containers:
- name: cockroachdb
image: cockroachdb/cockroach:v24.2.5
image: cockroachdb/cockroach:v24.3.0
imagePullPolicy: IfNotPresent
ports:
- containerPort: 26257
Expand Down
2 changes: 1 addition & 1 deletion cloud/kubernetes/v1.7/client-secure.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ spec:
mountPath: /cockroach-certs
containers:
- name: cockroachdb-client
image: cockroachdb/cockroach:v24.2.5
image: cockroachdb/cockroach:v24.3.0
imagePullPolicy: IfNotPresent
volumeMounts:
- name: client-certs
Expand Down
2 changes: 1 addition & 1 deletion cloud/kubernetes/v1.7/cluster-init-secure.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ spec:
mountPath: /cockroach-certs
containers:
- name: cluster-init
image: cockroachdb/cockroach:v24.2.5
image: cockroachdb/cockroach:v24.3.0
imagePullPolicy: IfNotPresent
volumeMounts:
- name: client-certs
Expand Down
2 changes: 1 addition & 1 deletion cloud/kubernetes/v1.7/cluster-init.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ spec:
spec:
containers:
- name: cluster-init
image: cockroachdb/cockroach:v24.2.5
image: cockroachdb/cockroach:v24.3.0
imagePullPolicy: IfNotPresent
command:
- "/cockroach/cockroach"
Expand Down
2 changes: 1 addition & 1 deletion cloud/kubernetes/v1.7/cockroachdb-statefulset-secure.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ spec:
topologyKey: kubernetes.io/hostname
containers:
- name: cockroachdb
image: cockroachdb/cockroach:v24.2.5
image: cockroachdb/cockroach:v24.3.0
imagePullPolicy: IfNotPresent
ports:
- containerPort: 26257
Expand Down
2 changes: 1 addition & 1 deletion cloud/kubernetes/v1.7/cockroachdb-statefulset.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ spec:
topologyKey: kubernetes.io/hostname
containers:
- name: cockroachdb
image: cockroachdb/cockroach:v24.2.5
image: cockroachdb/cockroach:v24.3.0
imagePullPolicy: IfNotPresent
ports:
- containerPort: 26257
Expand Down
4 changes: 4 additions & 0 deletions docs/generated/metrics/metrics.html
Original file line number Diff line number Diff line change
Expand Up @@ -1530,6 +1530,10 @@
<tr><td>APPLICATION</td><td>kv.protectedts.reconciliation.num_runs</td><td>number of successful reconciliation runs on this node</td><td>Count</td><td>COUNTER</td><td>COUNT</td><td>AVG</td><td>NON_NEGATIVE_DERIVATIVE</td></tr>
<tr><td>APPLICATION</td><td>kv.protectedts.reconciliation.records_processed</td><td>number of records processed without error during reconciliation on this node</td><td>Count</td><td>COUNTER</td><td>COUNT</td><td>AVG</td><td>NON_NEGATIVE_DERIVATIVE</td></tr>
<tr><td>APPLICATION</td><td>kv.protectedts.reconciliation.records_removed</td><td>number of records removed during reconciliation runs on this node</td><td>Count</td><td>COUNTER</td><td>COUNT</td><td>AVG</td><td>NON_NEGATIVE_DERIVATIVE</td></tr>
<tr><td>APPLICATION</td><td>kv.streamer.batches.in_progress</td><td>Number of BatchRequests in progress across all KV Streamer operators</td><td>Batches</td><td>GAUGE</td><td>COUNT</td><td>AVG</td><td>NONE</td></tr>
<tr><td>APPLICATION</td><td>kv.streamer.batches.sent</td><td>Number of BatchRequests sent across all KV Streamer operators</td><td>Batches</td><td>COUNTER</td><td>COUNT</td><td>AVG</td><td>NON_NEGATIVE_DERIVATIVE</td></tr>
<tr><td>APPLICATION</td><td>kv.streamer.batches.throttled</td><td>Number of BatchRequests currently being throttled due to reaching the concurrency limit, across all KV Streamer operators</td><td>Batches</td><td>GAUGE</td><td>COUNT</td><td>AVG</td><td>NONE</td></tr>
<tr><td>APPLICATION</td><td>kv.streamer.operators.active</td><td>Number of KV Streamer operators currently in use</td><td>Operators</td><td>GAUGE</td><td>COUNT</td><td>AVG</td><td>NONE</td></tr>
<tr><td>APPLICATION</td><td>logical_replication.batch_hist_nanos</td><td>Time spent flushing a batch</td><td>Nanoseconds</td><td>HISTOGRAM</td><td>NANOSECONDS</td><td>AVG</td><td>NONE</td></tr>
<tr><td>APPLICATION</td><td>logical_replication.catchup_ranges</td><td>Source side ranges undergoing catch up scans (innacurate with multiple LDR jobs)</td><td>Ranges</td><td>GAUGE</td><td>COUNT</td><td>AVG</td><td>NONE</td></tr>
<tr><td>APPLICATION</td><td>logical_replication.catchup_ranges_by_label</td><td>Source side ranges undergoing catch up scans</td><td>Ranges</td><td>COUNTER</td><td>COUNT</td><td>AVG</td><td>NON_NEGATIVE_DERIVATIVE</td></tr>
Expand Down
1 change: 1 addition & 0 deletions pkg/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -2101,6 +2101,7 @@ GO_TARGETS = [
"//pkg/sql/regionliveness:regionliveness",
"//pkg/sql/regions:regions",
"//pkg/sql/regions:regions_test",
"//pkg/sql/rolemembershipcache:rolemembershipcache",
"//pkg/sql/roleoption:roleoption",
"//pkg/sql/row:row",
"//pkg/sql/row:row_test",
Expand Down
44 changes: 21 additions & 23 deletions pkg/cmd/reduce/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,8 @@ var (
}()
flags = flag.NewFlagSet(os.Args[0], flag.ExitOnError)
binary = flags.String("binary", "./cockroach", "path to cockroach binary")
httpPort = flags.Int("http-port", 8080, "first port number for HTTP servers in demo")
sqlPort = flags.Int("sql-port", 26257, "first port number for SQL servers in demo")
file = flags.String("file", "", "the path to a file containing SQL queries to reduce; required")
outFlag = flags.String("out", "", "if set, the path to a new file where reduced result will be written to")
verbose = flags.Bool("v", false, "print progress to standard output and the original test case output if it is not interesting")
Expand Down Expand Up @@ -117,8 +119,8 @@ func main() {
}
reducesql.LogUnknown = *unknown
out, err := reduceSQL(
*binary, *contains, file, *workers, *verbose, *chunkReductions, *multiRegion,
*tlp, *costfuzz, *unoptimizedOracle,
*binary, *httpPort, *sqlPort, *contains, file, *workers, *verbose,
*chunkReductions, *multiRegion, *tlp, *costfuzz, *unoptimizedOracle,
)
if err != nil {
log.Fatal(err)
Expand All @@ -136,7 +138,9 @@ func main() {
}

func reduceSQL(
binary, contains string,
binary string,
httpPort, sqlPort int,
contains string,
file *string,
workers int,
verbose bool,
Expand Down Expand Up @@ -292,28 +296,22 @@ SELECT '%[1]s';
}

isInteresting := func(ctx context.Context, sql string) (interesting bool, logOriginalHint func()) {
// If not multi-region, disable license generation. Do not exit on errors so
// the entirety of the input SQL is processed.
var cmd *exec.Cmd
args := []string{
"demo",
"--insecure",
"--empty",
// Do not exit on errors so the entirety of the input SQL is
// processed.
"--set=errexit=false",
"--format=tsv",
fmt.Sprintf("--http-port=%d", httpPort),
fmt.Sprintf("--sql-port=%d", sqlPort),
}
if multiRegion {
cmd = exec.CommandContext(ctx, binary,
"demo",
"--insecure",
"--empty",
"--nodes=9",
"--multitenant=false",
"--set=errexit=false",
"--format=tsv",
)
} else {
cmd = exec.CommandContext(ctx, binary,
"demo",
"--insecure",
"--empty",
"--set=errexit=false",
"--format=tsv",
)
args = append(args, "--nodes=9")
args = append(args, "--multitenant=false")
}
cmd := exec.CommandContext(ctx, binary, args...)
// Disable telemetry.
cmd.Env = []string{"COCKROACH_SKIP_ENABLING_DIAGNOSTIC_REPORTING", "true"}
sql = settings + sql
Expand Down
8 changes: 6 additions & 2 deletions pkg/cmd/roachtest/clusterstats/exporter.go
Original file line number Diff line number Diff line change
Expand Up @@ -144,13 +144,13 @@ func serializeOpenmetricsReport(r ClusterStatRun, labelString *string) (*bytes.B

// Emit summary metrics from Total
for metricName, value := range r.Total {
buffer.WriteString(fmt.Sprintf("# TYPE %s gauge\n", util.SanitizeMetricName(metricName)))
buffer.WriteString(GetOpenmetricsGaugeType(metricName))
buffer.WriteString(fmt.Sprintf("%s{%s} %f %d\n", util.SanitizeMetricName(metricName), *labelString, value, timeutil.Now().UTC().Unix()))
}

// Emit histogram metrics from Stats
for _, stat := range r.Stats {
buffer.WriteString(fmt.Sprintf("# TYPE %s gauge\n", util.SanitizeMetricName(stat.Tag)))
buffer.WriteString(GetOpenmetricsGaugeType(stat.Tag))
for i, timestamp := range stat.Time {
t := timeutil.Unix(0, timestamp)
buffer.WriteString(
Expand Down Expand Up @@ -445,3 +445,7 @@ func GetOpenmetricsLabelMap(
}
return defaultMap
}

func GetOpenmetricsGaugeType(metricName string) string {
return fmt.Sprintf("# TYPE %s gauge\n", util.SanitizeMetricName(metricName))
}
1 change: 1 addition & 0 deletions pkg/cmd/roachtest/tests/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -215,6 +215,7 @@ go_library(
"//pkg/cloud/amazon",
"//pkg/cloud/gcp",
"//pkg/cmd/cmpconn",
"//pkg/cmd/roachprod-microbench/util",
"//pkg/cmd/roachtest/cluster",
"//pkg/cmd/roachtest/clusterstats",
"//pkg/cmd/roachtest/grafana",
Expand Down
Loading

0 comments on commit ef46c67

Please sign in to comment.