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

Commit50be3e5

Browse files
committed
The following patch cleans up the deferred trigger mechanism. There is
an unneeded memory context and some variables that are not used anymore.It's pretty trivial and the regression tests pass fine. There's nochange in functionality, only deletion of unused code. I left an emptyfunction because maybe I'll need it for nested transactions.Alvaro Herrera
1 parent7cd30e1 commit50be3e5

File tree

1 file changed

+10
-37
lines changed

1 file changed

+10
-37
lines changed

‎src/backend/commands/trigger.c

Lines changed: 10 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,15 @@
77
* Portions Copyright (c) 1994, Regents of the University of California
88
*
99
* IDENTIFICATION
10-
* $Header: /cvsroot/pgsql/src/backend/commands/trigger.c,v 1.146 2003/03/27 14:33:11 tgl Exp $
10+
* $Header: /cvsroot/pgsql/src/backend/commands/trigger.c,v 1.147 2003/03/31 20:47:51 momjian Exp $
1111
*
1212
*-------------------------------------------------------------------------
1313
*/
1414
#include"postgres.h"
1515

1616
#include"access/genam.h"
1717
#include"access/heapam.h"
18+
#include"access/xact.h"
1819
#include"catalog/catalog.h"
1920
#include"catalog/catname.h"
2021
#include"catalog/dependency.h"
@@ -1601,23 +1602,19 @@ ltrmark:;
16011602
*/
16021603

16031604

1604-
/* ----------
1605-
* Internal data to the deferred trigger mechanism is held
1606-
* during entire session in a global context created at startup and
1607-
* over statements/commands in a separate context which
1608-
* is created at transaction start and destroyed at transaction end.
1609-
* ----------
1605+
/*
1606+
* Internal data to the deferred trigger mechanism is held over
1607+
* statements/commands in a context which is created at transaction
1608+
* start and destroyed at transaction end.
16101609
*/
1611-
staticMemoryContextdeftrig_gcxt=NULL;
1610+
16121611
staticMemoryContextdeftrig_cxt=NULL;
16131612

16141613
/* ----------
16151614
* Global data that tells which triggers are actually in
16161615
* state IMMEDIATE or DEFERRED.
16171616
* ----------
16181617
*/
1619-
staticList*deftrig_dfl_trigstates=NIL;
1620-
16211618
staticbooldeftrig_all_isset= false;
16221619
staticbooldeftrig_all_isdeferred= false;
16231620
staticList*deftrig_trigstates;
@@ -2017,11 +2014,8 @@ deferredTriggerInvokeEvents(bool immediate_only)
20172014
void
20182015
DeferredTriggerInit(void)
20192016
{
2020-
deftrig_gcxt=AllocSetContextCreate(TopMemoryContext,
2021-
"DeferredTriggerSession",
2022-
ALLOCSET_DEFAULT_MINSIZE,
2023-
ALLOCSET_DEFAULT_INITSIZE,
2024-
ALLOCSET_DEFAULT_MAXSIZE);
2017+
/* Nothing to do */
2018+
;
20252019
}
20262020

20272021

@@ -2035,26 +2029,18 @@ DeferredTriggerInit(void)
20352029
void
20362030
DeferredTriggerBeginXact(void)
20372031
{
2038-
MemoryContextoldcxt;
2039-
List*l;
2040-
DeferredTriggerStatusdflstat;
2041-
DeferredTriggerStatusstat;
2042-
20432032
if (deftrig_cxt!=NULL)
20442033
elog(ERROR,
20452034
"DeferredTriggerBeginXact() called while inside transaction");
20462035

20472036
/*
2048-
* Create the per transaction memory context and copy all states from
2049-
* the per session context to here.
2037+
* Create the per transaction memory context
20502038
*/
20512039
deftrig_cxt=AllocSetContextCreate(TopTransactionContext,
20522040
"DeferredTriggerXact",
20532041
ALLOCSET_DEFAULT_MINSIZE,
20542042
ALLOCSET_DEFAULT_INITSIZE,
20552043
ALLOCSET_DEFAULT_MAXSIZE);
2056-
oldcxt=MemoryContextSwitchTo(deftrig_cxt);
2057-
20582044
deftrig_all_isset= false;
20592045

20602046
/*
@@ -2063,19 +2049,6 @@ DeferredTriggerBeginXact(void)
20632049
deftrig_all_isdeferred= false;
20642050

20652051
deftrig_trigstates=NIL;
2066-
foreach(l,deftrig_dfl_trigstates)
2067-
{
2068-
dflstat= (DeferredTriggerStatus)lfirst(l);
2069-
stat= (DeferredTriggerStatus)
2070-
palloc(sizeof(DeferredTriggerStatusData));
2071-
2072-
stat->dts_tgoid=dflstat->dts_tgoid;
2073-
stat->dts_tgisdeferred=dflstat->dts_tgisdeferred;
2074-
2075-
deftrig_trigstates=lappend(deftrig_trigstates,stat);
2076-
}
2077-
2078-
MemoryContextSwitchTo(oldcxt);
20792052

20802053
deftrig_events=NULL;
20812054
deftrig_event_tail=NULL;

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp