8000 Fix a couple bugs in pgcopydb clone --follow. by dimitri · Pull Request #386 · dimitri/pgcopydb · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Fix a couple bugs in pgcopydb clone --follow. #386

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

Merged
merged 1 commit into from
Jul 12, 2023
Merged
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
17 changes: 17 additions & 0 deletions 8000 src/bin/pgcopydb/cli_clone_follow.c
Original file line number Diff line number Diff line change
Expand Up @@ -214,6 +214,23 @@ clone_and_follow(CopyDataSpec *copySpecs)
exit(EXIT_CODE_INTERNAL_ERROR);
}

/*
* When using pgcopydb clone --follow --restart we first cleanup the
* previous setup, and that includes dropping the replication slot.
*/
if (copySpecs->restart)
{
log_info("Clean-up replication setup, per --restart");

if (!stream_cleanup_databases(copySpecs,
copyDBoptions.slot.slotName,
copyDBoptions.origin))
{
/* errors have already been logged */
exit(EXIT_CODE_INTERNAL_ERROR);
}
}

/*
* First create/export a snapshot for the whole clone --follow operations.
*/
Expand Down
8 changes: 6 additions & 2 deletions src/bin/pgcopydb/follow.c
Original file line number Diff line number Diff line change
Expand Up @@ -107,8 +107,6 @@ follow_reset_sequences(CopyDataSpec *copySpecs, StreamSpecs *streamSpecs)
/* copy our structure wholesale */
seqSpecs = *copySpecs;

log_info("follow_reset_sequences: %s", seqSpecs.connStrings.source_pguri);

/* then force some options such as --resume --not-consistent */
seqSpecs.restart = false;
seqSpecs.resume = true;
Expand Down Expand Up @@ -339,6 +337,12 @@ follow_main_loop(CopyDataSpec *copySpecs, StreamSpecs *streamSpecs)
return false;
}

if (asked_to_stop || asked_to_stop_fast || asked_to_quit)
{
log_warn("Main follow process was asked to terminate, exiting");
return true;
}

if (done)
{
return true;
Expand Down
2 changes: 1 addition & 1 deletion src/bin/pgcopydb/ld_apply.c
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ stream_apply_setup(StreamSpecs *specs, StreamApplyContext *context)

if (!context->apply)
{
log_error("Apply mode is still disabled, quitting now");
log_notice("Apply mode is still disabled, quitting now");
return true;
}

Expand Down
0