Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit40ffa1a

Browse files
author
Neil Conway
committed
Remove some dead code for handling XLOG_DBASE_CREATE_OLD and
XLOG_DBASE_DROP_OLD WAL records -- these records are no longer created incurrent sources. Adjust numbering of XLOG_DBASE_CREATE and XLOG_DBASE_DROPand bump the catversion. Patch from Gavin Sherry, adjusted by Neil Conway.
1 parentd7207cf commit40ffa1a

File tree

3 files changed

+6
-103
lines changed

3 files changed

+6
-103
lines changed

‎src/backend/commands/dbcommands.c

Lines changed: 1 addition & 89 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
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\"",
13061306
dst_path)));
13071307
}
1308-
elseif (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-
structstatst;
1313-
1314-
#ifndefWIN32
1315-
charbuf[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-
#ifndefWIN32
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-
elseif (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-
}
13811308
else
13821309
elog(PANIC,"dbase_redo: unknown op code %u",info);
13831310
}
@@ -1402,21 +1329,6 @@ dbase_desc(char *buf, uint8 xl_info, char *rec)
14021329
sprintf(buf+strlen(buf),"drop db: dir %u/%u",
14031330
xlrec->db_id,xlrec->tablespace_id);
14041331
}
1405-
elseif (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-
elseif (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-
}
14201332
else
14211333
strcat(buf,"UNKNOWN");
14221334
}

‎src/include/catalog/catversion.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737
* Portions Copyright (c) 1996-2005, PostgreSQL Global Development Group
3838
* Portions Copyright (c) 1994, Regents of the University of California
3939
*
40-
* $PostgreSQL: pgsql/src/include/catalog/catversion.h,v 1.285 2005/07/07 20:39:59 tgl Exp $
40+
* $PostgreSQL: pgsql/src/include/catalog/catversion.h,v 1.286 2005/07/08 04:12:26 neilc Exp $
4141
*
4242
*-------------------------------------------------------------------------
4343
*/
@@ -53,6 +53,6 @@
5353
*/
5454

5555
/*yyyymmddN */
56-
#defineCATALOG_VERSION_NO200507071
56+
#defineCATALOG_VERSION_NO200507081
5757

5858
#endif

‎src/include/commands/dbcommands.h

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
* Portions Copyright (c) 1996-2005, PostgreSQL Global Development Group
88
* Portions Copyright (c) 1994, Regents of the University of California
99
*
10-
* $PostgreSQL: pgsql/src/include/commands/dbcommands.h,v 1.39 2005/06/28 05:09:12 tgl Exp $
10+
* $PostgreSQL: pgsql/src/include/commands/dbcommands.h,v 1.40 2005/07/08 04:12:27 neilc Exp $
1111
*
1212
*-------------------------------------------------------------------------
1313
*/
@@ -18,17 +18,8 @@
1818
#include"nodes/parsenodes.h"
1919

2020
/* XLOG stuff */
21-
#defineXLOG_DBASE_CREATE_OLD0x00
22-
#defineXLOG_DBASE_DROP_OLD0x10
23-
#defineXLOG_DBASE_CREATE0x20
24-
#defineXLOG_DBASE_DROP0x30
25-
26-
/*
27-
* Note: "old" versions are deprecated and need not be supported beyond 8.0.
28-
* Not only are they relatively bulky, but they do the Wrong Thing when a
29-
* WAL log is replayed in a data area that's at a different absolute path
30-
* than the original.
31-
*/
21+
#defineXLOG_DBASE_CREATE0x00
22+
#defineXLOG_DBASE_DROP0x10
3223

3324
typedefstructxl_dbase_create_rec_old
3425
{

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp