Skip to content

Commit bbb2b96

Browse files
craig[bot]BramGruneirRaduBerindeDedej-Bergin
committed
143421: cli: add node attributes to node status r=BramGruneir a=BramGruneir This change add node attributes to the node status endpoint. Without: ```bash ./cockroach node status --insecure id | address | sql_address | build | started_at | updated_at | locality | is_available | is_live -----+-------------------------------+-------------------------------+---------------------+--------------------------------------+--------------------------------------+----------+--------------+---------- 1 | Brams-MacBook-Pro.local:26257 | Brams-MacBook-Pro.local:26257 | v25.2.0-alpha.1-dev | 2025-03-20 17:59:58.470609 +0000 UTC | 2025-03-20 18:03:19.492982 +0000 UTC | | true | true ``` With: ```bash ./cockroach node status --insecure id | address | sql_address | build | started_at | updated_at | locality | attrs | is_available | is_live -----+-------------------------------+-------------------------------+---------------------+--------------------------------------+--------------------------------------+----------+------------------+--------------+---------- 1 | Brams-MacBook-Pro.local:26257 | Brams-MacBook-Pro.local:26257 | v25.2.0-alpha.1-dev | 2025-03-20 17:59:58.470609 +0000 UTC | 2025-03-20 18:03:19.492982 +0000 UTC | | [attrs on node] | true | true ``` This helps with complex setups in which one might use the node attributes in conjuction with zone configs. That they are not currently present seems like an oversight. Part of: https://cockroachlabs.atlassian.net/browse/TREQ-955 Part of: https://cockroachlabs.atlassian.net/browse/FEB-78 Release note (cli change): Node attributes (attrs) will now appear in the node status cli command. 144553: clusterversion: start 25.3 versions r=RaduBerinde a=RaduBerinde **Checklist**: - [x] Add version key constant for new release (e.g. `V24_2`), equal to `Latest`. Note that we do NOT update the `PreviousRelease` constant. We can only update the `PreviousRelease` when an RC is published, which is needed for upgrade roachtests. - [x] Add final version for the previous release (e.g. `V24_1`). - [x] Add start version (e.g. `V24_2_Start` with version `24.1-2`) and add a new first upgrade for it (in `upgrades/upgrades.go`). - [x] Update `SystemDatabaseSchemaBootstrapVersion` in `pkg/sql/catalog/systemschema/system.go` to the start version just created. - [x] Update `roachpb.successorSeries` map and update `TestReleaseSeriesSuccessor` - [x] Update `pkg/build/version.txt` to the new version (e.g. `v24.2.0-alpha.00000000`) - [x] Update the `scplan` rules in `pkg/sql/schemachanger/scplan/internal/rules`: - copy the contents of `current` into a new release directory for the previous version (e.g. `release_24_1`) - change package name in all files (including `BUILD.bazel`), and update the version in `current/helpers.go` - update `rulesForReleases` in `scplan/plan.go` - rewrite the test outputs: `./dev test pkg/sql/schemachanger/scplan/internal/rules/... --rewrite` - rewrite `TestDeclarativeRules` output: `./dev test pkg/cli -f DeclarativeRules --rewrite` - [x] Update releases file: ``` bazel build //pkg/cmd/release:release _bazel/bin/pkg/cmd/release/release_/release update-releases-file ``` Note that the forked release version will disappear from the releases file. This is what we want; if it is here, we will attempt to run upgrade tests against it. - [x] Regenerate expected test data as needed (usually `pkg/sql/catalog/systemschema_test` and some logictests). 145353: workload/schemachange: properly escape role names in policy statements r=Dedej-Bergin a=Dedej-Bergin When ALTER POLICY is executed with unescaped role identifiers that start with numbers, it can cause SQL syntax errors like "trailing junk after numeric literal". This change adds proper SQL identifier escaping for role names in ALTER POLICY statements by using lexbase.EscapeSQLIdent, which ensures that identifiers are properly quoted with double quotes. The change also avoids a `InFailedSQLTransaction` error by checking `row.Err()` in the `findExistingPolicy` function. Fixes: #145277 Release note: none Co-authored-by: BramGruneir <[email protected]> Co-authored-by: Radu Berinde <[email protected]> Co-authored-by: Bergin Dedej <[email protected]>
4 parents d31f0f4 + e09f425 + 3318081 + 271f5a3 commit bbb2b96

File tree

64 files changed

+13822
-527
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

64 files changed

+13822
-527
lines changed

