Definition at line 3283 of file dbcommands.c.
3307 if (
stat(dst_path, &st) == 0 &&
S_ISDIR(st.st_mode))
3309 if (!
rmtree(dst_path,
true))
3312 (
errmsg(
"some useless files may be left behind in old database directory \"%s\"",
3320 parent_path =
pstrdup(dst_path);
3322 if (
stat(parent_path, &st) < 0)
3324 if (errno != ENOENT)
3326 errmsg(
"could not stat directory \"%s\": %m",
3340 if (
stat(src_path, &st) < 0 && errno == ENOENT)
3357 copydir(src_path, dst_path,
false);
3372 parent_path =
pstrdup(dbpath);
3423 if (!
rmtree(dst_path,
true))
3425 (
errmsg(
"some useless files may be left behind in old database directory \"%s\"",
3443 elog(
PANIC,
"dbase_redo: unknown op code %u", info);
void DropDatabaseBuffers(Oid dbid)
void FlushDatabaseBuffers(Oid dbid)
#define Assert(condition)
void copydir(const char *fromdir, const char *todir, bool recurse)
static void CreateDirAndVersionFile(char *dbpath, Oid dbid, Oid tsid, bool isRedo)
static void recovery_create_dbdir(char *path, bool only_tblspc)
int errmsg(const char *fmt,...)
#define ereport(elevel,...)
void UnlockSharedObjectForSession(Oid classid, Oid objid, uint16 objsubid, LOCKMODE lockmode)
void LockSharedObjectForSession(Oid classid, Oid objid, uint16 objsubid, LOCKMODE lockmode)
#define AccessExclusiveLock
char * pstrdup(const char *in)
void pfree(void *pointer)
void ForgetDatabaseSyncRequests(Oid dbid)
void get_parent_directory(char *path)
void WaitForProcSignalBarrier(uint64 generation)
uint64 EmitProcSignalBarrier(ProcSignalBarrierType type)
@ PROCSIGNAL_BARRIER_SMGRRELEASE
char * GetDatabasePath(Oid dbOid, Oid spcOid)
bool rmtree(const char *path, bool rmtopdir)
void ReplicationSlotsDropDBSlots(Oid dboid)
void ResolveRecoveryConflictWithDatabase(Oid dbid)
#define XLogRecHasAnyBlockRefs(decoder)
void XLogDropDatabase(Oid dbid)
References AccessExclusiveLock, Assert, copydir(), CreateDirAndVersionFile(), xl_dbase_create_file_copy_rec::db_id, xl_dbase_create_wal_log_rec::db_id, xl_dbase_drop_rec::db_id, DropDatabaseBuffers(), elog, EmitProcSignalBarrier(), ereport, errmsg(), FATAL, FlushDatabaseBuffers(), ForgetDatabaseSyncRequests(), get_parent_directory(), GetDatabasePath(), i, InHotStandby, LockSharedObjectForSession(), xl_dbase_drop_rec::ntablespaces, PANIC, pfree(), PROCSIGNAL_BARRIER_SMGRRELEASE, pstrdup(), recovery_create_dbdir(), ReplicationSlotsDropDBSlots(), ResolveRecoveryConflictWithDatabase(), rmtree(), S_ISDIR, xl_dbase_create_file_copy_rec::src_db_id, xl_dbase_create_file_copy_rec::src_tablespace_id, stat::st_mode, stat, xl_dbase_create_file_copy_rec::tablespace_id, xl_dbase_create_wal_log_rec::tablespace_id, xl_dbase_drop_rec::tablespace_ids, UnlockSharedObjectForSession(), WaitForProcSignalBarrier(), WARNING, XLOG_DBASE_CREATE_FILE_COPY, XLOG_DBASE_CREATE_WAL_LOG, XLOG_DBASE_DROP, XLogDropDatabase(), XLogRecGetData, XLogRecGetInfo, XLogRecHasAnyBlockRefs, and XLR_INFO_MASK.