Esempio n. 1
0
/*
 * Called when the backend exits with a running non-exclusive base backup,
 * to clean up state.
 */
static void
nonexclusive_base_backup_cleanup(int code, Datum arg)
{
	do_pg_abort_backup();
	ereport(WARNING,
			(errmsg("aborting backup due to backend exiting before pg_stop_backup was called")));
}
Esempio n. 2
0
/*
 * pgespresso_abort_backup: abort a running backup
 *
 * This does just the most basic steps of pgespresso_stop_backup(), by taking
 * the system out of backup mode, thus making it a lot more safe to call from
 * an error handler.
 */
Datum
pgespresso_abort_backup(PG_FUNCTION_ARGS)
{
	if (!superuser() && !has_rolreplication(GetUserId()))
		ereport(ERROR,
				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
		 (errmsg("must be superuser or replication role to run a backup"))));

	do_pg_abort_backup();

	PG_RETURN_VOID();
}
Esempio n. 3
0
/*
 * Called when ERROR or FATAL happens in perform_base_backup() after
 * we have started the backup - make sure we end it!
 */
static void
base_backup_cleanup(int code, Datum arg)
{
	do_pg_abort_backup();
}