MCPcopy Create free account
hub / github.com/apache/cloudberry / checkControlFile

Function checkControlFile

src/backend/postmaster/postmaster.c:1793–1811  ·  view source on GitHub ↗

* Check that pg_control exists in the correct location in the data directory. * * No attempt is made to validate the contents of pg_control here. This is * just a sanity check to see if we are looking at a real data directory. */

Source from the content-addressed store, hash-verified

1791 * just a sanity check to see if we are looking at a real data directory.
1792 */
1793static void
1794checkControlFile(void)
1795{
1796 char path[MAXPGPATH];
1797 FILE *fp;
1798
1799 snprintf(path, sizeof(path), "%s/global/pg_control", DataDir);
1800
1801 fp = AllocateFile(path, PG_BINARY_R);
1802 if (fp == NULL)
1803 {
1804 write_stderr("%s: could not find the database system\n"
1805 "Expected to find it in the directory \"%s\",\n"
1806 "but could not open file \"%s\": %s\n",
1807 progname, DataDir, path, strerror(errno));
1808 ExitPostmaster(2);
1809 }
1810 FreeFile(fp);
1811}
1812
1813
1814/*

Callers 1

PostmasterMainFunction · 0.70

Calls 4

AllocateFileFunction · 0.85
ExitPostmasterFunction · 0.85
FreeFileFunction · 0.85
write_stderrFunction · 0.50

Tested by

no test coverage detected