-
Notifications
You must be signed in to change notification settings - Fork 289
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
Fix changefeed stuck problem when overwrite resume with a forward checkpointTs #12056
Merged
+75
−3
Merged
Changes from 5 commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
e8767ae
update
hongyunyan 668bf7e
update
hongyunyan 95bafca
Merge branch 'release-6.5' into fixResume
hongyunyan 4690182
update
hongyunyan 6de1807
update
hongyunyan f5b271d
update
hongyunyan adc67e2
update
hongyunyan fb74bec
update
hongyunyan File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 2 additions & 0 deletions
2
tests/integration_tests/overwrite_resume_with_syncpoint/conf/changefeed.toml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
enable-sync-point = true | ||
sync-point-interval = "30s" |
67 changes: 67 additions & 0 deletions
67
tests/integration_tests/overwrite_resume_with_syncpoint/run.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
#!/bin/bash | ||
# the script test when we enable syncpoint, and pause the changefeed, | ||
# then resume with a forward checkpoint, to ensure the changefeed can be sync correctly. | ||
|
||
set -eux | ||
|
||
CUR=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd) | ||
source $CUR/../_utils/test_prepare | ||
WORK_DIR=$OUT_DIR/$TEST_NAME | ||
CDC_BINARY=cdc.test | ||
SINK_TYPE=$1 | ||
|
||
function check_ts_forward() { | ||
changefeedid=$1 | ||
rts1=$(cdc cli changefeed query --changefeed-id=${changefeedid} 2>&1 | jq '.resolved_ts') | ||
checkpoint1=$(cdc cli changefeed query --changefeed-id=${changefeedid} 2>&1 | jq '.checkpoint_tso') | ||
sleep 1 | ||
rts2=$(cdc cli changefeed query --changefeed-id=${changefeedid} 2>&1 | jq '.resolved_ts') | ||
checkpoint2=$(cdc cli changefeed query --changefeed-id=${changefeedid} 2>&1 | jq '.checkpoint_tso') | ||
if [[ "$rts1" != "null" ]] && [[ "$rts1" != "0" ]]; then | ||
if [[ "$rts1" -ne "$rts2" ]] || [[ "$checkpoint1" -ne "$checkpoint2" ]]; then | ||
echo "changefeed is working normally rts: ${rts1}->${rts2} checkpoint: ${checkpoint1}->${checkpoint2}" | ||
return | ||
fi | ||
fi | ||
exit 1 | ||
} | ||
|
||
function run() { | ||
# No need to test kafka and storage sink. | ||
if [ "$SINK_TYPE" != "mysql" ]; then | ||
return | ||
fi | ||
|
||
rm -rf $WORK_DIR && mkdir -p $WORK_DIR | ||
|
||
start_tidb_cluster --workdir $WORK_DIR | ||
|
||
cd $WORK_DIR | ||
|
||
run_cdc_server --workdir $WORK_DIR --binary $CDC_BINARY | ||
|
||
SINK_URI="mysql://[email protected]:3306/" | ||
run_cdc_cli changefeed create --sink-uri="$SINK_URI" --config=$CUR/conf/changefeed.toml --changefeed-id="test4" | ||
|
||
check_ts_forward "test4" | ||
|
||
run_cdc_cli changefeed pause --changefeed-id="test4" | ||
|
||
sleep 15 | ||
|
||
checkpoint1=$(cdc cli changefeed query --changefeed-id="test4" 2>&1 | jq '.checkpoint_tso') | ||
# add a large number to avoid the problem of losing precision when jq processing large integers | ||
checkpoint1=$((checkpoint1 + 1000000)) | ||
|
||
# resume a forward checkpointTs | ||
run_cdc_cli changefeed resume --changefeed-id="test4" --no-confirm --overwrite-checkpoint-ts=$checkpoint1 | ||
|
||
check_ts_forward "test4" | ||
|
||
cleanup_process $CDC_BINARY | ||
} | ||
|
||
trap stop_tidb_cluster EXIT | ||
run $* | ||
check_logs $WORK_DIR | ||
echo "[$(date)] <<<<<< run test case $TEST_NAME success! >>>>>>" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please move this test to
mysql_only_http
group to make CI faster.