1
0
mirror of https://github.com/postgres/postgres.git synced 2025-11-04 20:11:56 +03:00

Fix TransactionIdIsCurrentTransactionId() to use binary search instead of

linear search when checking child-transaction XIDs.  This makes for an
important speedup in transactions that have large numbers of children,
as in a recent example from Craig Ringer.  We can also get rid of an
ugly kluge that represented lists of TransactionIds as lists of OIDs.

Heikki Linnakangas
This commit is contained in:
Tom Lane
2008-03-17 02:18:55 +00:00
parent a7c58abeb1
commit 32846f8152
3 changed files with 128 additions and 72 deletions

View File

@@ -26,16 +26,11 @@
* (At the moment, ints and Oids are the same size, but they may not
* always be so; try to be careful to maintain the distinction.)
*
* There is also limited support for lists of TransactionIds; since these
* are used in only one or two places, we don't provide a full implementation,
* but map them onto Oid lists. This effectively assumes that TransactionId
* is no wider than Oid and both are unsigned types.
*
*
* Portions Copyright (c) 1996-2008, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
* $PostgreSQL: pgsql/src/include/nodes/pg_list.h,v 1.57 2008/01/01 19:45:58 momjian Exp $
* $PostgreSQL: pgsql/src/include/nodes/pg_list.h,v 1.58 2008/03/17 02:18:55 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -159,12 +154,6 @@ extern int list_length(List *l);
#define list_make3_oid(x1,x2,x3) lcons_oid(x1, list_make2_oid(x2, x3))
#define list_make4_oid(x1,x2,x3,x4) lcons_oid(x1, list_make3_oid(x2, x3, x4))
/*
* Limited support for lists of TransactionIds, mapped onto lists of Oids
*/
#define lfirst_xid(lc) ((TransactionId) lfirst_oid(lc))
#define lappend_xid(list, datum) lappend_oid(list, (Oid) (datum))
/*
* foreach -
* a convenience macro which loops through the list