-
Notifications
You must be signed in to change notification settings - Fork 3.9k
/
Copy pathretry_jobs_with_exponential_backoff_external_test.go
639 lines (606 loc) · 22 KB
/
retry_jobs_with_exponential_backoff_external_test.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
// Copyright 2021 The Cockroach Authors.
//
// Use of this software is governed by the Business Source License
// included in the file licenses/BSL.txt.
//
// As of the Change Date specified in that file, in accordance with
// the Business Source License, use of this software will be governed
// by the Apache License, Version 2.0, included in the file
// licenses/APL.txt.
package migrations_test
import (
"context"
"regexp"
"strings"
"sync/atomic"
"testing"
"time"
"github.com/cockroachdb/cockroach/pkg/base"
"github.com/cockroachdb/cockroach/pkg/clusterversion"
"github.com/cockroachdb/cockroach/pkg/jobs"
"github.com/cockroachdb/cockroach/pkg/jobs/jobspb"
"github.com/cockroachdb/cockroach/pkg/keys"
"github.com/cockroachdb/cockroach/pkg/kv"
"github.com/cockroachdb/cockroach/pkg/migration"
"github.com/cockroachdb/cockroach/pkg/migration/migrations"
"github.com/cockroachdb/cockroach/pkg/security"
"github.com/cockroachdb/cockroach/pkg/server"
"github.com/cockroachdb/cockroach/pkg/sql/catalog/descpb"
"github.com/cockroachdb/cockroach/pkg/sql/catalog/systemschema"
"github.com/cockroachdb/cockroach/pkg/sql/catalog/tabledesc"
"github.com/cockroachdb/cockroach/pkg/sql/privilege"
"github.com/cockroachdb/cockroach/pkg/sql/types"
"github.com/cockroachdb/cockroach/pkg/testutils"
"github.com/cockroachdb/cockroach/pkg/testutils/serverutils"
"github.com/cockroachdb/cockroach/pkg/testutils/sqlutils"
"github.com/cockroachdb/cockroach/pkg/testutils/testcluster"
"github.com/cockroachdb/cockroach/pkg/util/leaktest"
"github.com/cockroachdb/cockroach/pkg/util/log"
"github.com/cockroachdb/errors"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
)
// Target schema changes in the system.jobs table of the RetryJobsWithExponentialBackoff migration.
const (
addColsQuery = `
ALTER TABLE system.jobs
ADD COLUMN num_runs INT8 FAMILY claim,
ADD COLUMN last_run TIMESTAMP FAMILY claim`
addIndexQuery = `
CREATE INDEX jobs_run_stats_idx
ON system.jobs (claim_session_id, status, created)
STORING (last_run, num_runs, claim_instance_id)
WHERE ` + systemschema.JobsRunStatsIdxPredicate
)
// TestExponentialBackoffMigration tests modification of system.jobs table
// during migration. It does not test the migration success during failures.
func TestExponentialBackoffMigration(t *testing.T) {
defer leaktest.AfterTest(t)()
defer log.Scope(t).Close(t)
clusterArgs := base.TestClusterArgs{
ServerArgs: base.TestServerArgs{
Knobs: base.TestingKnobs{
Server: &server.TestingKnobs{
DisableAutomaticVersionUpgrade: 1,
BinaryVersionOverride: clusterversion.ByKey(
clusterversion.RetryJobsWithExponentialBackoff - 1),
},
JobsTestingKnobs: jobs.NewTestingKnobsWithShortIntervals(),
},
},
}
ctx := context.Background()
tc := testcluster.StartTestCluster(t, 1, clusterArgs)
defer tc.Stopper().Stop(ctx)
s := tc.Server(0)
sqlDB := tc.ServerConn(0)
tdb := sqlutils.MakeSQLRunner(sqlDB)
var (
validationStmts = []string{
"SELECT last_run, num_runs FROM system.jobs LIMIT 0",
"SELECT num_runs, last_run, claim_instance_id from system.jobs@jobs_run_stats_idx LIMIT 0",
}
validationSchemas = []migrations.Schema{
{Name: "num_runs", ValidationFn: migrations.HasColumn},
{Name: "last_run", ValidationFn: migrations.HasColumn},
{Name: "jobs_run_stats_idx", ValidationFn: migrations.HasIndex},
}
)
// Inject the old copy of the descriptor.
migrations.InjectLegacyTable(ctx, t, s, systemschema.JobsTable, getDeprecatedJobsDescriptor)
// Validate that the jobs-table has old schema.
migrations.ValidateSchemaExists(
ctx,
t,
s,
sqlDB,
keys.JobsTableID,
systemschema.JobsTable,
validationStmts,
validationSchemas,
false, /* expectExists */
)
// Run the migration.
migrations.Migrate(
t,
sqlDB,
clusterversion.RetryJobsWithExponentialBackoff,
nil, /* done */
false, /* expectError */
)
// Validate that the jobs table has new schema.
migrations.ValidateSchemaExists(
ctx,
t,
s,
sqlDB,
keys.JobsTableID,
systemschema.JobsTable,
validationStmts,
validationSchemas,
true, /* expectExists */
)
// Make sure that jobs work by running a job.
runGcJob(t, tdb)
}
type updateEvent struct {
orig, updated jobs.JobMetadata
errChan chan error
}
// TestMigrationWithFailures tests modification of system.jobs table during
// migration with different failures. It tests the system behavior with failure
// combinations of the migration job and schema-change jobs at different stages
// in their progress.
func TestMigrationWithFailures(t *testing.T) {
defer leaktest.AfterTest(t)()
defer log.Scope(t).Close(t)
// The tests follows the following procedure.
//
// Inject the old table descriptor and ensure that the system is using the
// deprecated jobs-table.
//
// Start migration, which initiates two schema-change jobs one by one. Test
// the system for each schema-change job separately. Later on, we inject
// failure in this migration, causing it to fail.
//
// Depending on the test setting, intercept the target schema-change job,
// preventing the job from progressing. We may cancel this schema-change or
// let it succeed to test different scenarios.
//
// Cancel the migration, causing the migration to revert and fail.
//
// Wait for the canceled migration-job to finish, expecting its failure. The
// schema-change job is still not progressing to control what the restarted
// migration will observe.
//
// Restart the migration, expecting it to succeed. Depending on the test setting,
// the intercepted schema-change job may wail for the migration job to resume.
// If it does, the migration job is expected to observe the ongoing schema-change.
// The ongoing schema-change is canceled or not, depending on the test case.
// In either case, we expect the correct number of mutations to be skipped
// during the migration.
//
// If we canceled the schema-job, expect it to rerun
// as part of the migration. Otherwise, expect the schema-change to be ignored
// during the migration.
//
// Finally, we validate that the schema changes are in effect by reading the new
// columns and the index, and by running a job that is failed and retried to
// practice exponential-backoff machinery.
for _, test := range []struct {
// Test identifier.
name string
// Job status when the job is intercepted while transitioning to the intercepted status.
query string
// Whether the schema-change job should wait for the migration to restart
// after failure before proceeding.
waitForMigrationRestart bool
// Cancel the intercepted schema-change to inject a failure during migration.
cancelSchemaJob bool
// Expected number of schema-changes that are skipped during migration.
expectedSkipped int
}{
{
name: "adding columns",
query: addColsQuery,
waitForMigrationRestart: false, // Does not matter.
cancelSchemaJob: false, // Does not matter.
expectedSkipped: 0, // Will be ignored.
},
{
name: "adding index",
query: addIndexQuery,
waitForMigrationRestart: false, // Does not matter.
cancelSchemaJob: false, // Does not matter.
expectedSkipped: 0, // Will be ignored.
},
{
name: "fail adding columns",
query: addColsQuery,
waitForMigrationRestart: true, // Need to wait to observe failing schema change.
cancelSchemaJob: true, // To fail adding columns.
expectedSkipped: 0,
},
{
name: "fail adding index",
query: addIndexQuery,
waitForMigrationRestart: true, // Need to wait to observe failing schema change.
cancelSchemaJob: true, // To fail adding index.
expectedSkipped: 1, // Columns must not be added again.
},
{
name: "skip none",
query: addColsQuery,
waitForMigrationRestart: true, // Need to wait to observe schema change and have correct expectedSkipped count.
cancelSchemaJob: true, // To fail adding index and skip adding column.
expectedSkipped: 0, // Both columns and index must be added.
},
{
name: "skip adding columns",
query: addIndexQuery,
waitForMigrationRestart: true, // Need to wait to observe schema change and have correct expectedSkipped count.
cancelSchemaJob: true, // To fail adding index and skip adding column.
expectedSkipped: 1, // Columns must not be added again.
},
{
name: "skip adding columns and index",
query: addIndexQuery,
waitForMigrationRestart: true, // Need to wait to observe schema change and have correct expectedSkipped count.
cancelSchemaJob: false, // To fail adding index and skip adding column.
expectedSkipped: 2, // Both columns and index must not be added again.
},
} {
t.Run(test.name, func(t *testing.T) {
ctx := context.Background()
// To intercept the schema-change and the migration job.
updateEventChan := make(chan updateEvent)
beforeUpdate := func(orig, updated jobs.JobMetadata) error {
ue := updateEvent{
orig: orig,
updated: updated,
errChan: make(chan error),
}
updateEventChan <- ue
return <-ue.errChan
}
var schemaEvent updateEvent
migrationWaitCh := make(chan struct{})
beforeMutationWait := func(jobID jobspb.JobID) {
if !test.waitForMigrationRestart || jobID != schemaEvent.orig.ID {
return
}
migrationWaitCh <- struct{}{}
}
// Number of schema-change jobs that are skipped.
skippedCnt := int32(0)
ignoredMutationObserver := func() {
atomic.AddInt32(&skippedCnt, 1)
}
shortInterval := 2 * time.Millisecond
clusterArgs := base.TestClusterArgs{
ServerArgs: base.TestServerArgs{
Knobs: base.TestingKnobs{
Server: &server.TestingKnobs{
DisableAutomaticVersionUpgrade: 1,
BinaryVersionOverride: clusterversion.ByKey(
clusterversion.RetryJobsWithExponentialBackoff - 1),
},
JobsTestingKnobs: &jobs.TestingKnobs{
IntervalOverrides: jobs.TestingIntervalOverrides{
Adopt: &shortInterval,
Cancel: &shortInterval,
},
BeforeUpdate: beforeUpdate,
},
MigrationManager: &migration.TestingKnobs{
BeforeWaitInRetryJobsWithExponentialBackoffMigration: beforeMutationWait,
SkippedMutation: ignoredMutationObserver,
},
},
},
}
tc := testcluster.StartTestCluster(t, 1, clusterArgs)
defer tc.Stopper().Stop(ctx)
s := tc.Server(0)
sqlDB := tc.ServerConn(0)
tdb := sqlutils.MakeSQLRunner(sqlDB)
tdb.Exec(t, "SET CLUSTER SETTING jobs.registry.interval.gc = '2ms'")
// Inject the old copy of the descriptor.
migrations.InjectLegacyTable(ctx, t, s, systemschema.JobsTable, getDeprecatedJobsDescriptor)
// Validate that the jobs-table has old schema.
var (
validationStmts = []string{
"SELECT last_run, num_runs FROM system.jobs LIMIT 0",
"SELECT num_runs, last_run, claim_instance_id from system.jobs@jobs_run_stats_idx LIMIT 0",
}
validationSchemas = []migrations.Schema{
{Name: "num_runs", ValidationFn: migrations.HasColumn},
{Name: "last_run", ValidationFn: migrations.HasColumn},
{Name: "jobs_run_stats_idx", ValidationFn: migrations.HasIndex},
}
)
migrations.ValidateSchemaExists(
ctx,
t,
s,
sqlDB,
keys.JobsTableID,
systemschema.JobsTable,
validationStmts,
validationSchemas,
false, /* expectExists */
)
// Run the migration, expecting failure.
t.Log("trying migration, expecting to fail")
// Channel to wait for the migration job to complete.
finishChan := make(chan struct{})
go migrations.Migrate(t, sqlDB, clusterversion.RetryJobsWithExponentialBackoff, finishChan, true /* expectError */)
var migJobID jobspb.JobID
// Intercept the target schema-change job and get migration-job's ID.
t.Log("intercepting the schema job")
for {
e := <-updateEventChan
// The migration job creates schema-change jobs. Therefore, we are guaranteed
// to get the migration-job's ID before canceling the job later on.
if e.orig.Payload.Type() == jobspb.TypeMigration {
migJobID = e.orig.ID
e.errChan <- nil
continue
}
schemaQuery := strings.Replace(e.orig.Payload.Description, "system.public.jobs", "system.jobs", -1)
testQuery := removeSpaces(test.query)
testQuery = strings.ReplaceAll(testQuery, ":::STRING", "")
if testQuery == schemaQuery {
// Intercepted the target schema-change.
schemaEvent = e
t.Logf("intercepted schema change job: %v", e.orig.ID)
break
}
// Ignore all other job updates.
e.errChan <- nil
}
// Cancel the migration job.
t.Log("canceling the migration job")
go cancelJob(t, ctx, s, migJobID)
// Wait for the migration job to finish while preventing the intercepted
// schema-change job from progressing.
t.Log("waiting for the migration job to finish.")
testutils.SucceedsSoon(t, func() error {
for {
select {
case <-finishChan:
return nil
case e := <-updateEventChan:
e.errChan <- nil
default:
return errors.Errorf("waiting for the migration job to finish.")
}
}
})
// Channel to finish the goroutine when the test completes.
done := make(chan struct{})
// Let all jobs to continue until test's completion, except the intercepted
// schema-change job that we resume later on.
go func() {
for {
select {
case e := <-updateEventChan:
e.errChan <- nil
case <-done:
return
}
}
}()
// Restart the migration job.
t.Log("retrying migration, expecting to succeed")
go migrations.Migrate(t, sqlDB, clusterversion.RetryJobsWithExponentialBackoff, finishChan, false /* expectError */)
// Wait until the new migration job observes an existing mutation job.
if test.waitForMigrationRestart {
t.Log("waiting for the migration job to observe a mutation")
<-migrationWaitCh
}
t.Log("resuming the schema change job")
// If configured so, mark the schema-change job to cancel.
if test.cancelSchemaJob {
cancelJob(t, ctx, s, schemaEvent.orig.ID)
}
// Resume the schema-change job and all other jobs.
schemaEvent.errChan <- nil
// If canceled the job, wait for the job to finish.
if test.cancelSchemaJob {
t.Log("waiting for the schema job to reach the cancel status")
waitUntilState(t, tdb, schemaEvent.orig.ID, jobs.StatusCanceled)
}
// Wait for the migration to complete, expecting success.
t.Logf("waiting for the new migration job to complete.")
testutils.SucceedsSoon(t, func() error {
select {
case <-finishChan:
return nil
default:
}
return errors.Errorf("waiting for the migration job to finish.")
})
if test.waitForMigrationRestart {
// Ensure that we have observed the expected number of ignored schema change jobs.
require.Equal(t, int32(test.expectedSkipped), atomic.LoadInt32(&skippedCnt))
}
// Validate that the jobs table has new schema.
migrations.ValidateSchemaExists(
ctx,
t,
s,
sqlDB,
keys.JobsTableID,
systemschema.JobsTable,
validationStmts,
validationSchemas,
true, /* expectExists */
)
done <- struct{}{}
validateJobRetries(t, tdb, updateEventChan)
})
}
}
// cancelJob marks the given job as cancel-requested, leading the job to be
// canceled.
func cancelJob(
t *testing.T, ctx context.Context, s serverutils.TestServerInterface, jobID jobspb.JobID,
) {
err := s.DB().Txn(ctx, func(ctx context.Context, txn *kv.Txn) error {
// Using this way of canceling because the migration job us non-cancelable.
// Canceling in this way skips the check.
return s.JobRegistry().(*jobs.Registry).UpdateJobWithTxn(
ctx, jobID, txn, false /* useReadLock */, func(txn *kv.Txn, md jobs.JobMetadata, ju *jobs.JobUpdater,
) error {
ju.UpdateStatus(jobs.StatusCancelRequested)
return nil
})
})
assert.NoError(t, err)
}
// waitUntilState waits until the specified job reaches to given state.
func waitUntilState(
t *testing.T, tdb *sqlutils.SQLRunner, jobID jobspb.JobID, expectedStatus jobs.Status,
) {
testutils.SucceedsSoon(t, func() error {
var status jobs.Status
tdb.QueryRow(t,
"SELECT status FROM system.jobs WHERE id = $1", jobID,
).Scan(&status)
if status == expectedStatus {
return nil
}
return errors.Errorf(
"waiting for job %v to reach status %v, current status is %v",
jobID, expectedStatus, status)
})
}
// runGcJob creates and alters a dummy table to trigger jobs machinery,
// which validates its working.
func runGcJob(t *testing.T, tdb *sqlutils.SQLRunner) {
tdb.Exec(t, "CREATE TABLE foo (i INT PRIMARY KEY)")
tdb.Exec(t, "ALTER TABLE foo CONFIGURE ZONE USING gc.ttlseconds = 1;")
tdb.Exec(t, "DROP TABLE foo CASCADE;")
var jobID int64
tdb.QueryRow(t, `
SELECT job_id
FROM [SHOW JOBS]
WHERE job_type = 'SCHEMA CHANGE GC' AND description LIKE '%foo%';`,
).Scan(&jobID)
var status jobs.Status
tdb.QueryRow(t,
"SELECT status FROM [SHOW JOB WHEN COMPLETE $1]", jobID,
).Scan(&status)
require.Equal(t, jobs.StatusSucceeded, status)
}
func validateJobRetries(t *testing.T, tdb *sqlutils.SQLRunner, eventCh chan updateEvent) {
tdb.Exec(t, "SET CLUSTER SETTING jobs.registry.retry.initial_delay = '2ms'")
tdb.Exec(t, "SET CLUSTER SETTING jobs.registry.retry.max_delay = '10ms'")
done := make(chan struct{})
go func() {
// Fail a GC job once and then let it succeed.
var failed atomic.Value
failed.Store(false)
var ev updateEvent
for {
// eventCh receives events in the BeforeUpdate hook.
select {
case ev = <-eventCh:
case <-done:
return
}
// If not a schema-change GC job, let it run.
if ev.orig.Payload.Type() != jobspb.TypeSchemaChangeGC {
ev.errChan <- nil
continue
}
if ev.updated.Status == jobs.StatusSucceeded {
// If the job is succeeding, it must have been retried once, and the
// the number of retries is populated from the jobs table.
assert.Equal(t, 1, ev.orig.RunStats.NumRuns)
}
if failed.Load().(bool) ||
ev.updated.Status != jobs.StatusRunning {
ev.errChan <- nil
continue
}
failed.Store(true)
ev.errChan <- jobs.MarkAsRetryJobError(errors.New("failing job to retry"))
}
}()
runGcJob(t, tdb)
done <- struct{}{}
}
func removeSpaces(stmt string) string {
stmt = strings.TrimSpace(regexp.MustCompile(`(\s+|;+)`).ReplaceAllString(stmt, " "))
stmt = strings.ReplaceAll(stmt, "( ", "(")
stmt = strings.ReplaceAll(stmt, " )", ")")
return stmt
}
// getDeprecatedJobsDescriptor returns the system.jobs table descriptor that was being used
// before adding two new columns and an index in the current version.
func getDeprecatedJobsDescriptor() *descpb.TableDescriptor {
uniqueRowIDString := "unique_rowid()"
nowString := "now():::TIMESTAMP"
pk := func(name string) descpb.IndexDescriptor {
return descpb.IndexDescriptor{
Name: tabledesc.PrimaryKeyIndexName,
ID: 1,
Unique: true,
KeyColumnNames: []string{name},
KeyColumnDirections: []descpb.IndexDescriptor_Direction{descpb.IndexDescriptor_ASC},
KeyColumnIDs: []descpb.ColumnID{1},
}
}
return &descpb.TableDescriptor{
Name: "jobs",
ID: keys.JobsTableID,
ParentID: keys.SystemDatabaseID,
UnexposedParentSchemaID: keys.PublicSchemaID,
Version: 1,
Columns: []descpb.ColumnDescriptor{
{Name: "id", ID: 1, Type: types.Int, DefaultExpr: &uniqueRowIDString},
{Name: "status", ID: 2, Type: types.String},
{Name: "created", ID: 3, Type: types.Timestamp, DefaultExpr: &nowString},
{Name: "payload", ID: 4, Type: types.Bytes},
{Name: "progress", ID: 5, Type: types.Bytes, Nullable: true},
{Name: "created_by_type", ID: 6, Type: types.String, Nullable: true},
{Name: "created_by_id", ID: 7, Type: types.Int, Nullable: true},
{Name: "claim_session_id", ID: 8, Type: types.Bytes, Nullable: true},
{Name: "claim_instance_id", ID: 9, Type: types.Int, Nullable: true},
},
NextColumnID: 10,
Families: []descpb.ColumnFamilyDescriptor{
{
Name: "fam_0_id_status_created_payload",
ID: 0,
ColumnNames: []string{"id", "status", "created", "payload", "created_by_type", "created_by_id"},
ColumnIDs: []descpb.ColumnID{1, 2, 3, 4, 6, 7},
},
{
Name: "progress",
ID: 1,
ColumnNames: []string{"progress"},
ColumnIDs: []descpb.ColumnID{5},
DefaultColumnID: 5,
},
{
Name: "claim",
ID: 2,
ColumnNames: []string{"claim_session_id", "claim_instance_id"},
ColumnIDs: []descpb.ColumnID{8, 9},
},
},
NextFamilyID: 3,
PrimaryIndex: pk("id"),
Indexes: []descpb.IndexDescriptor{
{
Name: "jobs_status_created_idx",
ID: 2,
Unique: false,
KeyColumnNames: []string{"status", "created"},
KeyColumnDirections: []descpb.IndexDescriptor_Direction{descpb.IndexDescriptor_ASC, descpb.IndexDescriptor_ASC},
KeyColumnIDs: []descpb.ColumnID{2, 3},
KeySuffixColumnIDs: []descpb.ColumnID{1},
Version: descpb.StrictIndexColumnIDGuaranteesVersion,
},
{
Name: "jobs_created_by_type_created_by_id_idx",
ID: 3,
Unique: false,
KeyColumnNames: []string{"created_by_type", "created_by_id"},
KeyColumnDirections: []descpb.IndexDescriptor_Direction{descpb.IndexDescriptor_ASC, descpb.IndexDescriptor_ASC},
KeyColumnIDs: []descpb.ColumnID{6, 7},
StoreColumnIDs: []descpb.ColumnID{2},
StoreColumnNames: []string{"status"},
KeySuffixColumnIDs: []descpb.ColumnID{1},
Version: descpb.StrictIndexColumnIDGuaranteesVersion,
},
},
NextIndexID: 4,
Privileges: descpb.NewCustomSuperuserPrivilegeDescriptor(privilege.ReadWriteData, security.NodeUserName()),
FormatVersion: descpb.InterleavedFormatVersion,
NextMutationID: 1,
}
}