Skip to content

Commit 37de27e

Browse files
craig[bot]msbutlerdtameranimiraradeva
committed
158304: roachtest: beef up jobs/stress roachtest r=dt a=msbutler This patch reconfigures the jobs/stress roachtest logic in a few ways: - now runs on a 20 node cluster in the weekly suite - lowers the base interval to 0.1, to simulate internal job query contention at a 200 node scale - refines the job control loop logic to pause 20% of running changefeeds, resume 20% of paused changefeeds, recreate up to 200 canceled changefeeds, per iteration. - fails the roachtest if a job stays unclaimed for more than 5 minutes. Informs: #158976 Release note: none 160309: backup: include all indexes r=dt a=dt Restore already only restored the public indexes so no changes there. Release note: none. Epic: none. 160642: authors: add amerani to authors r=amerani a=amerani Epic: None Release note: None 160647: kvnemesis: disable SQL ops in safety mode r=stevendanna a=miraradeva Currently, there is a single kvnemesis operation that executes via SQL: `ToggleGlobalReads`. We have seen this operation get stuck and cause the test to timeout under safety more. The expected behavior is that any stuck operations would time out, but it seems like there is a context cancelation propagation issue, most likely in lib/pq, but not confirmed. This commit disables `ToggleGlobalReads` in safety mode to reduce test failures. This change would also help confirm that this is the only operation susceptible to the hanging behavior. Fixes: #160293 Release note: None 160718: sql/tests: use longer stmt timeout in TestRandomSyntaxSQLSmith r=yuzefovich a=yuzefovich Currently all RSG tests use 35s timeout. If a stmt isn't canceled before that, we fail the test, but such a timeout doesn't make it easy to understand whether the stmt was stuck or not. To improve the situation a bit we now give 125s timeout, under the assumptions that goroutine dumps will have 1-2 min blockage making investigations easier. Fixes: #160678. Release note: None 160730: sql: alter type hangs on certain conversion errors r=fqazi a=fqazi Previously, converting invalid text to JSON would lead to the schema changer hanging. This was because the error returned on failed conversion were not marked as user errors. This led to the schema changer retrying them. To address this, this patch labels type conversion errors are user errors. Fixes: #159958 Release note: None 160765: revert "sql: remove gossip-based DistSQL physical planning" r=yuzefovich a=yuzefovich This reverts commit fba7dbf. Currently, using gossip-based planning is the only way of going around #147755. The cost of maintaining this setting is very low, so let's hold off on removal for a little longer. Epic: None Release note: None Co-authored-by: Michael Butler <[email protected]> Co-authored-by: David Taylor <[email protected]> Co-authored-by: Alek Merani <[email protected]> Co-authored-by: Mira Radeva <[email protected]> Co-authored-by: Yahor Yuzefovich <[email protected]> Co-authored-by: Faizan Qazi <[email protected]>
8 parents 10f40a3 + 90b6904 + 8a72774 + 70543b8 + 4eace13 + acbe8dc + 9c1de05 + 0f01b8f commit 37de27e

File tree

11 files changed

+460
-68
lines changed

11 files changed

+460
-68
lines changed

AUTHORS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ Aid Idrizović <[email protected]>
4949
Ajaya Agrawal <[email protected]>
5050
5151
Alan Acosta <[email protected]>
52+
5253
Alex Barganier <[email protected]>
5354
Alex Gaynor <[email protected]>
5455

pkg/backup/backup_job.go

Lines changed: 28 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -982,11 +982,20 @@ func includeTableSpans(table *descpb.TableDescriptor) bool {
982982
return table.IsPhysicalTable()
983983
}
984984