docs/generated/settings/settings-for-tenants.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -413,4 +413,4 @@ trace.zipkin.collector string the address of a Zipkin instance to receive trace
413413
ui.database_locality_metadata.enabled boolean true if enabled shows extended locality data about databases and tables in DB Console which can be expensive to compute application
414414
ui.default_timezone string the default timezone used to format timestamps in the ui application
415415
ui.display_timezone enumeration etc/utc the timezone used to format timestamps in the ui. This setting is deprecatedand will be removed in a future version. Use the 'ui.default_timezone' setting instead. 'ui.default_timezone' takes precedence over this setting. [etc/utc = 0, america/new_york = 1] application
416-
version version 1000025.1-upgrading-to-1000025.2-step-008 set the active cluster version in the format '<major>.<minor>' application
416+
version version 1000025.2-upgrading-to-1000025.3-step-002 set the active cluster version in the format '<major>.<minor>' application

docs/generated/settings/settings.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -371,6 +371,6 @@
371371
<tr><td><div id="setting-ui-database-locality-metadata-enabled" class="anchored"><code>ui.database_locality_metadata.enabled</code></div></td><td>boolean</td><td><code>true</code></td><td>if enabled shows extended locality data about databases and tables in DB Console which can be expensive to compute</td><td>Serverless/Dedicated/Self-Hosted</td></tr>
372372
<tr><td><div id="setting-ui-default-timezone" class="anchored"><code>ui.default_timezone</code></div></td><td>string</td><td><code></code></td><td>the default timezone used to format timestamps in the ui</td><td>Serverless/Dedicated/Self-Hosted</td></tr>
373373
<tr><td><div id="setting-ui-display-timezone" class="anchored"><code>ui.display_timezone</code></div></td><td>enumeration</td><td><code>etc/utc</code></td><td>the timezone used to format timestamps in the ui. This setting is deprecatedand will be removed in a future version. Use the &#39;ui.default_timezone&#39; setting instead. &#39;ui.default_timezone&#39; takes precedence over this setting. [etc/utc = 0, america/new_york = 1]</td><td>Serverless/Dedicated/Self-Hosted</td></tr>
374-
<tr><td><div id="setting-version" class="anchored"><code>version</code></div></td><td>version</td><td><code>1000025.1-upgrading-to-1000025.2-step-008</code></td><td>set the active cluster version in the format &#39;&lt;major&gt;.&lt;minor&gt;&#39;</td><td>Serverless/Dedicated/Self-Hosted</td></tr>
374+
<tr><td><div id="setting-version" class="anchored"><code>version</code></div></td><td>version</td><td><code>1000025.2-upgrading-to-1000025.3-step-002</code></td><td>set the active cluster version in the format &#39;&lt;major&gt;.&lt;minor&gt;&#39;</td><td>Serverless/Dedicated/Self-Hosted</td></tr>
375375
</tbody>
376376
</table>

