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

cli: fix changefeed update to properly handle sort-dir and start-ts #1921

Closed
wants to merge 8 commits into from
Closed
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
11 changes: 10 additions & 1 deletion cmd/client_changefeed.go
Original file line number Diff line number Diff line change
Expand Up @@ -551,8 +551,17 @@ func newUpdateChangefeedCommand() *cobra.Command {
info.SyncPointEnabled = syncPointEnabled
case "sync-interval":
info.SyncPointInterval = syncPointInterval
case "pd", "tz", "start-ts", "changefeed-id", "no-confirm":
case "pd", "tz", "changefeed-id", "no-confirm":
// do nothing
case "start-ts":
cmd.Print("[WARN] updating start-ts is not supported. If you would like to restart the changefeed from another start-ts, " +
"please remove and recreate the changefeed")
case "sort-dir":
if sortDir != "" {
cmd.Printf("[WARN] --sort-dir is deprecated in changefeed settings. " +
"Please use `cdc server --sort-dir` if possible. ")
info.SortDir = sortDir
}
default:
// use this default branch to prevent new added parameter is not added
log.Warn("unsupported flag, please report a bug", zap.String("flagName", flag.Name))
Expand Down
12 changes: 12 additions & 0 deletions tests/cli/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,18 @@ EOF
exit 1
fi

run_cdc_cli changefeed update --start-ts 1234 --no-confirm --changefeed-id $uuid 2>&1 | grep 'updating start-ts is not supported'
if [[ $? != 0 ]]; then
echo "[$(date)] <<<<< expected warning when trying to update start-ts >>>>>"
exit 1
fi

run_cdc_cli changefeed update --sort-dir "/test" --no-confirm --changefeed-id $uuid 2>&1 | grep 'deprecated'
if [[ $? != 0 ]]; then
echo "[$(date)] <<<<< expected deprecation warning when trying to update sort-dir >>>>>"
exit 1
fi
Comment on lines +134 to +138
Copy link
Member

Choose a reason for hiding this comment

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

Can you check if it is updated successfully?


# Resume changefeed
run_cdc_cli changefeed --changefeed-id $uuid resume && sleep 3
jobtype=$(run_cdc_cli changefeed --changefeed-id $uuid query 2>&1 | grep 'admin-job-type' | grep -oE '[0-9]' | head -1)
Expand Down