Configuration parameter in pg_autoctl.cfg for the ability to clear PGDATA before running pg_basebackup
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Idoneità per principianti
- 35/100
Direzione di ricerca
Inizia leggendo la funzione pg_basebackup mostrata nell’issue e la gestione della configurazione pg_autoctl.cfg relativa al comportamento dei backup. Segui il percorso di switchover/failover in cui pg_rewind ricorre a pg_basebackup; il lavoro è completato quando la configurazione fornisce la scelta richiesta mantenendo il comportamento esistente per impostazione predefinita.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Good afternoon.
As far as I can see from the behavior of the cluster and the source code, if after switchover/failover the replica cannot be connected using pg_rewind and the replica is recreated using pg_basebackup. At the same time, PGDATA on the replica is not cleared until the procedure for copying data from the wizard to the backup_directory directory specified in pg_autoctl.cfg is completed. After the pg_basebackup copy is successfully completed, the PGDATA is cleared and the backup_directory data is moved to the PGDATA location:
/*
* Call pg_basebackup, using a temporary directory for the duration of the data
* transfer.
*/
bool
pg_basebackup(const char *pgdata,
const char *pg_ctl,
ReplicationSource *replicationSource)
{
...
returnCode = program.returnCode;
free_program(&program);
if (returnCode != 0)
{
log_error("Failed to run pg_basebackup: exit code %d", returnCode);
return false;
}
/* replace $pgdata with the backup directory */
if (directory_exists(pgdata))
{
if (!rmtree(pgdata, true))
{
log_error("Failed to remove directory \"%s\": %m", pgdata);
return false;
}
}
log_debug("mv \"%s\" \"%s\"", replicationSource->backupDir, pgdata);
if (rename(replicationSource->backupDir, pgdata) != 0)
{
log_error(
"Failed to install pg_basebackup dir " " \"%s\" in \"%s\": %m",
replicationSource->backupDir, pgdata);
return false;
}
return true;
}
This behavior can lead to the fact that disk space in the pg_basebackup process will run out if there is a lot of data and there is not enough disk space for PGDATA and a fresh copy from primary.
This is a particularly unpleasant situation with a failover, when we hope that automation will bring the cluster back to normal after changing server roles.
It would be convenient to have a parameter in the pg_autoctl.cfg configuration file, setting it to true, PGDATA on this server was cleared before running pg_basebackup (if pg_rewind did not help) during switchover/failover. This would solve the problem and allow for a choice of behavior.
Thank you.
- Lingua principale
- C
- Stelle
- 1.4k
- Fork
- 142
- Merge medio
- 5h 8m
- PR unite (30g)
- 1
Guida per i contributori
Apri la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di hapostgres/pg_auto_failover
-
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 86/100
hapostgres/pg_auto_failover#1190 ·
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
hapostgres/pg_auto_failover#1178 ·
-
Difficoltà 3/5 1-2 giorni Idoneità per principianti 35/100
hapostgres/pg_auto_failover#1189 ·
-
Difficoltà 4/5 3-5 giorni Idoneità per principianti 45/100
hapostgres/pg_auto_failover#1188 ·
-
Difficoltà 4/5 3-5 giorni Idoneità per principianti 48/100
hapostgres/pg_auto_failover#1159 · 1 commento · 1 reazione ·
Tutte le issue di hapostgres/pg_auto_failover
Issue simili
-
task
Difficoltà 2/5 1-3 ore Idoneità per principianti 70/100
vsanthanam/JBird#429 ·
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 70/100
-
bug documentation
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
es-ude/OnDeviceTraining#459 ·
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 65/100
bilelmoussaoui/gobject-linter#199 · 1 commento ·
-
bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
bradcypert/plum#53 ·