Commit a8bb8eb5 authored by Alvaro Herrera's avatar Alvaro Herrera

Remove flatfiles.c, which is now obsolete.

Recent commits have removed the various uses it was supporting.  It was a
performance bottleneck, according to bug report #4919 by Lauris Ulmanis; seems
it slowed down user creation after a billion users.
parent 0905e8ae
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/access/transam/twophase_rmgr.c,v 1.8 2009/01/01 17:23:36 momjian Exp $ * $PostgreSQL: pgsql/src/backend/access/transam/twophase_rmgr.c,v 1.9 2009/09/01 02:54:51 alvherre Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
...@@ -18,7 +18,6 @@ ...@@ -18,7 +18,6 @@
#include "commands/async.h" #include "commands/async.h"
#include "pgstat.h" #include "pgstat.h"
#include "storage/lock.h" #include "storage/lock.h"
#include "utils/flatfiles.h"
#include "utils/inval.h" #include "utils/inval.h"
...@@ -27,7 +26,6 @@ const TwoPhaseCallback twophase_recover_callbacks[TWOPHASE_RM_MAX_ID + 1] = ...@@ -27,7 +26,6 @@ const TwoPhaseCallback twophase_recover_callbacks[TWOPHASE_RM_MAX_ID + 1] =
NULL, /* END ID */ NULL, /* END ID */
lock_twophase_recover, /* Lock */ lock_twophase_recover, /* Lock */
NULL, /* Inval */ NULL, /* Inval */
NULL, /* flat file update */
NULL, /* notify/listen */ NULL, /* notify/listen */
NULL /* pgstat */ NULL /* pgstat */
}; };
...@@ -37,7 +35,6 @@ const TwoPhaseCallback twophase_postcommit_callbacks[TWOPHASE_RM_MAX_ID + 1] = ...@@ -37,7 +35,6 @@ const TwoPhaseCallback twophase_postcommit_callbacks[TWOPHASE_RM_MAX_ID + 1] =
NULL, /* END ID */ NULL, /* END ID */
lock_twophase_postcommit, /* Lock */ lock_twophase_postcommit, /* Lock */
inval_twophase_postcommit, /* Inval */ inval_twophase_postcommit, /* Inval */
flatfile_twophase_postcommit, /* flat file update */
notify_twophase_postcommit, /* notify/listen */ notify_twophase_postcommit, /* notify/listen */
pgstat_twophase_postcommit /* pgstat */ pgstat_twophase_postcommit /* pgstat */
}; };
...@@ -47,7 +44,6 @@ const TwoPhaseCallback twophase_postabort_callbacks[TWOPHASE_RM_MAX_ID + 1] = ...@@ -47,7 +44,6 @@ const TwoPhaseCallback twophase_postabort_callbacks[TWOPHASE_RM_MAX_ID + 1] =
NULL, /* END ID */ NULL, /* END ID */
lock_twophase_postabort, /* Lock */ lock_twophase_postabort, /* Lock */
NULL, /* Inval */ NULL, /* Inval */
NULL, /* flat file update */
NULL, /* notify/listen */ NULL, /* notify/listen */
pgstat_twophase_postabort /* pgstat */ pgstat_twophase_postabort /* pgstat */
}; };
...@@ -10,7 +10,7 @@ ...@@ -10,7 +10,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/access/transam/xact.c,v 1.274 2009/06/11 14:48:54 momjian Exp $ * $PostgreSQL: pgsql/src/backend/access/transam/xact.c,v 1.275 2009/09/01 02:54:51 alvherre Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
...@@ -43,7 +43,6 @@ ...@@ -43,7 +43,6 @@
#include "storage/sinvaladt.h" #include "storage/sinvaladt.h"
#include "storage/smgr.h" #include "storage/smgr.h"
#include "utils/combocid.h" #include "utils/combocid.h"
#include "utils/flatfiles.h"
#include "utils/guc.h" #include "utils/guc.h"
#include "utils/inval.h" #include "utils/inval.h"
#include "utils/memutils.h" #include "utils/memutils.h"
...@@ -1608,12 +1607,6 @@ CommitTransaction(void) ...@@ -1608,12 +1607,6 @@ CommitTransaction(void)
/* NOTIFY commit must come before lower-level cleanup */ /* NOTIFY commit must come before lower-level cleanup */
AtCommit_Notify(); AtCommit_Notify();
/*
* Update flat files if we changed pg_database, pg_authid or
* pg_auth_members. This should be the last step before commit.
*/
AtEOXact_UpdateFlatFiles(true);
/* Prevent cancel/die interrupt while cleaning up */ /* Prevent cancel/die interrupt while cleaning up */
HOLD_INTERRUPTS(); HOLD_INTERRUPTS();
...@@ -1797,7 +1790,7 @@ PrepareTransaction(void) ...@@ -1797,7 +1790,7 @@ PrepareTransaction(void)
/* close large objects before lower-level cleanup */ /* close large objects before lower-level cleanup */
AtEOXact_LargeObject(true); AtEOXact_LargeObject(true);
/* NOTIFY and flatfiles will be handled below */ /* NOTIFY will be handled below */
/* /*
* Don't allow PREPARE TRANSACTION if we've accessed a temporary table in * Don't allow PREPARE TRANSACTION if we've accessed a temporary table in
...@@ -1860,7 +1853,6 @@ PrepareTransaction(void) ...@@ -1860,7 +1853,6 @@ PrepareTransaction(void)
StartPrepare(gxact); StartPrepare(gxact);
AtPrepare_Notify(); AtPrepare_Notify();
AtPrepare_UpdateFlatFiles();
AtPrepare_Inval(); AtPrepare_Inval();
AtPrepare_Locks(); AtPrepare_Locks();
AtPrepare_PgStat(); AtPrepare_PgStat();
...@@ -1909,7 +1901,7 @@ PrepareTransaction(void) ...@@ -1909,7 +1901,7 @@ PrepareTransaction(void)
/* Clean up the snapshot manager */ /* Clean up the snapshot manager */
AtEarlyCommit_Snapshot(); AtEarlyCommit_Snapshot();
/* notify and flatfiles don't need a postprepare call */ /* notify doesn't need a postprepare call */
PostPrepare_PgStat(); PostPrepare_PgStat();
...@@ -2036,7 +2028,6 @@ AbortTransaction(void) ...@@ -2036,7 +2028,6 @@ AbortTransaction(void)
AtAbort_Portals(); AtAbort_Portals();
AtEOXact_LargeObject(false); /* 'false' means it's abort */ AtEOXact_LargeObject(false); /* 'false' means it's abort */
AtAbort_Notify(); AtAbort_Notify();
AtEOXact_UpdateFlatFiles(false);
/* /*
* Advertise the fact that we aborted in pg_clog (assuming that we got as * Advertise the fact that we aborted in pg_clog (assuming that we got as
...@@ -3764,8 +3755,6 @@ CommitSubTransaction(void) ...@@ -3764,8 +3755,6 @@ CommitSubTransaction(void)
AtEOSubXact_LargeObject(true, s->subTransactionId, AtEOSubXact_LargeObject(true, s->subTransactionId,
s->parent->subTransactionId); s->parent->subTransactionId);
AtSubCommit_Notify(); AtSubCommit_Notify();
AtEOSubXact_UpdateFlatFiles(true, s->subTransactionId,
s->parent->subTransactionId);
CallSubXactCallbacks(SUBXACT_EVENT_COMMIT_SUB, s->subTransactionId, CallSubXactCallbacks(SUBXACT_EVENT_COMMIT_SUB, s->subTransactionId,
s->parent->subTransactionId); s->parent->subTransactionId);
...@@ -3885,8 +3874,6 @@ AbortSubTransaction(void) ...@@ -3885,8 +3874,6 @@ AbortSubTransaction(void)
AtEOSubXact_LargeObject(false, s->subTransactionId, AtEOSubXact_LargeObject(false, s->subTransactionId,
s->parent->subTransactionId); s->parent->subTransactionId);
AtSubAbort_Notify(); AtSubAbort_Notify();
AtEOSubXact_UpdateFlatFiles(false, s->subTransactionId,
s->parent->subTransactionId);
/* Advertise the fact that we aborted in pg_clog. */ /* Advertise the fact that we aborted in pg_clog. */
(void) RecordTransactionAbort(true); (void) RecordTransactionAbort(true);
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
* Portions Copyright (c) 1996-2009, PostgreSQL Global Development Group * Portions Copyright (c) 1996-2009, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California * Portions Copyright (c) 1994, Regents of the University of California
* *
* $PostgreSQL: pgsql/src/backend/access/transam/xlog.c,v 1.350 2009/08/31 02:23:22 tgl Exp $ * $PostgreSQL: pgsql/src/backend/access/transam/xlog.c,v 1.351 2009/09/01 02:54:51 alvherre Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
...@@ -49,7 +49,6 @@ ...@@ -49,7 +49,6 @@
#include "storage/smgr.h" #include "storage/smgr.h"
#include "storage/spin.h" #include "storage/spin.h"
#include "utils/builtins.h" #include "utils/builtins.h"
#include "utils/flatfiles.h"
#include "utils/guc.h" #include "utils/guc.h"
#include "utils/ps_status.h" #include "utils/ps_status.h"
#include "pg_trace.h" #include "pg_trace.h"
...@@ -8077,8 +8076,6 @@ StartupProcessMain(void) ...@@ -8077,8 +8076,6 @@ StartupProcessMain(void)
StartupXLOG(); StartupXLOG();
BuildFlatFiles(false);
/* /*
* Exit normally. Exit code 0 tells postmaster that we completed recovery * Exit normally. Exit code 0 tells postmaster that we completed recovery
* successfully. * successfully.
......
...@@ -13,7 +13,7 @@ ...@@ -13,7 +13,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/commands/dbcommands.c,v 1.225 2009/06/11 14:48:55 momjian Exp $ * $PostgreSQL: pgsql/src/backend/commands/dbcommands.c,v 1.226 2009/09/01 02:54:51 alvherre Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
...@@ -49,7 +49,6 @@ ...@@ -49,7 +49,6 @@
#include "storage/smgr.h" #include "storage/smgr.h"
#include "utils/acl.h" #include "utils/acl.h"
#include "utils/builtins.h" #include "utils/builtins.h"
#include "utils/flatfiles.h"
#include "utils/fmgroids.h" #include "utils/fmgroids.h"
#include "utils/guc.h" #include "utils/guc.h"
#include "utils/lsyscache.h" #include "utils/lsyscache.h"
...@@ -691,19 +690,17 @@ createdb(const CreatedbStmt *stmt) ...@@ -691,19 +690,17 @@ createdb(const CreatedbStmt *stmt)
RequestCheckpoint(CHECKPOINT_IMMEDIATE | CHECKPOINT_FORCE | CHECKPOINT_WAIT); RequestCheckpoint(CHECKPOINT_IMMEDIATE | CHECKPOINT_FORCE | CHECKPOINT_WAIT);
/* /*
* Close pg_database, but keep lock till commit (this is important to * Close pg_database, but keep lock till commit.
* prevent any risk of deadlock failure while updating flat file)
*/ */
heap_close(pg_database_rel, NoLock); heap_close(pg_database_rel, NoLock);
/* /*
* Set flag to update flat database file at commit. Note: this also * Force synchronous commit, thus minimizing the window between
* forces synchronous commit, which minimizes the window between
* creation of the database files and commital of the transaction. If * creation of the database files and commital of the transaction. If
* we crash before committing, we'll have a DB that's taking up disk * we crash before committing, we'll have a DB that's taking up disk
* space but is not in pg_database, which is not good. * space but is not in pg_database, which is not good.
*/ */
database_file_update_needed(); ForceSyncCommit();
} }
PG_END_ENSURE_ERROR_CLEANUP(createdb_failure_callback, PG_END_ENSURE_ERROR_CLEANUP(createdb_failure_callback,
PointerGetDatum(&fparms)); PointerGetDatum(&fparms));
...@@ -862,19 +859,17 @@ dropdb(const char *dbname, bool missing_ok) ...@@ -862,19 +859,17 @@ dropdb(const char *dbname, bool missing_ok)
remove_dbtablespaces(db_id); remove_dbtablespaces(db_id);
/* /*
* Close pg_database, but keep lock till commit (this is important to * Close pg_database, but keep lock till commit.
* prevent any risk of deadlock failure while updating flat file)
*/ */
heap_close(pgdbrel, NoLock); heap_close(pgdbrel, NoLock);
/* /*
* Set flag to update flat database file at commit. Note: this also * Force synchronous commit, thus minimizing the window between removal
* forces synchronous commit, which minimizes the window between removal
* of the database files and commital of the transaction. If we crash * of the database files and commital of the transaction. If we crash
* before committing, we'll have a DB that's gone on disk but still there * before committing, we'll have a DB that's gone on disk but still there
* according to pg_database, which is not good. * according to pg_database, which is not good.
*/ */
database_file_update_needed(); ForceSyncCommit();
} }
...@@ -957,15 +952,9 @@ RenameDatabase(const char *oldname, const char *newname) ...@@ -957,15 +952,9 @@ RenameDatabase(const char *oldname, const char *newname)
CatalogUpdateIndexes(rel, newtup); CatalogUpdateIndexes(rel, newtup);
/* /*
* Close pg_database, but keep lock till commit (this is important to * Close pg_database, but keep lock till commit.
* prevent any risk of deadlock failure while updating flat file)
*/ */
heap_close(rel, NoLock); heap_close(rel, NoLock);
/*
* Set flag to update flat database file at commit.
*/
database_file_update_needed();
} }
...@@ -1212,17 +1201,15 @@ movedb(const char *dbname, const char *tblspcname) ...@@ -1212,17 +1201,15 @@ movedb(const char *dbname, const char *tblspcname)
RequestCheckpoint(CHECKPOINT_IMMEDIATE | CHECKPOINT_FORCE | CHECKPOINT_WAIT); RequestCheckpoint(CHECKPOINT_IMMEDIATE | CHECKPOINT_FORCE | CHECKPOINT_WAIT);
/* /*
* Set flag to update flat database file at commit. Note: this also * Force synchronous commit, thus minimizing the window between
* forces synchronous commit, which minimizes the window between
* copying the database files and commital of the transaction. If we * copying the database files and commital of the transaction. If we
* crash before committing, we'll leave an orphaned set of files on * crash before committing, we'll leave an orphaned set of files on
* disk, which is not fatal but not good either. * disk, which is not fatal but not good either.
*/ */
database_file_update_needed(); ForceSyncCommit();
/* /*
* Close pg_database, but keep lock till commit (this is important to * Close pg_database, but keep lock till commit.
* prevent any risk of deadlock failure while updating flat file)
*/ */
heap_close(pgdbrel, NoLock); heap_close(pgdbrel, NoLock);
} }
...@@ -1401,11 +1388,6 @@ AlterDatabase(AlterDatabaseStmt *stmt, bool isTopLevel) ...@@ -1401,11 +1388,6 @@ AlterDatabase(AlterDatabaseStmt *stmt, bool isTopLevel)
/* Close pg_database, but keep lock till commit */ /* Close pg_database, but keep lock till commit */
heap_close(rel, NoLock); heap_close(rel, NoLock);
/*
* We don't bother updating the flat file since the existing options for
* ALTER DATABASE don't affect it.
*/
} }
...@@ -1494,11 +1476,6 @@ AlterDatabaseSet(AlterDatabaseSetStmt *stmt) ...@@ -1494,11 +1476,6 @@ AlterDatabaseSet(AlterDatabaseSetStmt *stmt)
/* Close pg_database, but keep lock till commit */ /* Close pg_database, but keep lock till commit */
heap_close(rel, NoLock); heap_close(rel, NoLock);
/*
* We don't bother updating the flat file since ALTER DATABASE SET doesn't
* affect it.
*/
} }
...@@ -1608,11 +1585,6 @@ AlterDatabaseOwner(const char *dbname, Oid newOwnerId) ...@@ -1608,11 +1585,6 @@ AlterDatabaseOwner(const char *dbname, Oid newOwnerId)
/* Close pg_database, but keep lock till commit */ /* Close pg_database, but keep lock till commit */
heap_close(rel, NoLock); heap_close(rel, NoLock);
/*
* We don't bother updating the flat file since ALTER DATABASE OWNER
* doesn't affect it.
*/
} }
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
* Portions Copyright (c) 1996-2009, PostgreSQL Global Development Group * Portions Copyright (c) 1996-2009, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California * Portions Copyright (c) 1994, Regents of the University of California
* *
* $PostgreSQL: pgsql/src/backend/commands/user.c,v 1.187 2009/06/11 14:48:56 momjian Exp $ * $PostgreSQL: pgsql/src/backend/commands/user.c,v 1.188 2009/09/01 02:54:51 alvherre Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
...@@ -26,7 +26,6 @@ ...@@ -26,7 +26,6 @@
#include "storage/lmgr.h" #include "storage/lmgr.h"
#include "utils/acl.h" #include "utils/acl.h"
#include "utils/builtins.h" #include "utils/builtins.h"
#include "utils/flatfiles.h"
#include "utils/fmgroids.h" #include "utils/fmgroids.h"
#include "utils/guc.h" #include "utils/guc.h"
#include "utils/lsyscache.h" #include "utils/lsyscache.h"
...@@ -385,15 +384,9 @@ CreateRole(CreateRoleStmt *stmt) ...@@ -385,15 +384,9 @@ CreateRole(CreateRoleStmt *stmt)
GetUserId(), false); GetUserId(), false);
/* /*
* Close pg_authid, but keep lock till commit (this is important to * Close pg_authid, but keep lock till commit.
* prevent any risk of deadlock failure while updating flat file)
*/ */
heap_close(pg_authid_rel, NoLock); heap_close(pg_authid_rel, NoLock);
/*
* Set flag to update flat auth file at commit.
*/
auth_file_update_needed();
} }
...@@ -710,15 +703,9 @@ AlterRole(AlterRoleStmt *stmt) ...@@ -710,15 +703,9 @@ AlterRole(AlterRoleStmt *stmt)
false); false);
/* /*
* Close pg_authid, but keep lock till commit (this is important to * Close pg_authid, but keep lock till commit.
* prevent any risk of deadlock failure while updating flat file)
*/ */
heap_close(pg_authid_rel, NoLock); heap_close(pg_authid_rel, NoLock);
/*
* Set flag to update flat auth file at commit.
*/
auth_file_update_needed();
} }
...@@ -808,7 +795,6 @@ AlterRoleSet(AlterRoleSetStmt *stmt) ...@@ -808,7 +795,6 @@ AlterRoleSet(AlterRoleSetStmt *stmt)
CatalogUpdateIndexes(rel, newtuple); CatalogUpdateIndexes(rel, newtuple);
ReleaseSysCache(oldtuple); ReleaseSysCache(oldtuple);
/* needn't keep lock since we won't be updating the flat file */
heap_close(rel, RowExclusiveLock); heap_close(rel, RowExclusiveLock);
} }
...@@ -970,16 +956,10 @@ DropRole(DropRoleStmt *stmt) ...@@ -970,16 +956,10 @@ DropRole(DropRoleStmt *stmt)
} }
/* /*
* Now we can clean up; but keep locks until commit (to avoid possible * Now we can clean up; but keep locks until commit.
* deadlock failure while updating flat file)
*/ */
heap_close(pg_auth_members_rel, NoLock); heap_close(pg_auth_members_rel, NoLock);
heap_close(pg_authid_rel, NoLock); heap_close(pg_authid_rel, NoLock);
/*
* Set flag to update flat auth file at commit.
*/
auth_file_update_needed();
} }
/* /*
...@@ -1092,15 +1072,9 @@ RenameRole(const char *oldname, const char *newname) ...@@ -1092,15 +1072,9 @@ RenameRole(const char *oldname, const char *newname)
ReleaseSysCache(oldtuple); ReleaseSysCache(oldtuple);
/* /*
* Close pg_authid, but keep lock till commit (this is important to * Close pg_authid, but keep lock till commit.
* prevent any risk of deadlock failure while updating flat file)
*/ */
heap_close(rel, NoLock); heap_close(rel, NoLock);
/*
* Set flag to update flat auth file at commit.
*/
auth_file_update_needed();
} }
/* /*
...@@ -1157,15 +1131,9 @@ GrantRole(GrantRoleStmt *stmt) ...@@ -1157,15 +1131,9 @@ GrantRole(GrantRoleStmt *stmt)
} }
/* /*
* Close pg_authid, but keep lock till commit (this is important to * Close pg_authid, but keep lock till commit.
* prevent any risk of deadlock failure while updating flat file)
*/ */
heap_close(pg_authid_rel, NoLock); heap_close(pg_authid_rel, NoLock);
/*
* Set flag to update flat auth file at commit.
*/
auth_file_update_needed();
} }
/* /*
...@@ -1385,8 +1353,7 @@ AddRoleMems(const char *rolename, Oid roleid, ...@@ -1385,8 +1353,7 @@ AddRoleMems(const char *rolename, Oid roleid,
} }
/* /*
* Close pg_authmem, but keep lock till commit (this is important to * Close pg_authmem, but keep lock till commit.
* prevent any risk of deadlock failure while updating flat file)
*/ */
heap_close(pg_authmem_rel, NoLock); heap_close(pg_authmem_rel, NoLock);
} }
...@@ -1498,8 +1465,7 @@ DelRoleMems(const char *rolename, Oid roleid, ...@@ -1498,8 +1465,7 @@ DelRoleMems(const char *rolename, Oid roleid,
} }
/* /*
* Close pg_authmem, but keep lock till commit (this is important to * Close pg_authmem, but keep lock till commit.
* prevent any risk of deadlock failure while updating flat file)
*/ */
heap_close(pg_authmem_rel, NoLock); heap_close(pg_authmem_rel, NoLock);
} }
...@@ -13,7 +13,7 @@ ...@@ -13,7 +13,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/commands/vacuum.c,v 1.391 2009/08/31 02:23:22 tgl Exp $ * $PostgreSQL: pgsql/src/backend/commands/vacuum.c,v 1.392 2009/09/01 02:54:51 alvherre Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
...@@ -46,7 +46,6 @@ ...@@ -46,7 +46,6 @@
#include "storage/procarray.h" #include "storage/procarray.h"
#include "utils/acl.h" #include "utils/acl.h"
#include "utils/builtins.h" #include "utils/builtins.h"
#include "utils/flatfiles.h"
#include "utils/fmgroids.h" #include "utils/fmgroids.h"
#include "utils/inval.h" #include "utils/inval.h"
#include "utils/lsyscache.h" #include "utils/lsyscache.h"
...@@ -893,15 +892,11 @@ vac_update_datfrozenxid(void) ...@@ -893,15 +892,11 @@ vac_update_datfrozenxid(void)
heap_close(relation, RowExclusiveLock); heap_close(relation, RowExclusiveLock);
/* /*
* If we were able to advance datfrozenxid, mark the flat-file copy of * If we were able to advance datfrozenxid, see if we can truncate pg_clog.
* pg_database for update at commit, and see if we can truncate pg_clog. * Also do it if the shared XID-wrap-limit info is stale.
* Also force update if the shared XID-wrap-limit info is stale.
*/ */
if (dirty || !TransactionIdLimitIsValid()) if (dirty || !TransactionIdLimitIsValid())
{
database_file_update_needed();
vac_truncate_clog(newFrozenXid); vac_truncate_clog(newFrozenXid);
}
} }
......
...@@ -10,7 +10,7 @@ ...@@ -10,7 +10,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/libpq/hba.c,v 1.189 2009/08/29 19:26:51 tgl Exp $ * $PostgreSQL: pgsql/src/backend/libpq/hba.c,v 1.190 2009/09/01 02:54:51 alvherre Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
...@@ -1274,51 +1274,6 @@ load_hba(void) ...@@ -1274,51 +1274,6 @@ load_hba(void)
return true; return true;
} }
/*
* Read and parse one line from the flat pg_database file.
*
* Returns TRUE on success, FALSE if EOF; bad data causes elog(FATAL).
*
* Output parameters:
* dbname: gets database name (must be of size NAMEDATALEN bytes)
* dboid: gets database OID
* dbtablespace: gets database's default tablespace's OID
* dbfrozenxid: gets database's frozen XID
*
* This is not much related to the other functions in hba.c, but we put it
* here because it uses the next_token() infrastructure.
*/
bool
read_pg_database_line(FILE *fp, char *dbname, Oid *dboid,
Oid *dbtablespace, TransactionId *dbfrozenxid)
{
char buf[MAX_TOKEN];
if (feof(fp))
return false;
if (!next_token(fp, buf, sizeof(buf)))
return false;
if (strlen(buf) >= NAMEDATALEN)
elog(FATAL, "bad data in flat pg_database file");
strcpy(dbname, buf);
next_token(fp, buf, sizeof(buf));
if (!isdigit((unsigned char) buf[0]))
elog(FATAL, "bad data in flat pg_database file");
*dboid = atooid(buf);
next_token(fp, buf, sizeof(buf));
if (!isdigit((unsigned char) buf[0]))
elog(FATAL, "bad data in flat pg_database file");
*dbtablespace = atooid(buf);
next_token(fp, buf, sizeof(buf));
if (!isdigit((unsigned char) buf[0]))
elog(FATAL, "bad data in flat pg_database file");
*dbfrozenxid = atoxid(buf);
/* expect EOL next */
if (next_token(fp, buf, sizeof(buf)))
elog(FATAL, "bad data in flat pg_database file");
return true;
}
/* /*
* Process one line from the ident config file. * Process one line from the ident config file.
* *
......
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/tcop/postgres.c,v 1.572 2009/09/01 00:09:42 tgl Exp $ * $PostgreSQL: pgsql/src/backend/tcop/postgres.c,v 1.573 2009/09/01 02:54:51 alvherre Exp $
* *
* NOTES * NOTES
* this is the "main" module of the postgres backend and * this is the "main" module of the postgres backend and
...@@ -66,7 +66,6 @@ ...@@ -66,7 +66,6 @@
#include "tcop/pquery.h" #include "tcop/pquery.h"
#include "tcop/tcopprot.h" #include "tcop/tcopprot.h"
#include "tcop/utility.h" #include "tcop/utility.h"
#include "utils/flatfiles.h"
#include "utils/lsyscache.h" #include "utils/lsyscache.h"
#include "utils/memutils.h" #include "utils/memutils.h"
#include "utils/ps_status.h" #include "utils/ps_status.h"
...@@ -3280,12 +3279,6 @@ PostgresMain(int argc, char *argv[], const char *username) ...@@ -3280,12 +3279,6 @@ PostgresMain(int argc, char *argv[], const char *username)
*/ */
StartupXLOG(); StartupXLOG();
on_shmem_exit(ShutdownXLOG, 0); on_shmem_exit(ShutdownXLOG, 0);
/*
* We have to build the flat file for pg_database, but not for the
* user and group tables, since we won't try to do authentication.
*/
BuildFlatFiles(true);
} }
/* /*
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
# Makefile for utils/init # Makefile for utils/init
# #
# IDENTIFICATION # IDENTIFICATION
# $PostgreSQL: pgsql/src/backend/utils/init/Makefile,v 1.22 2008/02/19 10:30:08 petere Exp $ # $PostgreSQL: pgsql/src/backend/utils/init/Makefile,v 1.23 2009/09/01 02:54:51 alvherre Exp $
# #
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
...@@ -12,6 +12,6 @@ subdir = src/backend/utils/init ...@@ -12,6 +12,6 @@ subdir = src/backend/utils/init
top_builddir = ../../../.. top_builddir = ../../../..
include $(top_builddir)/src/Makefile.global include $(top_builddir)/src/Makefile.global
OBJS = flatfiles.o globals.o miscinit.o postinit.o OBJS = globals.o miscinit.o postinit.o
include $(top_srcdir)/src/backend/common.mk include $(top_srcdir)/src/backend/common.mk
This diff is collapsed.
...@@ -42,7 +42,7 @@ ...@@ -42,7 +42,7 @@
* Portions Copyright (c) 1994, Regents of the University of California * Portions Copyright (c) 1994, Regents of the University of California
* Portions taken from FreeBSD. * Portions taken from FreeBSD.
* *
* $PostgreSQL: pgsql/src/bin/initdb/initdb.c,v 1.172 2009/06/11 14:49:07 momjian Exp $ * $PostgreSQL: pgsql/src/bin/initdb/initdb.c,v 1.173 2009/09/01 02:54:52 alvherre Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
...@@ -1404,20 +1404,6 @@ setup_auth(void) ...@@ -1404,20 +1404,6 @@ setup_auth(void)
PG_CMD_DECL; PG_CMD_DECL;
const char **line; const char **line;
static const char *pg_authid_setup[] = { static const char *pg_authid_setup[] = {
/*
* Create triggers to ensure manual updates to shared catalogs will be
* reflected into their "flat file" copies.
*/
"CREATE TRIGGER pg_sync_pg_database "
" AFTER INSERT OR UPDATE OR DELETE ON pg_database "
" FOR EACH STATEMENT EXECUTE PROCEDURE flatfile_update_trigger();\n",
"CREATE TRIGGER pg_sync_pg_authid "
" AFTER INSERT OR UPDATE OR DELETE ON pg_authid "
" FOR EACH STATEMENT EXECUTE PROCEDURE flatfile_update_trigger();\n",
"CREATE TRIGGER pg_sync_pg_auth_members "
" AFTER INSERT OR UPDATE OR DELETE ON pg_auth_members "
" FOR EACH STATEMENT EXECUTE PROCEDURE flatfile_update_trigger();\n",
/* /*
* The authid table shouldn't be readable except through views, to * The authid table shouldn't be readable except through views, to
* ensure passwords are not publicly visible. * ensure passwords are not publicly visible.
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
* Portions Copyright (c) 1996-2009, PostgreSQL Global Development Group * Portions Copyright (c) 1996-2009, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California * Portions Copyright (c) 1994, Regents of the University of California
* *
* $PostgreSQL: pgsql/src/include/access/twophase_rmgr.h,v 1.7 2009/01/01 17:23:56 momjian Exp $ * $PostgreSQL: pgsql/src/include/access/twophase_rmgr.h,v 1.8 2009/09/01 02:54:52 alvherre Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
...@@ -24,9 +24,8 @@ typedef uint8 TwoPhaseRmgrId; ...@@ -24,9 +24,8 @@ typedef uint8 TwoPhaseRmgrId;
#define TWOPHASE_RM_END_ID 0 #define TWOPHASE_RM_END_ID 0
#define TWOPHASE_RM_LOCK_ID 1 #define TWOPHASE_RM_LOCK_ID 1
#define TWOPHASE_RM_INVAL_ID 2 #define TWOPHASE_RM_INVAL_ID 2
#define TWOPHASE_RM_FLATFILES_ID 3 #define TWOPHASE_RM_NOTIFY_ID 3
#define TWOPHASE_RM_NOTIFY_ID 4 #define TWOPHASE_RM_PGSTAT_ID 4
#define TWOPHASE_RM_PGSTAT_ID 5
#define TWOPHASE_RM_MAX_ID TWOPHASE_RM_PGSTAT_ID #define TWOPHASE_RM_MAX_ID TWOPHASE_RM_PGSTAT_ID
extern const TwoPhaseCallback twophase_recover_callbacks[]; extern const TwoPhaseCallback twophase_recover_callbacks[];
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
* Portions Copyright (c) 1996-2009, PostgreSQL Global Development Group * Portions Copyright (c) 1996-2009, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California * Portions Copyright (c) 1994, Regents of the University of California
* *
* $PostgreSQL: pgsql/src/include/catalog/pg_proc.h,v 1.549 2009/08/04 04:04:12 tgl Exp $ * $PostgreSQL: pgsql/src/include/catalog/pg_proc.h,v 1.550 2009/09/01 02:54:52 alvherre Exp $
* *
* NOTES * NOTES
* The script catalog/genbki.sh reads this file and generates .bki * The script catalog/genbki.sh reads this file and generates .bki
...@@ -2182,9 +2182,6 @@ DESCR("matches LIKE expression, case-insensitive"); ...@@ -2182,9 +2182,6 @@ DESCR("matches LIKE expression, case-insensitive");
DATA(insert OID = 1661 ( bpcharicnlike PGNSP PGUID 12 1 0 0 f f f t f i 2 0 16 "1042 25" _null_ _null_ _null_ _null_ texticnlike _null_ _null_ _null_ )); DATA(insert OID = 1661 ( bpcharicnlike PGNSP PGUID 12 1 0 0 f f f t f i 2 0 16 "1042 25" _null_ _null_ _null_ _null_ texticnlike _null_ _null_ _null_ ));
DESCR("does not match LIKE expression, case-insensitive"); DESCR("does not match LIKE expression, case-insensitive");
DATA(insert OID = 1689 ( flatfile_update_trigger PGNSP PGUID 12 1 0 0 f f f t f v 0 0 2279 "" _null_ _null_ _null_ _null_ flatfile_update_trigger _null_ _null_ _null_ ));
DESCR("update flat-file copy of a shared catalog");
/* Oracle Compatibility Related Functions - By Edmund Mergl <E.Mergl@bawue.de> */ /* Oracle Compatibility Related Functions - By Edmund Mergl <E.Mergl@bawue.de> */
DATA(insert OID = 868 ( strpos PGNSP PGUID 12 1 0 0 f f f t f i 2 0 23 "25 25" _null_ _null_ _null_ _null_ textpos _null_ _null_ _null_ )); DATA(insert OID = 868 ( strpos PGNSP PGUID 12 1 0 0 f f f t f i 2 0 23 "25 25" _null_ _null_ _null_ _null_ textpos _null_ _null_ _null_ ));
DESCR("find position of substring"); DESCR("find position of substring");
......
/*-------------------------------------------------------------------------
*
* flatfiles.h
* Routines for maintaining "flat file" images of the shared catalogs.
*
*
* $PostgreSQL: pgsql/src/include/utils/flatfiles.h,v 1.6 2005/10/15 02:49:46 momjian Exp $
*
*-------------------------------------------------------------------------
*/
#ifndef FLATFILES_H
#define FLATFILES_H
#include "fmgr.h"
extern void database_file_update_needed(void);
extern void auth_file_update_needed(void);
extern char *database_getflatfilename(void);
extern char *auth_getflatfilename(void);
extern void BuildFlatFiles(bool database_only);
extern void AtPrepare_UpdateFlatFiles(void);
extern void AtEOXact_UpdateFlatFiles(bool isCommit);
extern void AtEOSubXact_UpdateFlatFiles(bool isCommit,
SubTransactionId mySubid,
SubTransactionId parentSubid);
extern Datum flatfile_update_trigger(PG_FUNCTION_ARGS);
extern void flatfile_twophase_postcommit(TransactionId xid, uint16 info,
void *recdata, uint32 len);
#endif /* FLATFILES_H */
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment