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

Commita8bb8eb

Browse files
committed
Remove flatfiles.c, which is now obsolete.
Recent commits have removed the various uses it was supporting. It was aperformance bottleneck, according to bug report #4919 by Lauris Ulmanis; seemsit slowed down user creation after a billion users.
1 parent0905e8a commita8bb8eb

File tree

14 files changed

+36
-1159
lines changed

14 files changed

+36
-1159
lines changed

‎src/backend/access/transam/twophase_rmgr.c

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
*
99
*
1010
* IDENTIFICATION
11-
* $PostgreSQL: pgsql/src/backend/access/transam/twophase_rmgr.c,v 1.8 2009/01/0117:23:36 momjian Exp $
11+
* $PostgreSQL: pgsql/src/backend/access/transam/twophase_rmgr.c,v 1.9 2009/09/0102:54:51 alvherre Exp $
1212
*
1313
*-------------------------------------------------------------------------
1414
*/
@@ -18,7 +18,6 @@
1818
#include"commands/async.h"
1919
#include"pgstat.h"
2020
#include"storage/lock.h"
21-
#include"utils/flatfiles.h"
2221
#include"utils/inval.h"
2322

2423

@@ -27,7 +26,6 @@ const TwoPhaseCallback twophase_recover_callbacks[TWOPHASE_RM_MAX_ID + 1] =
2726
NULL,/* END ID */
2827
lock_twophase_recover,/* Lock */
2928
NULL,/* Inval */
30-
NULL,/* flat file update */
3129
NULL,/* notify/listen */
3230
NULL/* pgstat */
3331
};
@@ -37,7 +35,6 @@ const TwoPhaseCallback twophase_postcommit_callbacks[TWOPHASE_RM_MAX_ID + 1] =
3735
NULL,/* END ID */
3836
lock_twophase_postcommit,/* Lock */
3937
inval_twophase_postcommit,/* Inval */
40-
flatfile_twophase_postcommit,/* flat file update */
4138
notify_twophase_postcommit,/* notify/listen */
4239
pgstat_twophase_postcommit/* pgstat */
4340
};
@@ -47,7 +44,6 @@ const TwoPhaseCallback twophase_postabort_callbacks[TWOPHASE_RM_MAX_ID + 1] =
4744
NULL,/* END ID */
4845
lock_twophase_postabort,/* Lock */
4946
NULL,/* Inval */
50-
NULL,/* flat file update */
5147
NULL,/* notify/listen */
5248
pgstat_twophase_postabort/* pgstat */
5349
};

‎src/backend/access/transam/xact.c

Lines changed: 3 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
*
1111
*
1212
* IDENTIFICATION
13-
* $PostgreSQL: pgsql/src/backend/access/transam/xact.c,v 1.274 2009/06/11 14:48:54 momjian Exp $
13+
* $PostgreSQL: pgsql/src/backend/access/transam/xact.c,v 1.275 2009/09/01 02:54:51 alvherre Exp $
1414
*
1515
*-------------------------------------------------------------------------
1616
*/
@@ -43,7 +43,6 @@
4343
#include"storage/sinvaladt.h"
4444
#include"storage/smgr.h"
4545
#include"utils/combocid.h"
46-
#include"utils/flatfiles.h"
4746
#include"utils/guc.h"
4847
#include"utils/inval.h"
4948
#include"utils/memutils.h"
@@ -1608,12 +1607,6 @@ CommitTransaction(void)
16081607
/* NOTIFY commit must come before lower-level cleanup */
16091608
AtCommit_Notify();
16101609

1611-
/*
1612-
* Update flat files if we changed pg_database, pg_authid or
1613-
* pg_auth_members. This should be the last step before commit.
1614-
*/
1615-
AtEOXact_UpdateFlatFiles(true);
1616-
16171610
/* Prevent cancel/die interrupt while cleaning up */
16181611
HOLD_INTERRUPTS();
16191612

@@ -1797,7 +1790,7 @@ PrepareTransaction(void)
17971790
/* close large objects before lower-level cleanup */
17981791
AtEOXact_LargeObject(true);
17991792

1800-
/* NOTIFYand flatfileswill be handled below */
1793+
/* NOTIFY will be handled below */
18011794

