Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ttl: replace SPLIT AT with SplitTable in tests #86349

Merged
merged 1 commit into from
Aug 18, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions pkg/sql/exec_util.go
Original file line number Diff line number Diff line change
Expand Up @@ -1566,9 +1566,9 @@ type TTLTestingKnobs struct {
// AOSTDuration changes the AOST timestamp duration to add to the
// current time.
AOSTDuration *time.Duration
// RequireMultipleSpanPartitions is a flag to verify that the DistSQL will
// distribute the work across multiple nodes.
RequireMultipleSpanPartitions bool
// ExpectedNumSpanPartitions causes the TTL job to fail if it does not match
// the number of DistSQL processors.
ExpectedNumSpanPartitions int
// ReturnStatsError causes stats errors to be returned instead of logged as
// warnings.
ReturnStatsError bool
Expand Down
11 changes: 9 additions & 2 deletions pkg/sql/ttl/ttljob/ttljob.go
Original file line number Diff line number Diff line change
Expand Up @@ -214,8 +214,15 @@ func (t rowLevelTTLResumer) Resume(ctx context.Context, execCtx interface{}) err
if err != nil {
return err
}
if knobs.RequireMultipleSpanPartitions && len(spanPartitions) == 0 {
return errors.New("multiple span partitions required")
expectedNumSpanPartitions := knobs.ExpectedNumSpanPartitions
if expectedNumSpanPartitions != 0 {
actualNumSpanPartitions := len(spanPartitions)
if expectedNumSpanPartitions != actualNumSpanPartitions {
return errors.AssertionFailedf(
"incorrect number of span partitions expected=%d actual=%d",
expectedNumSpanPartitions, actualNumSpanPartitions,
)
}
}

sqlInstanceIDToTTLSpec := make(map[base.SQLInstanceID]*execinfrapb.TTLSpec)
Expand Down
5 changes: 3 additions & 2 deletions pkg/sql/ttl/ttljob/ttljob_processor.go
Original file line number Diff line number Diff line change
Expand Up @@ -233,8 +233,9 @@ func (ttl *ttlProcessor) work(ctx context.Context) error {
true, /* useReadLock */
func(_ *kv.Txn, md jobs.JobMetadata, ju *jobs.JobUpdater) error {
progress := md.Progress
existingRowCount := progress.Details.(*jobspb.Progress_RowLevelTTL).RowLevelTTL.RowCount
progress.Details.(*jobspb.Progress_RowLevelTTL).RowLevelTTL.RowCount += processorRowCount
rowLevelTTL := progress.Details.(*jobspb.Progress_RowLevelTTL).RowLevelTTL
existingRowCount := rowLevelTTL.RowCount
rowLevelTTL.RowCount += processorRowCount
ju.UpdateProgress(progress)
log.VInfof(
ctx,
Expand Down
Loading