pg_resetwal: Use frontend logging API
This now causes error messages related to the lack of the -f option to appear on standard error rather than standard output. Reviewed-by: Aleksander Alekseev <aleksander@timescale.com> Discussion: https://www.postgresql.org/message-id/flat/0f3ab4a1-ae80-56e8-3426-6b4a02507687@eisentraut.org
This commit is contained in:
parent
b5da1b3a93
commit
a11d8e10f2
@ -458,30 +458,32 @@ main(int argc, char *argv[])
|
|||||||
if (minXlogSegNo > newXlogSegNo)
|
if (minXlogSegNo > newXlogSegNo)
|
||||||
newXlogSegNo = minXlogSegNo;
|
newXlogSegNo = minXlogSegNo;
|
||||||
|
|
||||||
/*
|
if (noupdate)
|
||||||
* If we had to guess anything, and -f was not given, just print the
|
|
||||||
* guessed values and exit. Also print if -n is given.
|
|
||||||
*/
|
|
||||||
if ((guessed && !force) || noupdate)
|
|
||||||
{
|
{
|
||||||
PrintNewControlValues();
|
PrintNewControlValues();
|
||||||
if (!noupdate)
|
|
||||||
{
|
|
||||||
printf(_("\nIf these values seem acceptable, use -f to force reset.\n"));
|
|
||||||
exit(1);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
exit(0);
|
exit(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* If we had to guess anything, and -f was not given, just print the
|
||||||
|
* guessed values and exit.
|
||||||
|
*/
|
||||||
|
if (guessed && !force)
|
||||||
|
{
|
||||||
|
PrintNewControlValues();
|
||||||
|
pg_log_error("not proceeding because control file values were guessed");
|
||||||
|
pg_log_error_hint("If these values seem acceptable, use -f to force reset.");
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Don't reset from a dirty pg_control without -f, either.
|
* Don't reset from a dirty pg_control without -f, either.
|
||||||
*/
|
*/
|
||||||
if (ControlFile.state != DB_SHUTDOWNED && !force)
|
if (ControlFile.state != DB_SHUTDOWNED && !force)
|
||||||
{
|
{
|
||||||
printf(_("The database server was not shut down cleanly.\n"
|
pg_log_error("database server was not shut down cleanly");
|
||||||
"Resetting the write-ahead log might cause data to be lost.\n"
|
pg_log_error_detail("Resetting the write-ahead log might cause data to be lost.");
|
||||||
"If you want to proceed anyway, use -f to force reset.\n"));
|
pg_log_error_hint("If you want to proceed anyway, use -f to force reset.");
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user