Skip to content

Conversation

@wenyihu6
Copy link
Contributor

Part of: https://cockroachlabs.atlassian.net/browse/CRDB-55203
Release note: none


workload/changefeed: allow changefeed-cursor

This commit adds a new option, changefeed-cursor, which allows specifying the
timestamp after which the changefeed should start emitting events and trigger a
catch-up scan. If not specified, the changefeed defaults to using the current
cluster logical timestamp. This helps tests specify catch-up scan behavior.


workload/changefeed: add more logs

@wenyihu6 wenyihu6 requested a review from a team as a code owner October 27, 2025 14:44
@wenyihu6 wenyihu6 requested review from a team, nameisbhaskar, stevendanna and williamchoe3 and removed request for a team October 27, 2025 14:44
@cockroach-teamcity
Copy link
Member

This change is Reviewable

log.Dev.Infof(ctx, "creating changefeed with stmt: %s with args %v", stmt, args)
if epoch, err := hlc.ParseHLC(cursorStr); err == nil {
log.Dev.Infof(ctx, "starting a changefeed after %s", timeutil.Since(epoch.GoTime()))
}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The cursor is already in the command, so if we really want a more human readable version, I would probably parse the cursor up where we can more easily return an error and then pretty print in a single log message along with the stmt.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hm, are you thinking we’d parse the timestamp from the input? I was hoping to calculate the time difference between the cursor timestamp and the changefeed creation time using timeutil.Since. Would I have to pass the parsed timestamp down here then?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was hoping to calculate the time difference between the cursor timestamp and the changefeed creation time using timeutil.Since.

Right, I'm saying you can do the parsing immediately after we establish the custorStr above. Then you can log it as part of the log line at line 136.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see, done, lmk if this matches with what you had in mind.

log.Dev.Infof(ctx, "creating changefeed with stmt: %s with args %v", stmt, args)
if epoch, err := hlc.ParseHLC(cursorStr); err == nil {
log.Dev.Infof(ctx, "starting a changefeed after %s", timeutil.Since(epoch.GoTime()))
}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was hoping to calculate the time difference between the cursor timestamp and the changefeed creation time using timeutil.Since.

Right, I'm saying you can do the parsing immediately after we establish the custorStr above. Then you can log it as part of the log line at line 136.

This commit adds a new option, changefeed-cursor, which allows specifying the
timestamp after which the changefeed should start emitting events and trigger a
catch-up scan. If not specified, the changefeed defaults to using the current
cluster logical timestamp. This helps tests specify catch-up scan behavior.
@wenyihu6
Copy link
Contributor Author

Test failure looks unrelated - TestInspectProgressWithMultiRangeTable.

bors r+

@craig
Copy link
Contributor

craig bot commented Oct 28, 2025

@craig craig bot merged commit 917f913 into cockroachdb:master Oct 28, 2025
23 of 24 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants