Skip to content

Commit ade0d13

Browse files
committed
changefeedccl: avoid creating checkpoint string all the time
This patch modifies the changefeed job progress saving code so that we only create a string for a span-level checkpoint when we actually need it for logging. Release note: None
1 parent 1dcc89f commit ade0d13

File tree

1 file changed

+10
-6
lines changed

1 file changed

+10
-6
lines changed

pkg/ccl/changefeedccl/changefeed_processors.go

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1846,7 +1846,8 @@ func (cf *changeFrontier) checkpointJobProgress(
18461846
cf.metrics.FrontierUpdates.Inc(1)
18471847
if cf.js.job != nil {
18481848
var ptsUpdated bool
1849-
var checkpointStr string
1849+
//lint:ignore SA1019 deprecated usage
1850+
var legacyCheckpoint *jobspb.ChangefeedProgress_Checkpoint
18501851
if err := cf.js.job.DebugNameNoTxn(changefeedJobProgressTxnName).Update(cf.Ctx(), func(
18511852
txn isql.Txn, md jobs.JobMetadata, ju *jobs.JobUpdater,
18521853
) error {
@@ -1864,11 +1865,9 @@ func (cf *changeFrontier) checkpointJobProgress(
18641865
changefeedProgress := progress.Details.(*jobspb.Progress_Changefeed).Changefeed
18651866
if cv.IsActive(cf.Ctx(), clusterversion.V25_2) {
18661867
changefeedProgress.SpanLevelCheckpoint = spanLevelCheckpoint
1867-
checkpointStr = spanLevelCheckpoint.String()
18681868
} else {
1869-
legacyCheckpoint := checkpoint.ConvertToLegacyCheckpoint(spanLevelCheckpoint)
1869+
legacyCheckpoint = checkpoint.ConvertToLegacyCheckpoint(spanLevelCheckpoint)
18701870
changefeedProgress.Checkpoint = legacyCheckpoint
1871-
checkpointStr = legacyCheckpoint.String()
18721871
}
18731872

18741873
if ptsUpdated, err = cf.manageProtectedTimestamps(ctx, txn, changefeedProgress); err != nil {
@@ -1890,8 +1889,13 @@ func (cf *changeFrontier) checkpointJobProgress(
18901889
cf.lastProtectedTimestampUpdate = timeutil.Now()
18911890
}
18921891
if log.V(2) {
1893-
log.Infof(cf.Ctx(), "change frontier persisted highwater=%s and checkpoint=%s",
1894-
frontier, checkpointStr)
1892+
if cv.IsActive(cf.Ctx(), clusterversion.V25_2) {
1893+
log.Infof(cf.Ctx(), "change frontier persisted highwater=%s and checkpoint=%s",
1894+
frontier, spanLevelCheckpoint)
1895+
} else {
1896+
log.Infof(cf.Ctx(), "change frontier persisted highwater=%s and checkpoint=%s",
1897+
frontier, legacyCheckpoint)
1898+
}
18951899
}
18961900
}
18971901

0 commit comments

Comments
 (0)