Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
111804: streamingccl: verify backup schedule pauses after cutover r=stevendanna a=msbutler This patch adds an e2e c2c test to verify that replicated backup schedules pause on the destination tenant after cutover. This functionality was added in #111578. Informs #108028 Release note: none Co-authored-by: Michael Butler <butler@cockroachlabs.com>
- Loading branch information
Showing
5 changed files
with
122 additions
and
19 deletions.
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
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
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
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
63 changes: 63 additions & 0 deletions
63
pkg/ccl/streamingccl/streamingest/testdata/backup_schedule_pauses_after_cutover
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,63 @@ | ||
# This test ensures that backups schedules pause when the schedule realizes it | ||
# is being executed on a new cluster. | ||
|
||
create-replication-clusters | ||
---- | ||
|
||
start-replication-stream | ||
---- | ||
|
||
# Create test schedule that will begin a backup immediately | ||
exec-sql as=source-tenant | ||
CREATE SCHEDULE datatest | ||
FOR BACKUP INTO 'nodelocal://1/example-schedule' | ||
RECURRING '@weekly' FULL BACKUP ALWAYS | ||
WITH SCHEDULE OPTIONS first_run = 'now'; | ||
---- | ||
|
||
let $fullID as=source-tenant | ||
WITH SCHEDULES AS (SHOW SCHEDULES FOR BACKUP) SELECT id FROM schedules WHERE label='datatest'; | ||
---- | ||
|
||
# wait for one scheduled backup to succeed | ||
query-sql retry as=source-tenant | ||
SELECT count(job_id) FROM [SHOW JOBS] WHERE job_type = 'BACKUP' AND status = 'succeeded'; | ||
---- | ||
1 | ||
|
||
let $ts as=source-system | ||
SELECT clock_timestamp()::timestamp::string | ||
---- | ||
|
||
cutover ts=$ts | ||
---- | ||
|
||
start-replicated-tenant | ||
---- | ||
|
||
# Induce the replicated schedule to begin on the restored cluster, and | ||
# ensure the schedule pauses, since it will realize its running on a new cluster. | ||
exec-sql as=destination-tenant | ||
UPDATE system.scheduled_jobs SET next_run = now() WHERE schedule_id = $fullID | ||
---- | ||
|
||
# An empty next run indicates the schedule is paused. | ||
query-sql retry as=destination-tenant | ||
SELECT next_run FROM system.scheduled_jobs WHERE schedule_id = $fullID | ||
---- | ||
<nil> | ||
|
||
|
||
# Unpause the schedule and force it to run immediately. When we Resumed the | ||
# schedule by setting next_run to now above, the schedule's clusterID was | ||
# updated, so the schedule should not pause again. | ||
exec-sql as=destination-tenant | ||
UPDATE system.scheduled_jobs SET next_run = now() WHERE schedule_id = $fullID | ||
---- | ||
|
||
|
||
# Wait for above backup schedule to succeed | ||
query-sql retry as=destination-tenant | ||
SELECT count(job_id) FROM [SHOW JOBS] WHERE job_type = 'BACKUP' AND status = 'succeeded' | ||
---- | ||
2 |