15
15
*
16
16
*
17
17
* IDENTIFICATION
18
- * $PostgreSQL: pgsql/src/backend/commands/dbcommands.c,v 1.165 2005/07/07 20:39:58 tgl Exp $
18
+ * $PostgreSQL: pgsql/src/backend/commands/dbcommands.c,v 1.166 2005/07/08 04:12:24 neilc Exp $
19
19
*
20
20
*-------------------------------------------------------------------------
21
21
*/
@@ -1305,79 +1305,6 @@ dbase_redo(XLogRecPtr lsn, XLogRecord *record)
1305
1305
(errmsg ("could not remove database directory \"%s\"" ,
1306
1306
dst_path )));
1307
1307
}
1308
- else if (info == XLOG_DBASE_CREATE_OLD )
1309
- {
1310
- xl_dbase_create_rec_old * xlrec = (xl_dbase_create_rec_old * ) XLogRecGetData (record );
1311
- char * dst_path = xlrec -> src_path + strlen (xlrec -> src_path ) + 1 ;
1312
- struct stat st ;
1313
-
1314
- #ifndef WIN32
1315
- char buf [2 * MAXPGPATH + 100 ];
1316
- #endif
1317
-
1318
- /*
1319
- * Our theory for replaying a CREATE is to forcibly drop the
1320
- * target subdirectory if present, then re-copy the source data.
1321
- * This may be more work than needed, but it is simple to
1322
- * implement.
1323
- */
1324
- if (stat (dst_path , & st ) == 0 && S_ISDIR (st .st_mode ))
1325
- {
1326
- if (!rmtree (dst_path , true))
1327
- ereport (WARNING ,
1328
- (errmsg ("could not remove database directory \"%s\"" ,
1329
- dst_path )));
1330
- }
1331
-
1332
- /*
1333
- * Force dirty buffers out to disk, to ensure source database is
1334
- * up-to-date for the copy. (We really only need to flush buffers for
1335
- * the source database, but bufmgr.c provides no API for that.)
1336
- */
1337
- BufferSync ();
1338
-
1339
- #ifndef WIN32
1340
-
1341
- /*
1342
- * Copy this subdirectory to the new location
1343
- *
1344
- * XXX use of cp really makes this code pretty grotty, particularly
1345
- * with respect to lack of ability to report errors well. Someday
1346
- * rewrite to do it for ourselves.
1347
- */
1348
-
1349
- /* We might need to use cp -R one day for portability */
1350
- snprintf (buf , sizeof (buf ), "cp -r '%s' '%s'" ,
1351
- xlrec -> src_path , dst_path );
1352
- if (system (buf ) != 0 )
1353
- ereport (ERROR ,
1354
- (errmsg ("could not initialize database directory" ),
1355
- errdetail ("Failing system command was: %s" , buf ),
1356
- errhint ("Look in the postmaster's stderr log for more information." )));
1357
- #else /* WIN32 */
1358
- if (copydir (xlrec -> src_path , dst_path ) != 0 )
1359
- {
1360
- /* copydir should already have given details of its troubles */
1361
- ereport (ERROR ,
1362
- (errmsg ("could not initialize database directory" )));
1363
- }
1364
- #endif /* WIN32 */
1365
- }
1366
- else if (info == XLOG_DBASE_DROP_OLD )
1367
- {
1368
- xl_dbase_drop_rec_old * xlrec = (xl_dbase_drop_rec_old * ) XLogRecGetData (record );
1369
-
1370
- /*
1371
- * Drop pages for this database that are in the shared buffer
1372
- * cache
1373
- */
1374
- DropBuffers (xlrec -> db_id );
1375
-
1376
- if (!rmtree (xlrec -> dir_path , true))
1377
- ereport (WARNING ,
1378
- (errmsg ("could not remove database directory \"%s\"" ,
1379
- xlrec -> dir_path )));
1380
- }
1381
1308
else
1382
1309
elog (PANIC , "dbase_redo: unknown op code %u" , info );
1383
1310
}
@@ -1402,21 +1329,6 @@ dbase_desc(char *buf, uint8 xl_info, char *rec)
1402
1329
sprintf (buf + strlen (buf ), "drop db: dir %u/%u" ,
1403
1330
xlrec -> db_id , xlrec -> tablespace_id );
1404
1331
}
1405
- else if (info == XLOG_DBASE_CREATE_OLD )
1406
- {
1407
- xl_dbase_create_rec_old * xlrec = (xl_dbase_create_rec_old * ) rec ;
1408
- char * dst_path = xlrec -> src_path + strlen (xlrec -> src_path ) + 1 ;
1409
-
1410
- sprintf (buf + strlen (buf ), "create db: %u copy \"%s\" to \"%s\"" ,
1411
- xlrec -> db_id , xlrec -> src_path , dst_path );
1412
- }
1413
- else if (info == XLOG_DBASE_DROP_OLD )
1414
- {
1415
- xl_dbase_drop_rec_old * xlrec = (xl_dbase_drop_rec_old * ) rec ;
1416
-
1417
- sprintf (buf + strlen (buf ), "drop db: %u directory: \"%s\"" ,
1418
- xlrec -> db_id , xlrec -> dir_path );
1419
- }
1420
1332
else
1421
1333
strcat (buf , "UNKNOWN" );
1422
1334
}
0 commit comments