1515 *
1616 *
1717 * 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 $
1919 *
2020 *-------------------------------------------------------------------------
2121 */
@@ -1305,79 +1305,6 @@ dbase_redo(XLogRecPtr lsn, XLogRecord *record)
13051305(errmsg ("could not remove database directory \"%s\"" ,
13061306dst_path )));
13071307}
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- }
13811308else
13821309elog (PANIC ,"dbase_redo: unknown op code %u" ,info );
13831310}
@@ -1402,21 +1329,6 @@ dbase_desc(char *buf, uint8 xl_info, char *rec)
14021329sprintf (buf + strlen (buf ),"drop db: dir %u/%u" ,
14031330xlrec -> db_id ,xlrec -> tablespace_id );
14041331}
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- }
14201332else
14211333strcat (buf ,"UNKNOWN" );
14221334}