18021795
/*
18031796
* Don't allow PREPARE TRANSACTION if we've accessed a temporary table in
@@ -1860,7 +1853,6 @@ PrepareTransaction(void)
18601853
StartPrepare(gxact);
18611854

18621855
AtPrepare_Notify();
1863-
AtPrepare_UpdateFlatFiles();
18641856
AtPrepare_Inval();
18651857
AtPrepare_Locks();
18661858
AtPrepare_PgStat();
@@ -1909,7 +1901,7 @@ PrepareTransaction(void)
19091901
/* Clean up the snapshot manager */
19101902
AtEarlyCommit_Snapshot();
19111903

1912-
/* notifyand flatfiles don't need a postprepare call */
1904+
/* notifydoesn't need a postprepare call */
19131905

19141906
PostPrepare_PgStat();
19151907

@@ -2036,7 +2028,6 @@ AbortTransaction(void)
20362028
AtAbort_Portals();
20372029
AtEOXact_LargeObject(false);/* 'false' means it's abort */
20382030
AtAbort_Notify();
2039-
AtEOXact_UpdateFlatFiles(false);
20402031

20412032
/*
20422033
* Advertise the fact that we aborted in pg_clog (assuming that we got as
@@ -3764,8 +3755,6 @@ CommitSubTransaction(void)
37643755
AtEOSubXact_LargeObject(true,s->subTransactionId,
37653756
s->parent->subTransactionId);
37663757
AtSubCommit_Notify();
3767-
AtEOSubXact_UpdateFlatFiles(true,s->subTransactionId,
3768-
s->parent->subTransactionId);
37693758

37703759
CallSubXactCallbacks(SUBXACT_EVENT_COMMIT_SUB,s->subTransactionId,
37713760
s->parent->subTransactionId);
@@ -3885,8 +3874,6 @@ AbortSubTransaction(void)
38853874
AtEOSubXact_LargeObject(false,s->subTransactionId,
38863875
s->parent->subTransactionId);
38873876
AtSubAbort_Notify();
3888-
AtEOSubXact_UpdateFlatFiles(false,s->subTransactionId,
3889-
s->parent->subTransactionId);
38903877

38913878
/* Advertise the fact that we aborted in pg_clog. */
38923879
(void)RecordTransactionAbort(true);

‎src/backend/access/transam/xlog.c

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
* Portions Copyright (c) 1996-2009, PostgreSQL Global Development Group
88
* Portions Copyright (c) 1994, Regents of the University of California
99
*
10-
* $PostgreSQL: pgsql/src/backend/access/transam/xlog.c,v 1.350 2009/08/31 02:23:22 tgl Exp $
10+
* $PostgreSQL: pgsql/src/backend/access/transam/xlog.c,v 1.351 2009/09/01 02:54:51 alvherre Exp $
1111
*
1212
*-------------------------------------------------------------------------
1313
*/
@@ -49,7 +49,6 @@
4949
#include"storage/smgr.h"
5050
#include"storage/spin.h"
5151
#include"utils/builtins.h"
52-
#include"utils/flatfiles.h"
5352
#include"utils/guc.h"
5453
#include"utils/ps_status.h"
5554
#include"pg_trace.h"
@@ -8077,8 +8076,6 @@ StartupProcessMain(void)
80778076

80788077
StartupXLOG();
80798078

8080-
BuildFlatFiles(false);
8081-
80828079
/*
80838080
* Exit normally. Exit code 0 tells postmaster that we completed recovery
80848081
* successfully.

‎src/backend/commands/dbcommands.c

Lines changed: 11 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
*
1414
*
1515
* IDENTIFICATION
16-
* $PostgreSQL: pgsql/src/backend/commands/dbcommands.c,v 1.225 2009/06/11 14:48:55 momjian Exp $
16+
* $PostgreSQL: pgsql/src/backend/commands/dbcommands.c,v 1.226 2009/09/01 02:54:51 alvherre Exp $
1717
*
1818
*-------------------------------------------------------------------------
1919
*/
@@ -49,7 +49,6 @@
4949
#include"storage/smgr.h"
5050
#include"utils/acl.h"
5151
#include"utils/builtins.h"
52-
#include"utils/flatfiles.h"
5352
#include"utils/fmgroids.h"
5453
#include"utils/guc.h"
5554
#include"utils/lsyscache.h"
@@ -691,19 +690,17 @@ createdb(const CreatedbStmt *stmt)
691690
RequestCheckpoint(CHECKPOINT_IMMEDIATE |CHECKPOINT_FORCE |CHECKPOINT_WAIT);
692691

693692
/*
694-
* Close pg_database, but keep lock till commit (this is important to
695-
* prevent any risk of deadlock failure while updating flat file)
693+
* Close pg_database, but keep lock till commit.
696694
*/
697695
heap_close(pg_database_rel,NoLock);
698696

