1744{
1749
1750 sprintf(path,
"%s/%X-%X.snap",
1753
1755
1757 {
1758 if (missing_ok && errno == ENOENT)
1759 return false;
1760
1763 errmsg(
"could not open file \"%s\": %m", path)));
1764 }
1765
1766 /* ----
1767 * Make sure the snapshot had been stored safely to disk, that's normally
1768 * cheap.
1769 * Note that we do not need PANIC here, nobody will be able to use the
1770 * slot without fsyncing, and saving it won't succeed without an fsync()
1771 * either...
1772 * ----
1773 */
1776
1777 /* read statically sized portion of snapshot */
1779
1783 errmsg(
"snapbuild state file \"%s\" has wrong magic number: %u instead of %u",
1785
1789 errmsg(
"snapbuild state file \"%s\" has unsupported version: %u instead of %u",
1791
1796
1797 /* read SnapBuild */
1800
1801 /* restore committed xacts information */
1803 {
1808 }
1809
1810 /* restore catalog modifying xacts information */
1812 {
1817 }
1818
1822 errmsg(
"could not close file \"%s\": %m", path)));
1823
1825
1826 /* verify checksum of what we've read */
1830 errmsg(
"checksum mismatch for snapbuild state file \"%s\": is %u, should be %u",
1831 path, checksum, ondisk->
checksum)));
1832
1833 return true;
1834}
int errcode_for_file_access(void)
int errcode(int sqlerrcode)
int errmsg(const char *fmt,...)
#define ereport(elevel,...)
int CloseTransientFile(int fd)
void fsync_fname(const char *fname, bool isdir)
int OpenTransientFile(const char *fileName, int fileFlags)
void * MemoryContextAllocZero(MemoryContext context, Size size)
#define ERRCODE_DATA_CORRUPTED
#define COMP_CRC32C(crc, data, len)
#define EQ_CRC32C(c1, c2)
static int fd(const char *x, int i)
#define PG_LOGICAL_SNAPSHOTS_DIR
#define SNAPBUILD_VERSION
#define SnapBuildOnDiskNotChecksummedSize
#define SnapBuildOnDiskConstantSize
static void SnapBuildRestoreContents(int fd, void *dest, Size size, const char *path)
struct SnapBuild::@112 committed
struct SnapBuild::@113 catchange
#define LSN_FORMAT_ARGS(lsn)