Skip to content

Commit 4097cda

Browse files
tmp
1 parent d7ad21d commit 4097cda

File tree

121 files changed

+808
-2170
lines changed

Some content is hidden

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

121 files changed

+808
-2170
lines changed

build/tools/gen-cockroachdb-metrics/main.go

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ var (
9696
skipPatterns = []*regexp.Regexp{
9797
regexp.MustCompile(`^auth_`),
9898
regexp.MustCompile(`^distsender_rpc_err_errordetailtype_`),
99-
regexp.MustCompile(`^gossip_callbacks_[^_]+_`),
99+
regexp.MustCompile(`^gossip_callbacks_`),
100100
regexp.MustCompile(`^jobs_auto_config_env_runner_`),
101101
regexp.MustCompile(`^jobs_update_table_`),
102102
regexp.MustCompile(`^logical_replication_`),
@@ -304,9 +304,7 @@ func loadBaseMappings(path string) (*BaseMappingsYAML, error) {
304304

305305
// collectAllCRDBMetrics collects all CRDB metrics from the YAML output and combines them
306306
// with any runtime conditional metrics that aren't documented in metrics.yaml
307-
func collectAllCRDBMetrics(
308-
yamlOutput *YAMLOutput, runtimeConditionalMetrics []MetricInfo,
309-
) []MetricInfo {
307+
func collectAllCRDBMetrics(yamlOutput *YAMLOutput, runtimeConditionalMetrics []MetricInfo) []MetricInfo {
310308
allMetrics := make([]MetricInfo, 0)
311309

312310
for _, layer := range yamlOutput.Layers {
@@ -330,9 +328,7 @@ func shouldSkipMetric(promName string) bool {
330328
}
331329

332330
// mapMetricsToDatadog processes the CRDB metrics and maps them to Datadog names
333-
func mapMetricsToDatadog(
334-
metrics []MetricInfo, datadogMappings map[string]string,
335-
) map[string]string {
331+
func mapMetricsToDatadog(metrics []MetricInfo, datadogMappings map[string]string) map[string]string {
336332
result := make(map[string]string)
337333

338334
for _, metric := range metrics {
@@ -469,7 +465,7 @@ func main() {
469465
flag.Parse()
470466

471467
args := flag.Args()
472-
468+
473469
// Check if running in datadog-only mode
474470
if *datadogOnly {
475471
if len(flag.Args()) < 2 {

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -361,6 +361,7 @@ sql.stats.automatic_full_collection.enabled boolean true automatic full statisti
361361
sql.stats.automatic_partial_collection.enabled boolean true automatic partial statistics collection mode application
362362
sql.stats.automatic_partial_collection.fraction_stale_rows float 0.05 target fraction of stale rows per table that will trigger a partial statistics refresh application
363363
sql.stats.automatic_partial_collection.min_stale_rows integer 100 target minimum number of stale rows per table that will trigger a partial statistics refresh application
364+
sql.stats.canary_fraction float 0 probability that table statistics will use canary mode instead of stable mode for query planning [0.0-1.0] application
364365
sql.stats.cleanup.recurrence string @hourly cron-tab recurrence for SQL Stats cleanup job application
365366
sql.stats.detailed_latency_metrics.enabled boolean false label latency metrics with the statement fingerprint. Workloads with tens of thousands of distinct query fingerprints should leave this setting false. (experimental, affects performance for workloads with high fingerprint cardinality) application
366367
sql.stats.error_on_concurrent_create_stats.enabled boolean false set to true to error on concurrent CREATE STATISTICS jobs, instead of skipping them application
@@ -427,4 +428,4 @@ trace.zipkin.collector string the address of a Zipkin instance to receive trace
427428
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
428429
ui.default_timezone string the default timezone used to format timestamps in the ui application
429430
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
430-
version version 1000025.4-upgrading-to-1000026.1-step-006 set the active cluster version in the format '<major>.<minor>' application
431+
version version 25.4-upgrading-to-26.1-step-006 set the active cluster version in the format '<major>.<minor>' application

docs/generated/settings/settings.html

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -316,6 +316,7 @@
316316
<tr><td><div id="setting-sql-stats-automatic-partial-collection-enabled" class="anchored"><code>sql.stats.automatic_partial_collection.enabled</code></div></td><td>boolean</td><td><code>true</code></td><td>automatic partial statistics collection mode</td><td>Basic/Standard/Advanced/Self-Hosted</td></tr>
317317
<tr><td><div id="setting-sql-stats-automatic-partial-collection-fraction-stale-rows" class="anchored"><code>sql.stats.automatic_partial_collection.fraction_stale_rows</code></div></td><td>float</td><td><code>0.05</code></td><td>target fraction of stale rows per table that will trigger a partial statistics refresh</td><td>Basic/Standard/Advanced/Self-Hosted</td></tr>
318318
<tr><td><div id="setting-sql-stats-automatic-partial-collection-min-stale-rows" class="anchored"><code>sql.stats.automatic_partial_collection.min_stale_rows</code></div></td><td>integer</td><td><code>100</code></td><td>target minimum number of stale rows per table that will trigger a partial statistics refresh</td><td>Basic/Standard/Advanced/Self-Hosted</td></tr>
319+
<tr><td><div id="setting-sql-stats-canary-fraction" class="anchored"><code>sql.stats.canary_fraction</code></div></td><td>float</td><td><code>0</code></td><td>probability that table statistics will use canary mode instead of stable mode for query planning [0.0-1.0]</td><td>Basic/Standard/Advanced/Self-Hosted</td></tr>
319320
<tr><td><div id="setting-sql-stats-cleanup-recurrence" class="anchored"><code>sql.stats.cleanup.recurrence</code></div></td><td>string</td><td><code>@hourly</code></td><td>cron-tab recurrence for SQL Stats cleanup job</td><td>Basic/Standard/Advanced/Self-Hosted</td></tr>
320321
<tr><td><div id="setting-sql-stats-detailed-latency-metrics-enabled" class="anchored"><code>sql.stats.detailed_latency_metrics.enabled</code></div></td><td>boolean</td><td><code>false</code></td><td>label latency metrics with the statement fingerprint. Workloads with tens of thousands of distinct query fingerprints should leave this setting false. (experimental, affects performance for workloads with high fingerprint cardinality)</td><td>Basic/Standard/Advanced/Self-Hosted</td></tr>
321322
<tr><td><div id="setting-sql-stats-error-on-concurrent-create-stats-enabled" class="anchored"><code>sql.stats.error_on_concurrent_create_stats.enabled</code></div></td><td>boolean</td><td><code>false</code></td><td>set to true to error on concurrent CREATE STATISTICS jobs, instead of skipping them</td><td>Basic/Standard/Advanced/Self-Hosted</td></tr>
@@ -386,6 +387,6 @@
386387
<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>Basic/Standard/Advanced/Self-Hosted</td></tr>
387388
<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>Basic/Standard/Advanced/Self-Hosted</td></tr>
388389
<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>Basic/Standard/Advanced/Self-Hosted</td></tr>
389-
<tr><td><div id="setting-version" class="anchored"><code>version</code></div></td><td>version</td><td><code>1000025.4-upgrading-to-1000026.1-step-006</code></td><td>set the active cluster version in the format &#39;&lt;major&gt;.&lt;minor&gt;&#39;</td><td>Basic/Standard/Advanced/Self-Hosted</td></tr>
390+
<tr><td><div id="setting-version" class="anchored"><code>version</code></div></td><td>version</td><td><code>25.4-upgrading-to-26.1-step-006</code></td><td>set the active cluster version in the format &#39;&lt;major&gt;.&lt;minor&gt;&#39;</td><td>Basic/Standard/Advanced/Self-Hosted</td></tr>
390391
</tbody>
391392
</table>

pkg/BUILD.bazel

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -211,7 +211,6 @@ ALL_TESTS = [
211211
"//pkg/jobs/jobspb:jobspb_test",
212212
"//pkg/jobs/jobsprofiler:jobsprofiler_test",
213213
"//pkg/jobs/jobsprotectedts:jobsprotectedts_test",
214-
"//pkg/jobs/metricspoller:metricspoller_test",
215214
"//pkg/jobs:jobs_test",
216215
"//pkg/keys:keys_test",
217216
"//pkg/keyvisualizer/spanstatsconsumer:spanstatsconsumer_test",
@@ -729,10 +728,8 @@ ALL_TESTS = [
729728
"//pkg/upgrade/upgrades:upgrades_test",
730729
"//pkg/util/admission/admissionpb:admissionpb_test",
731730
"//pkg/util/admission:admission_test",
732-
"//pkg/util/allstacks:allstacks_test",
733731
"//pkg/util/assetbundle:assetbundle_test",
734732
"//pkg/util/base64:base64_test",
735-
"//pkg/util/besteffort:besteffort_test",
736733
"//pkg/util/binfetcher:binfetcher_test",
737734
"//pkg/util/bitarray:bitarray_test",
738735
"//pkg/util/bitmap:bitmap_test",
@@ -1441,7 +1438,6 @@ GO_TARGETS = [
14411438
"//pkg/jobs/jobsprotectedts:jobsprotectedts_test",
14421439
"//pkg/jobs/jobstest:jobstest",
14431440
"//pkg/jobs/metricspoller:metricspoller",
1444-
"//pkg/jobs/metricspoller:metricspoller_test",
14451441
"//pkg/jobs:jobs",
14461442
"//pkg/jobs:jobs_test",
14471443
"//pkg/keys:keys",
@@ -2603,7 +2599,6 @@ GO_TARGETS = [
26032599
"//pkg/util/admission:admission",
26042600
"//pkg/util/admission:admission_test",
26052601
"//pkg/util/allstacks:allstacks",
2606-
"//pkg/util/allstacks:allstacks_test",
26072602
"//pkg/util/arith:arith",
26082603
"//pkg/util/asciitsdb:asciitsdb",
26092604
"//pkg/util/assetbundle/gen:gen",
@@ -2612,8 +2607,6 @@ GO_TARGETS = [
26122607
"//pkg/util/assetbundle:assetbundle_test",
26132608
"//pkg/util/base64:base64",
26142609
"//pkg/util/base64:base64_test",
2615-
"//pkg/util/besteffort:besteffort",
2616-
"//pkg/util/besteffort:besteffort_test",
26172610
"//pkg/util/binfetcher:binfetcher",
26182611
"//pkg/util/binfetcher:binfetcher_test",
26192612
"//pkg/util/bitarray:bitarray",

pkg/backup/BUILD.bazel

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -293,6 +293,7 @@ go_test(
293293
"//pkg/sql/sem/tree",
294294
"//pkg/sql/sessiondata",
295295
"//pkg/sql/sqlclustersettings",
296+
"//pkg/sql/sqlliveness/slbase",
296297
"//pkg/sql/sqltestutils",
297298
"//pkg/sql/stats",
298299
"//pkg/storage",

pkg/backup/backup_tenant_test.go

Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,16 +9,19 @@ import (
99
"context"
1010
"fmt"
1111
"testing"
12+
"time"
1213

1314
"github.com/cockroachdb/cockroach/pkg/base"
1415
"github.com/cockroachdb/cockroach/pkg/ccl/multiregionccl/multiregionccltestutils"
1516
_ "github.com/cockroachdb/cockroach/pkg/cloud/impl" // register cloud storage providers
1617
"github.com/cockroachdb/cockroach/pkg/jobs"
1718
"github.com/cockroachdb/cockroach/pkg/jobs/jobspb"
19+
"github.com/cockroachdb/cockroach/pkg/multitenant/tenantcapabilitiespb"
1820
"github.com/cockroachdb/cockroach/pkg/roachpb"
1921
"github.com/cockroachdb/cockroach/pkg/sql"
2022
_ "github.com/cockroachdb/cockroach/pkg/sql/importer"
2123
"github.com/cockroachdb/cockroach/pkg/sql/sqlclustersettings"
24+
"github.com/cockroachdb/cockroach/pkg/sql/sqlliveness/slbase"
2225
"github.com/cockroachdb/cockroach/pkg/testutils"
2326
"github.com/cockroachdb/cockroach/pkg/testutils/jobutils"
2427
"github.com/cockroachdb/cockroach/pkg/testutils/serverutils"
@@ -27,10 +30,78 @@ import (
2730
"github.com/cockroachdb/cockroach/pkg/testutils/testcluster"
2831
"github.com/cockroachdb/cockroach/pkg/util/leaktest"
2932
"github.com/cockroachdb/cockroach/pkg/util/log"
33+
"github.com/cockroachdb/cockroach/pkg/util/timeutil"
3034
"github.com/cockroachdb/errors"
3135
"github.com/stretchr/testify/require"
3236
)
3337

38+
func TestBackupSharedProcessTenantNodeDown(t *testing.T) {
39+
defer leaktest.AfterTest(t)()
40+
defer log.Scope(t).Close(t)
41+
42+
ctx := context.Background()
43+
44+
skip.UnderRace(t, "multi-node, multi-tenant test too slow under race")
45+
skip.UnderDeadlock(t, "too slow under deadlock detector")
46+
params := base.TestClusterArgs{
47+
ServerArgs: base.TestServerArgs{
48+
DefaultTestTenant: base.TestControlsTenantsExplicitly,
49+
},
50+
}
51+
params.ServerArgs.Knobs.JobsTestingKnobs = jobs.NewTestingKnobsWithShortIntervals()
52+
tc, hostDB, _, cleanup := backupRestoreTestSetupWithParams(t, multiNode, 0, /* numAccounts */
53+
InitManualReplication, params)
54+
defer cleanup()
55+
56+
hostDB.Exec(t, "ALTER TENANT ALL SET CLUSTER SETTING server.sqlliveness.ttl='2s'")
57+
hostDB.Exec(t, "ALTER TENANT ALL SET CLUSTER SETTING server.sqlliveness.heartbeat='250ms'")
58+
59+
testTenantID := roachpb.MustMakeTenantID(11)
60+
tenantApp, tenantDB, err := tc.Server(0).TenantController().StartSharedProcessTenant(ctx,
61+
base.TestSharedProcessTenantArgs{
62+
TenantID: testTenantID,
63+
TenantName: "test",
64+
})
65+
require.NoError(t, err)
66+
67+
tc.GrantTenantCapabilities(
68+
ctx, t, testTenantID,
69+
map[tenantcapabilitiespb.ID]string{tenantcapabilitiespb.CanUseNodelocalStorage: "true"})
70+
71+
tenantSQL := sqlutils.MakeSQLRunner(tenantDB)
72+
tenantSQL.Exec(t, "CREATE TABLE foo AS SELECT generate_series(1, 4000)")
73+
tenantSQL.Exec(t, "ALTER TABLE foo SPLIT AT VALUES (500), (1000), (1500), (2000), (2500), (3000)")
74+
tenantSQL.Exec(t, "ALTER TABLE foo SCATTER")
75+
76+
t.Log("waiting for SQL instances")
77+
waitStart := timeutil.Now()
78+
for i := 1; i < multiNode; i++ {
79+
testutils.SucceedsSoon(t, func() error {
80+
t.Logf("waiting for server %d", i)
81+
db, err := tc.Server(i).SystemLayer().SQLConnE(serverutils.DBName("cluster:test/defaultdb"))
82+
if err != nil {
83+
return err
84+
}
85+
return db.Ping()
86+
})
87+
}
88+
t.Logf("all SQL instances (took %s)", timeutil.Since(waitStart))
89+
90+
// Shut down a node.
91+
t.Log("shutting down server 2 (n3)")
92+
tc.StopServer(2)
93+
94+
// We use succeeds soon here since it still takes some time
95+
// for instance-based planning to recognize the downed node.
96+
sv := &tenantApp.ClusterSettings().SV
97+
padding := 10 * time.Second
98+
timeout := slbase.DefaultTTL.Get(sv) + slbase.DefaultHeartBeat.Get(sv) + padding
99+
testutils.SucceedsWithin(t, func() error {
100+
_, err := tenantDB.Exec("BACKUP INTO 'nodelocal://1/worker-failure'")
101+
return err
102+
}, timeout)
103+
}
104+
34105
func TestBackupTenantImportingTable(t *testing.T) {
35106
defer leaktest.AfterTest(t)()
36107
defer log.Scope(t).Close(t)

pkg/backup/datadriven_test.go

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@ import (
2727
"github.com/cockroachdb/cockroach/pkg/jobs/jobspb"
2828
"github.com/cockroachdb/cockroach/pkg/keys"
2929
"github.com/cockroachdb/cockroach/pkg/kv"
30-
"github.com/cockroachdb/cockroach/pkg/kv/bulk"
3130
"github.com/cockroachdb/cockroach/pkg/kv/kvclient/kvcoord"
3231
"github.com/cockroachdb/cockroach/pkg/kv/kvpb"
3332
"github.com/cockroachdb/cockroach/pkg/kv/kvserver"
@@ -46,7 +45,6 @@ import (
4645
"github.com/cockroachdb/cockroach/pkg/testutils/serverutils"
4746
"github.com/cockroachdb/cockroach/pkg/testutils/skip"
4847
"github.com/cockroachdb/cockroach/pkg/testutils/sqlutils"
49-
"github.com/cockroachdb/cockroach/pkg/util/admission"
5048
"github.com/cockroachdb/cockroach/pkg/util/ctxgroup"
5149
"github.com/cockroachdb/datadriven"
5250
"github.com/cockroachdb/errors"
@@ -196,12 +194,6 @@ func (d *datadrivenTestState) addCluster(t *testing.T, cfg clusterCfg) error {
196194
closedts.SideTransportCloseInterval.Override(context.Background(), &settings.SV, 10*time.Millisecond)
197195
kvserver.RangeFeedRefreshInterval.Override(context.Background(), &settings.SV, 10*time.Millisecond)
198196
sql.TempObjectWaitInterval.Override(context.Background(), &settings.SV, time.Millisecond)
199-
// Disable AC yielding as these tests can run many in-process clusters at once
200-
// and overload the host. Generally overload would mean bulk work, which only
201-
// uses strictly spare capacitym gets starved, but these tests expect it to
202-
// still run (just slowly, along with everything else).
203-
bulk.YieldIfNoPacer.Override(context.Background(), &settings.SV, false)
204-
admission.YieldInPacer.Override(context.Background(), &settings.SV, false)
205197
params.ServerArgs.Settings = settings
206198

207199
clusterSize := cfg.nodes

pkg/backup/restore_schema_change_creation.go

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ import (
1515
"github.com/cockroachdb/cockroach/pkg/keys"
1616
"github.com/cockroachdb/cockroach/pkg/roachpb"
1717
"github.com/cockroachdb/cockroach/pkg/security/username"
18-
"github.com/cockroachdb/cockroach/pkg/sql"
1918
"github.com/cockroachdb/cockroach/pkg/sql/catalog"
2019
descpb "github.com/cockroachdb/cockroach/pkg/sql/catalog/descpb"
2120
"github.com/cockroachdb/cockroach/pkg/sql/catalog/tabledesc"
@@ -196,9 +195,6 @@ func createSchemaChangeJobsFromMutations(
196195
spanList[i] = jobspb.ResumeSpanList{ResumeSpans: []roachpb.Span{tableDesc.PrimaryIndexSpan(codec)}}
197196
}
198197
}
199-
// Populate session data for schema changes that require it.
200-
sd := sql.NewInternalSessionData(ctx, jr.ClusterSettings(), "schema-change-restore")
201-
sd.UserProto = username.EncodeProto()
202198
jobRecord := jobs.Record{
203199
// We indicate that this schema change was triggered by a RESTORE since
204200
// the job description may not have all the information to fully describe
@@ -210,7 +206,6 @@ func createSchemaChangeJobsFromMutations(
210206
DescID: tableDesc.ID,
211207
TableMutationID: mutationID,
212208
ResumeSpanList: spanList,
213-
SessionData: &sd.SessionData,
214209
// The version distinction for database jobs doesn't matter for a schema
215210
// change on a single table.
216211
FormatVersion: jobspb.DatabaseJobFormatVersion,

pkg/backup/testdata/backup-restore/materialized_view

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ CREATE DATABASE testdb;
88
USE testdb;
99
CREATE TABLE testdb.t (a int primary key, b int);
1010
CREATE MATERIALIZED VIEW testdb.mv AS SELECT a, b FROM testdb.t;
11-
CREATE MATERIALIZED VIEW testdb.mv2 AS SELECT a, b FROM testdb.t;
1211
INSERT INTO testdb.t (a, b) VALUES (1, 2);
1312
----
1413

@@ -24,18 +23,6 @@ exec-sql
2423
REFRESH MATERIALIZED VIEW mv;
2524
----
2625

27-
28-
# Pause the schema change intentionally to refresh a view on mv2
29-
exec-sql
30-
SET CLUSTER SETTING jobs.debug.pausepoints = 'schemachanger.before.exec'
31-
----
32-
33-
34-
exec-sql expect-error-regex=(pq: job \d+ was paused before it completed with reason: pause point "schemachanger.before.exec" hit)
35-
REFRESH MATERIALIZED VIEW mv2;
36-
----
37-
regex matches error
38-
3926
exec-sql
4027
BACKUP INTO 'nodelocal://1/test/'
4128
----

pkg/build/version.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
v26.1.0-alpha.2
1+
v26.1.0-beta.1

0 commit comments

Comments
 (0)