699697
/*
700-
* Set flag to update flat database file at commit. Note: this also
701-
* forces synchronous commit, which minimizes the window between
698+
* Force synchronous commit, thus minimizing the window between
702699
* creation of the database files and commital of the transaction. If
703700
* we crash before committing, we'll have a DB that's taking up disk
704701
* space but is not in pg_database, which is not good.
705702
*/
706-
database_file_update_needed();
703+
ForceSyncCommit();
707704
}
708705
PG_END_ENSURE_ERROR_CLEANUP(createdb_failure_callback,
709706
PointerGetDatum(&fparms));
@@ -862,19 +859,17 @@ dropdb(const char *dbname, bool missing_ok)
862859
remove_dbtablespaces(db_id);
863860

864861
/*
865-
* Close pg_database, but keep lock till commit (this is important to
866-
* prevent any risk of deadlock failure while updating flat file)
862+
* Close pg_database, but keep lock till commit.
867863
*/
868864
heap_close(pgdbrel,NoLock);
869865

870866
/*
871-
* Set flag to update flat database file at commit. Note: this also
872-
* forces synchronous commit, which minimizes the window between removal
867+
* Force synchronous commit, thus minimizing the window between removal
873868
* of the database files and commital of the transaction. If we crash
874869
* before committing, we'll have a DB that's gone on disk but still there
875870
* according to pg_database, which is not good.
876871
*/
877-
database_file_update_needed();
872+
ForceSyncCommit();
878873
}
879874

880875

@@ -957,15 +952,9 @@ RenameDatabase(const char *oldname, const char *newname)
957952
CatalogUpdateIndexes(rel,newtup);
958953

959954
/*
960-
* Close pg_database, but keep lock till commit (this is important to
961-
* prevent any risk of deadlock failure while updating flat file)
955+
* Close pg_database, but keep lock till commit.
962956
*/
963957
heap_close(rel,NoLock);
964-
965-
/*
966-
* Set flag to update flat database file at commit.
967-
*/
968-
database_file_update_needed();
969958
}
970959

971960

@@ -1212,17 +1201,15 @@ movedb(const char *dbname, const char *tblspcname)
12121201
RequestCheckpoint(CHECKPOINT_IMMEDIATE |CHECKPOINT_FORCE |CHECKPOINT_WAIT);
12131202

12141203
/*
1215-
* Set flag to update flat database file at commit. Note: this also
1216-
* forces synchronous commit, which minimizes the window between
1204+
* Force synchronous commit, thus minimizing the window between
12171205
* copying the database files and commital of the transaction. If we
12181206
* crash before committing, we'll leave an orphaned set of files on
12191207
* disk, which is not fatal but not good either.
12201208
*/
1221-
database_file_update_needed();
1209+
ForceSyncCommit();
12221210

12231211
/*
1224-
* Close pg_database, but keep lock till commit (this is important to
1225-
* prevent any risk of deadlock failure while updating flat file)
1212+
* Close pg_database, but keep lock till commit.
12261213
*/
12271214
heap_close(pgdbrel,NoLock);
12281215
}
@@ -1401,11 +1388,6 @@ AlterDatabase(AlterDatabaseStmt *stmt, bool isTopLevel)
14011388

14021389
/* Close pg_database, but keep lock till commit */
14031390
heap_close(rel,NoLock);
1404-
1405-
/*
1406-
* We don't bother updating the flat file since the existing options for
1407-
* ALTER DATABASE don't affect it.
1408-
*/
14091391
}
14101392

14111393

@@ -1494,11 +1476,6 @@ AlterDatabaseSet(AlterDatabaseSetStmt *stmt)
14941476

14951477
/* Close pg_database, but keep lock till commit */
14961478
heap_close(rel,NoLock);
1497-
1498-
/*
1499-
* We don't bother updating the flat file since ALTER DATABASE SET doesn't
1500-
* affect it.
1501-
*/
15021479
}
15031480

15041481

@@ -1608,11 +1585,6 @@ AlterDatabaseOwner(const char *dbname, Oid newOwnerId)
16081585

16091586
/* Close pg_database, but keep lock till commit */
16101587
heap_close(rel,NoLock);
1611-
1612-
/*
1613-
* We don't bother updating the flat file since ALTER DATABASE OWNER
1614-
* doesn't affect it.
1615-
*/
16161588
}
16171589

16181590

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp