Skip to content

Commit ef049f8

Browse files
craig[bot]tbgmsbutler
committed
150920: mmaprototype: remove unused loadTracker r=tbg a=tbg Epic: CRDB-25222 150921: mmaprototype: remove unused lint suppression r=tbg a=tbg I think these are all used now, and if they're not, I'd like to know. Epic: CRDB-25222 150950: backup: deflake some chaining tests r=jeffswenson a=msbutler Following approach from #150864. Informs #150839 Release note: none Co-authored-by: Tobias Grieger <[email protected]> Co-authored-by: Michael Butler <[email protected]>
4 parents 0e9251d + 6bfcc0a + fc9f116 + dfc2e81 commit ef049f8

File tree

5 files changed

+26
-115
lines changed

5 files changed

+26
-115
lines changed

pkg/backup/create_scheduled_backup_test.go

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -121,8 +121,14 @@ func (h *testHelper) setOverrideAsOfClauseKnob(t *testing.T) {
121121
// We'll be manipulating schedule time via th.env, but we can't fool actual
122122
// backup when it comes to AsOf time. So, override AsOf backup clause to be
123123
// the current time.
124-
h.cfg.TestingKnobs.(*jobs.TestingKnobs).OverrideAsOfClause = func(clause *tree.AsOfClause, _ time.Time) {
125-
expr, err := tree.MakeDTimestampTZ(h.cfg.DB.KV().Clock().PhysicalTime(), time.Microsecond)
124+
h.cfg.TestingKnobs.(*jobs.TestingKnobs).OverrideAsOfClause = func(clause *tree.AsOfClause, statementTime time.Time) {
125+
backupAsOfTime := h.cfg.DB.KV().Clock().PhysicalTime()
126+
if backupAsOfTime.After(statementTime) {
127+
// If the backupAsOfTime is after the statement time, then we use the
128+
// statement time to avoid "AOST in the future" errors.
129+
backupAsOfTime = statementTime
130+
}
131+
expr, err := tree.MakeDTimestampTZ(backupAsOfTime, time.Microsecond)
126132
require.NoError(t, err)
127133
clause.Expr = expr
128134
}

pkg/backup/schedule_pts_chaining_test.go

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -114,8 +114,13 @@ INSERT INTO t values (1), (10), (100);
114114
`)
115115

116116
backupAsOfTimes := make([]time.Time, 0)
117-
th.cfg.TestingKnobs.(*jobs.TestingKnobs).OverrideAsOfClause = func(clause *tree.AsOfClause, _ time.Time) {
117+
th.cfg.TestingKnobs.(*jobs.TestingKnobs).OverrideAsOfClause = func(clause *tree.AsOfClause, statementTime time.Time) {
118118
backupAsOfTime := th.cfg.DB.KV().Clock().PhysicalTime()
119+
if backupAsOfTime.After(statementTime) {
120+
// If the backupAsOfTime is after the statement time, then we use the
121+
// statement time to avoid "AOST in the future" errors.
122+
backupAsOfTime = statementTime
123+
}
119124
expr, err := tree.MakeDTimestampTZ(backupAsOfTime, time.Microsecond)
120125
require.NoError(t, err)
121126
clause.Expr = expr
@@ -241,8 +246,13 @@ INSERT INTO t values (1), (10), (100);
241246
`)
242247

243248
backupAsOfTimes := make([]time.Time, 0)
244-
th.cfg.TestingKnobs.(*jobs.TestingKnobs).OverrideAsOfClause = func(clause *tree.AsOfClause, _ time.Time) {
249+
th.cfg.TestingKnobs.(*jobs.TestingKnobs).OverrideAsOfClause = func(clause *tree.AsOfClause, statementTime time.Time) {
245250
backupAsOfTime := th.cfg.DB.KV().Clock().PhysicalTime()
251+
if backupAsOfTime.After(statementTime) {
252+
// If the backupAsOfTime is after the statement time, then we use the
253+
// statement time to avoid "AOST in the future" errors.
254+
backupAsOfTime = statementTime
255+
}
246256
expr, err := tree.MakeDTimestampTZ(backupAsOfTime, time.Microsecond)
247257
require.NoError(t, err)
248258
clause.Expr = expr
@@ -336,8 +346,13 @@ INSERT INTO t values (1), (10), (100);
336346
`)
337347

338348
backupAsOfTimes := make([]time.Time, 0)
339-
th.cfg.TestingKnobs.(*jobs.TestingKnobs).OverrideAsOfClause = func(clause *tree.AsOfClause, _ time.Time) {
349+
th.cfg.TestingKnobs.(*jobs.TestingKnobs).OverrideAsOfClause = func(clause *tree.AsOfClause, statementTime time.Time) {
340350
backupAsOfTime := th.cfg.DB.KV().Clock().PhysicalTime()
351+
if backupAsOfTime.After(statementTime) {
352+
// If the backupAsOfTime is after the statement time, then we use the
353+
// statement time to avoid "AOST in the future" errors.
354+
backupAsOfTime = statementTime
355+
}
341356
expr, err := tree.MakeDTimestampTZ(backupAsOfTime, time.Microsecond)
342357
require.NoError(t, err)
343358
clause.Expr = expr

pkg/kv/kvserver/allocator/mmaprototype/BUILD.bazel

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ go_library(
1010
"constraint_matcher.go",
1111
"doc.go",
1212
"load.go",
13-
"load_tracker.go",
1413
"memo_helper.go",
1514
"messages.go",
1615
"top_k_replicas.go",

pkg/kv/kvserver/allocator/mmaprototype/load_tracker.go

Lines changed: 0 additions & 91 deletions
This file was deleted.

pkg/kv/kvserver/allocator/mmaprototype/messages.go

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -60,21 +60,3 @@ type RangeMsg struct {
6060
Conf roachpb.SpanConfig
6161
RangeLoad RangeLoad
6262
}
63-
64-
func (rm *RangeMsg) isDeletedRange() bool {
65-
return len(rm.Replicas) == 0
66-
}
67-
68-
// Avoid unused lint errors.
69-
70-
var _ = (&RangeMsg{}).isDeletedRange
71-
var _ = StoreLoadMsg{}.StoreID
72-
var _ = StoreLoadMsg{}.Load
73-
var _ = StoreLoadMsg{}.Capacity
74-
var _ = StoreLoadMsg{}.SecondaryLoad
75-
var _ = StoreLeaseholderMsg{}.StoreID
76-
var _ = StoreLeaseholderMsg{}.Ranges
77-
var _ = RangeMsg{}.RangeID
78-
var _ = RangeMsg{}.Replicas
79-
var _ = RangeMsg{}.Conf
80-
var _ = RangeMsg{}.RangeLoad

0 commit comments

Comments
 (0)