Definition at line 3283 of file dbcommands.c.
3284{
3286
3287
3289
3291 {
3294 char *src_path;
3295 char *dst_path;
3296 char *parent_path;
3298
3301
3302
3303
3304
3305
3306
3307 if (
stat(dst_path, &st) == 0 &&
S_ISDIR(st.st_mode))
3308 {
3309 if (!
rmtree(dst_path,
true))
3310
3312 (
errmsg(
"some useless files may be left behind in old database directory \"%s\"",
3313 dst_path)));
3314 }
3315
3316
3317
3318
3319
3320 parent_path =
pstrdup(dst_path);
3322 if (
stat(parent_path, &st) < 0)
3323 {
3324 if (errno != ENOENT)
3326 errmsg(
"could not stat directory \"%s\": %m",
3327 dst_path));
3328
3329
3331 }
3333
3334
3335
3336
3337
3338
3339
3340 if (
stat(src_path, &st) < 0 && errno == ENOENT)
3342
3343
3344
3345
3346
3348
3349
3351
3352
3353
3354
3355
3356
3357 copydir(src_path, dst_path,
false);
3358
3361 }
3363 {
3366 char *dbpath;
3367 char *parent_path;
3368
3370
3371
3372 parent_path =
pstrdup(dbpath);
3375
3376
3378 true);
3380 }
3382 {
3384 char *dst_path;
3386
3388 {
3389
3390
3391
3392
3393
3394
3395
3396
3397
3398
3401 }
3402
3403
3405
3406
3408
3409
3411
3412
3414
3415
3417
3419 {
3421
3422
3423 if (!
rmtree(dst_path,
true))
3425 (
errmsg(
"some useless files may be left behind in old database directory \"%s\"",
3426 dst_path)));
3428 }
3429
3431 {
3432
3433
3434
3435
3436
3437
3438
3440 }
3441 }
3442 else
3443 elog(
PANIC,
"dbase_redo: unknown op code %u", info);
3444}
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, and XLogRecHasAnyBlockRefs.