pkg/BUILD.bazel

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -599,6 +599,7 @@ ALL_TESTS = [
599599
"//pkg/sql/schemachanger/scplan/internal/rules/current:current_test",
600600
"//pkg/sql/schemachanger/scplan/internal/rules/release_24_3:release_24_3_test",
601601
"//pkg/sql/schemachanger/scplan/internal/rules/release_25_1:release_25_1_test",
602+
"//pkg/sql/schemachanger/scplan/internal/rules/release_25_2:release_25_2_test",
602603
"//pkg/sql/schemachanger/scplan/internal/scgraph:scgraph_test",
603604
"//pkg/sql/schemachanger/scplan:scplan_test",
604605
"//pkg/sql/schemachanger/screl:screl_test",
@@ -2235,6 +2236,8 @@ GO_TARGETS = [
22352236
"//pkg/sql/schemachanger/scplan/internal/rules/release_24_3:release_24_3_test",
22362237
"//pkg/sql/schemachanger/scplan/internal/rules/release_25_1:release_25_1",
22372238
"//pkg/sql/schemachanger/scplan/internal/rules/release_25_1:release_25_1_test",
2239+
"//pkg/sql/schemachanger/scplan/internal/rules/release_25_2:release_25_2",
2240+
"//pkg/sql/schemachanger/scplan/internal/rules/release_25_2:release_25_2_test",
22382241
"//pkg/sql/schemachanger/scplan/internal/rules:rules",
22392242
"//pkg/sql/schemachanger/scplan/internal/scgraph:scgraph",
22402243
"//pkg/sql/schemachanger/scplan/internal/scgraph:scgraph_test",

pkg/build/version.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
v25.2.0-alpha.4
1+
v25.3.0-alpha.00000000

pkg/ccl/kvccl/kvtenantccl/upgradeccl/tenant_upgrade_test.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -504,11 +504,11 @@ func TestTenantUpgradeFailure(t *testing.T) {
504504
db = sqlutils.MakeSQLRunner(conn)
505505

506506
t.Log("ensure that the tenant still works and the target version wasn't reached")
507-
db.CheckQueryResults(t,
508-
"SELECT * FROM t", [][]string{{"1"}, {"2"}})
509-
db.CheckQueryResults(t,
510-
"SELECT split_part(version, '-', 1) FROM [SHOW CLUSTER SETTING version]",
511-
[][]string{{v1.String()}})
507+
db.CheckQueryResults(t, "SELECT * FROM t", [][]string{{"1"}, {"2"}})
508+
res := db.QueryStr(t, "SELECT split_part(version, '-', 1) FROM [SHOW CLUSTER SETTING version]")
509+
if res[0][0] == v2.String() {
510+
t.Fatalf("current version should not equal target version %s", v2.String())
511+
}
512512

513513
t.Log("restart the tenant")
514514
tenant.AppStopper().Stop(ctx)

pkg/ccl/logictestccl/testdata/logic_test/crdb_internal_tenant

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -304,7 +304,7 @@ select crdb_internal.get_vmodule()
304304
query T
305305
SELECT crdb_internal.release_series(crdb_internal.node_executable_version())
306306
----
307-
25.2
307+
25.3
308308

309309
query ITTT colnames,rowsort
310310
select node_id, component, field, regexp_replace(regexp_replace(value, '^\d+$', '<port>'), e':\\d+', ':<port>') as value from crdb_internal.node_runtime_info
@@ -392,7 +392,7 @@ select * from crdb_internal.gossip_alerts
392392
query T
393393
SELECT crdb_internal.release_series(crdb_internal.node_executable_version())
394394
----
395-
25.2
395+
25.3
396396

397397
user root
398398

pkg/cli/node.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,7 @@ var baseNodeColumnHeaders = []string{
8989
"started_at",
9090
"updated_at",
9191
"locality",
92+
"attrs",
9293
"is_available",
9394
"is_live",
9495
}
@@ -168,6 +169,7 @@ func runStatusNodeInner(
168169
started_at,
169170
updated_at,
170171
locality,
172+
attrs,
171173
CASE WHEN split_part(expiration,',',1)::decimal > now()::decimal
172174
THEN true
173175
ELSE false

pkg/cli/testdata/declarative-rules/invalid_version

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,6 @@ invalid_version
44
debug declarative-print-rules 1.1 op
55
unsupported version number, the supported versions are:
66
latest
7+
1000025.2
78
1000025.1
89
1000024.3

pkg/clusterversion/cockroach_versions.go

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -231,6 +231,11 @@ const (
231231

232232
V25_2_AddUsernameToStmtDiagRequest
233233

234+
// V25_2 is CockroachDB v25.2. It's used for all v25.2.x patch releases.
235+
V25_2
236+
237+
V25_3_Start
238+
234239
// *************************************************
235240
// Step (1) Add new versions above this comment.
236241
// Do not add new versions to a patch release.
@@ -287,6 +292,10 @@ var versionTable = [numKeys]roachpb.Version{
287292
V25_2_SetUiDefaultTimezoneSetting: {Major: 25, Minor: 1, Internal: 6},
288293
V25_2_AddUsernameToStmtDiagRequest: {Major: 25, Minor: 1, Internal: 8},
289294

295+
V25_2: {Major: 25, Minor: 2, Internal: 0},
296+
297+
V25_3_Start: {Major: 25, Minor: 2, Internal: 2},
298+
290299
// *************************************************
291300
// Step (2): Add new versions above this comment.
292301
// Do not add new versions to a patch release.
@@ -304,13 +313,13 @@ const MinSupported Key = V24_3
304313
// have at least an RC build published).
305314
const PreviousRelease Key = V25_1
306315

307-
// V25_2 is a placeholder that will eventually be replaced by the actual 25.2
316+
// V25_3 is a placeholder that will eventually be replaced by the actual 25.3
308317
// version Key, but in the meantime it points to the latest Key. The placeholder
309318
// is defined so that it can be referenced in code that simply wants to check if
310-
// a cluster is running 24.3 and has completed all associated migrations; most
319+
// a cluster is running 25.3 and has completed all associated migrations; most
311320
// version gates can use this instead of defining their own version key if they
312-
// only need to check that the cluster has upgraded to 25.2.
313-
const V25_2 = Latest
321+
// only need to check that the cluster has upgraded to 25.3.
322+
const V25_3 = Latest
314323

315324
// DevelopmentBranch must be true on the main development branch but should be
316325
// set to false on a release branch once the set of versions becomes append-only

pkg/roachpb/version.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -237,6 +237,7 @@ var successorSeries = map[ReleaseSeries]ReleaseSeries{
237237
{24, 2}: {24, 3},
238238
{24, 3}: {25, 1},
239239
{25, 1}: {25, 2},
240+
{25, 2}: {25, 3},
240241
}
241242

242243
// ReleaseSeries obtains the release series for the given version. Specifically:

0 commit comments

Comments
 (0)