-
Notifications
You must be signed in to change notification settings - Fork 3.9k
/
Copy pathmvcc_statistics_update_job.go
53 lines (44 loc) · 1.26 KB
/
mvcc_statistics_update_job.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
package sql
import (
"context"
"github.com/cockroachdb/cockroach/pkg/jobs"
"github.com/cockroachdb/cockroach/pkg/jobs/jobspb"
"github.com/cockroachdb/cockroach/pkg/settings/cluster"
"github.com/cockroachdb/cockroach/pkg/util/log"
"github.com/cockroachdb/errors"
)
type mvccStatisticsUpdateJob struct {
job *jobs.Job
}
var _ jobs.Resumer = (*mvccStatisticsUpdateJob)(nil)
func (j *mvccStatisticsUpdateJob) Resume(
ctx context.Context, execCtxI interface{},
) (jobErr error) {
// TODO(zachlite):
// Delete samples older than configurable setting...
// Collect span stats for tenant descriptors...
// Write new samples...
return nil
}
func (j *mvccStatisticsUpdateJob) OnFailOrCancel(
ctx context.Context, _ interface{}, jobErr error,
) error {
if jobs.HasErrJobCanceled(jobErr) {
err := errors.NewAssertionErrorWithWrappedErrf(
jobErr, "mvcc statistics update job is not cancelable",
)
log.Errorf(ctx, "%v", err)
}
return nil
}
func (j *mvccStatisticsUpdateJob) CollectProfile(_ context.Context, _ interface{}) error {
return nil
}
func init() {
jobs.RegisterConstructor(jobspb.TypeMVCCStatisticsUpdate,
func(job *jobs.Job, settings *cluster.Settings) jobs.Resumer {
return &mvccStatisticsUpdateJob{job: job}
},
jobs.DisablesTenantCostControl,
)
}