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

Function checkPgDir

src/backend/postmaster/postmaster.c:1817–1839  ·  view source on GitHub ↗

* check if file or directory under "DataDir" exists and is accessible */

Source from the content-addressed store, hash-verified

1815 * check if file or directory under "DataDir" exists and is accessible
1816 */
1817static void
1818checkPgDir(const char *dir)
1819{
1820 struct stat st;
1821 /*
1822 * DataDir is known to be smaller than MAXPGPATH, and 'dir' argument is always
1823 * a short constant.
1824 */
1825 char buf[MAXPGPATH + MAXPGPATH];
1826
1827 snprintf(buf, sizeof(buf), "%s%s", DataDir, dir);
1828
1829 if (stat(buf, &st) != 0)
1830 {
1831 /* check if log is there */
1832 snprintf(buf, sizeof(buf), "%s%s", DataDir, "/log");
1833 if (stat(buf, &st) == 0)
1834 elog(LOG, "System file or directory missing (%s), shutting down segment", dir);
1835
1836 /* quit all processes and exit */
1837 pmdie(SIGQUIT);
1838 }
1839}
1840
1841/*
1842 * Determine how long should we let ServerLoop sleep.

Callers 1

ServerLoopFunction · 0.85

Calls 2

pmdieFunction · 0.85
statClass · 0.70

Tested by

no test coverage detected