985-
// forEachPublicIndexTableSpan constructs a span for each public index of the
986-
// provided table and runs the given function on each of them. The added map is
987-
// used to track duplicates. Duplicate indexes are not passed to the provided
988-
// function.
989-
func forEachPublicIndexTableSpan(
985+
// forEachIndexTableSpan constructs a span for each index of the provided table
986+
// (including indexes in mutations) and runs the given function on each of them.
987+
// The added map is used to track duplicates. Duplicate indexes are not passed
988+
// to the provided function.
989+
//
990+
// This includes:
991+
// - The primary index
992+
// - Public secondary indexes
993+
// - Indexes in mutations (both ADD and DROP directions)
994+
//
995+
// Including mutation indexes ensures that data written to indexes being built
996+
// (e.g., during CREATE INDEX) is captured incrementally by backup, rather than
997+
// requiring a large catch-up when the index becomes public.
998+
func forEachIndexTableSpan(
990999
table *descpb.TableDescriptor,
9911000
added map[tableAndIndex]bool,
9921001
codec keys.SQLCodec,
@@ -996,15 +1005,25 @@ func forEachPublicIndexTableSpan(
9961005
return
9971006
}
9981007

999-
table.ForEachPublicIndex(func(idx *descpb.IndexDescriptor) {
1008+
addIndex := func(idx *descpb.IndexDescriptor) {
10001009
key := tableAndIndex{tableID: table.GetID(), indexID: idx.ID}
10011010
if added[key] {
10021011
return
10031012
}
10041013
added[key] = true
10051014
prefix := roachpb.Key(rowenc.MakeIndexKeyPrefix(codec, table.GetID(), idx.ID))
10061015
f(roachpb.Span{Key: prefix, EndKey: prefix.PrefixEnd()})
1007-
})
1016+
}
1017+
1018+
// Public indexes (primary + secondary).
1019+
table.ForEachPublicIndex(addIndex)
1020+
1021+
// Indexes in mutations (adding or dropping).
1022+
for i := range table.Mutations {
1023+
if idx := table.Mutations[i].GetIndex(); idx != nil {
1024+
addIndex(idx)
1025+
}
1026+
}
10081027
}
10091028

10101029
// spansForAllTableIndexes returns non-overlapping spans for every index and
@@ -1026,7 +1045,7 @@ func spansForAllTableIndexes(
10261045
}
10271046

10281047
for _, table := range tables {
1029-
forEachPublicIndexTableSpan(table.TableDesc(), added, execCfg.Codec, insertSpan)
1048+
forEachIndexTableSpan(table.TableDesc(), added, execCfg.Codec, insertSpan)
10301049
}
10311050

10321051
// If there are desc revisions, ensure that we also add any index spans
@@ -1039,7 +1058,7 @@ func spansForAllTableIndexes(
10391058
// entire interval. DROPPED tables should never later become PUBLIC.
10401059
rawTbl, _, _, _, _ := descpb.GetDescriptors(rev.Desc)
10411060
if rawTbl != nil && rawTbl.Public() {
1042-
forEachPublicIndexTableSpan(rawTbl, added, execCfg.Codec, insertSpan)
1061+
forEachIndexTableSpan(rawTbl, added, execCfg.Codec, insertSpan)
10431062
}
10441063
}
10451064

pkg/backup/backup_test.go

Lines changed: 22 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -6187,9 +6187,9 @@ func getMockTableDesc(
61876187
return tabledesc.NewBuilder(&mockTableDescriptor).BuildImmutableTable()
61886188
}
61896189

6190-
// Unit tests for the spansForAllTableIndexes and forEachPublicIndexTableSpan()
6190+
// Unit tests for the spansForAllTableIndexes and forEachIndexTableSpan()
61916191
// methods.
6192-
func TestPublicIndexTableSpans(t *testing.T) {
6192+
func TestIndexTableSpans(t *testing.T) {
61936193
defer leaktest.AfterTest(t)()
61946194

61956195
testCases := []struct {
@@ -6211,15 +6211,17 @@ func TestPublicIndexTableSpans(t *testing.T) {
62116211
expectedMergedSpans: []string{"/Table/55/{1-3}"},
62126212
},
62136213
{
6214-
name: "dropped-span-between-two-spans",
6214+
// Dropping index 2 is now included, so spans are contiguous.
6215+
name: "dropping-span-between-two-spans",
62156216
tableID: 56,
62166217
pkIndex: getMockIndexDesc(1),
62176218
indexes: []descpb.IndexDescriptor{getMockIndexDesc(1), getMockIndexDesc(3)},
62186219
droppingIndexes: []descpb.IndexDescriptor{getMockIndexDesc(2)},
6219-
expectedSpans: []string{"/Table/56/{1-2}", "/Table/56/{3-4}"},
6220-
expectedMergedSpans: []string{"/Table/56/{1-2}", "/Table/56/{3-4}"},
6220+
expectedSpans: []string{"/Table/56/{1-2}", "/Table/56/{3-4}", "/Table/56/{2-3}"},
6221+
expectedMergedSpans: []string{"/Table/56/{1-4}"},
62216222
},
62226223
{
6224+
// No mutations, gap remains.
62236225
name: "gced-span-between-two-spans",
62246226
tableID: 57,
62256227
pkIndex: getMockIndexDesc(1),
@@ -6228,18 +6230,20 @@ func TestPublicIndexTableSpans(t *testing.T) {
62286230
expectedMergedSpans: []string{"/Table/57/{1-2}", "/Table/57/{3-4}"},
62296231
},
62306232
{
6231-
name: "alternate-spans-dropped",
6233+
// Dropping indexes 2 and 4 are now included, filling the gaps.
6234+
name: "alternate-spans-dropping",
62326235
tableID: 58,
62336236
pkIndex: getMockIndexDesc(1),
62346237
indexes: []descpb.IndexDescriptor{
62356238
getMockIndexDesc(1), getMockIndexDesc(3),
62366239
getMockIndexDesc(5),
62376240
},
62386241
droppingIndexes: []descpb.IndexDescriptor{getMockIndexDesc(2), getMockIndexDesc(4)},
6239-
expectedSpans: []string{"/Table/58/{1-2}", "/Table/58/{3-4}", "/Table/58/{5-6}"},
6240-
expectedMergedSpans: []string{"/Table/58/{1-2}", "/Table/58/{3-4}", "/Table/58/{5-6}"},
6242+
expectedSpans: []string{"/Table/58/{1-2}", "/Table/58/{3-4}", "/Table/58/{5-6}", "/Table/58/{2-3}", "/Table/58/{4-5}"},
6243+
expectedMergedSpans: []string{"/Table/58/{1-6}"},
62416244
},
62426245
{
6246+
// No mutations, gaps remain.
62436247
name: "alternate-spans-gced",
62446248
tableID: 59,
62456249
pkIndex: getMockIndexDesc(1),
@@ -6251,6 +6255,7 @@ func TestPublicIndexTableSpans(t *testing.T) {
62516255
expectedMergedSpans: []string{"/Table/59/{1-2}", "/Table/59/{3-4}", "/Table/59/{5-6}"},
62526256
},
62536257
{
6258+
// Dropping index 2 fills the gap between 1 and 3, but gap at 4 remains.
62546259
name: "one-drop-one-gc",
62556260
tableID: 60,
62566261
pkIndex: getMockIndexDesc(1),
@@ -6259,22 +6264,22 @@ func TestPublicIndexTableSpans(t *testing.T) {
62596264
getMockIndexDesc(5),
62606265
},
62616266
droppingIndexes: []descpb.IndexDescriptor{getMockIndexDesc(2)},
6262-
expectedSpans: []string{"/Table/60/{1-2}", "/Table/60/{3-4}", "/Table/60/{5-6}"},
6263-
expectedMergedSpans: []string{"/Table/60/{1-2}", "/Table/60/{3-4}", "/Table/60/{5-6}"},
6267+
expectedSpans: []string{"/Table/60/{1-2}", "/Table/60/{3-4}", "/Table/60/{5-6}", "/Table/60/{2-3}"},
6268+
expectedMergedSpans: []string{"/Table/60/{1-4}", "/Table/60/{5-6}"},
62646269
},
62656270
{
6266-
// Although there are no keys on index 2, we should not include its
6267-
// span since it holds an adding index.
6268-
name: "empty-adding-index",
6271+
// Adding index 2 is now included, filling the gap. This ensures data
6272+
// written during index build is captured incrementally by backup.
6273+
name: "adding-index-included",
62696274
tableID: 61,
62706275
pkIndex: getMockIndexDesc(1),
62716276
indexes: []descpb.IndexDescriptor{
62726277
getMockIndexDesc(1), getMockIndexDesc(3),
62736278
getMockIndexDesc(4),
62746279
},
62756280
addingIndexes: []descpb.IndexDescriptor{getMockIndexDesc(2)},
6276-
expectedSpans: []string{"/Table/61/{1-2}", "/Table/61/{3-4}", "/Table/61/{4-5}"},
6277-
expectedMergedSpans: []string{"/Table/61/{1-2}", "/Table/61/{3-5}"},
6281+
expectedSpans: []string{"/Table/61/{1-2}", "/Table/61/{3-4}", "/Table/61/{4-5}", "/Table/61/{2-3}"},
6282+
expectedMergedSpans: []string{"/Table/61/{1-5}"},
62786283
},
62796284
}
62806285

@@ -6299,9 +6304,9 @@ func TestPublicIndexTableSpans(t *testing.T) {
62996304
for _, test := range testCases {
63006305
tableDesc := getMockTableDesc(test.tableID, test.pkIndex,
63016306
test.indexes, test.addingIndexes, test.droppingIndexes)
6302-
t.Run(fmt.Sprintf("%s:%s", "forEachPublicIndexTableSpan", test.name), func(t *testing.T) {
6307+
t.Run(fmt.Sprintf("%s:%s", "forEachIndexTableSpan", test.name), func(t *testing.T) {
63036308
var spans []roachpb.Span
6304-
forEachPublicIndexTableSpan(tableDesc.TableDesc(), unusedMap, codec, func(sp roachpb.Span) {
6309+
forEachIndexTableSpan(tableDesc.TableDesc(), unusedMap, codec, func(sp roachpb.Span) {
63056310
spans = append(spans, sp)
63066311
})
63076312
var unmergedSpans []string

0 commit comments

Comments
 (0)