mirror of
https://github.com/postgres/postgres.git
synced 2025-05-29 00:03:09 -04:00
Don't crash when pg_xlog is empty and pg_basebackup -x is used
The backup will not work (without a logarchive, and that's the whole point of -x) in this case, this patch just changes it to throw an error instead of crashing when this happens. Noticed and diagnosed by TAKATSUKA Haruka
This commit is contained in:
parent
fcf9ecad57
commit
db4ef73760
@ -303,6 +303,14 @@ perform_base_backup(basebackup_options *opt, DIR *tblspcdir)
|
|||||||
}
|
}
|
||||||
qsort(walFiles, nWalFiles, sizeof(char *), compareWalFileNames);
|
qsort(walFiles, nWalFiles, sizeof(char *), compareWalFileNames);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* There must be at least one xlog file in the pg_xlog directory,
|
||||||
|
* since we are doing backup-including-xlog.
|
||||||
|
*/
|
||||||
|
if (nWalFiles < 1)
|
||||||
|
ereport(ERROR,
|
||||||
|
(errmsg("could not find any WAL files")));
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Sanity check: the first and last segment should cover startptr and
|
* Sanity check: the first and last segment should cover startptr and
|
||||||
* endptr, with no gaps in between.
|
* endptr, with no gaps in between.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user