Skip to content

Commit d77717b

Browse files
committed
Code review for txid patch: add binary I/O functions, avoid dependence
on SerializableSnapshot, minor other cleanup. Marko Kreen, some further editorialization by me.
1 parent 1246fcd commit d77717b

File tree

5 files changed

+224
-131
lines changed

5 files changed

+224
-131
lines changed

contrib/txid/Makefile

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1+
# $PostgreSQL: pgsql/contrib/txid/Makefile,v 1.2 2007/10/11 19:54:17 tgl Exp $
12

23
MODULES = txid
34
DATA_built = txid.sql
45
DATA = uninstall_txid.sql
56
DOCS = README.txid
67
REGRESS = txid
78

8-
99
ifdef USE_PGXS
1010
PG_CONFIG = pg_config
1111
PGXS := $(shell $(PG_CONFIG) --pgxs)
@@ -16,11 +16,3 @@ top_builddir = ../..
1616
include $(top_builddir)/src/Makefile.global
1717
include $(top_srcdir)/contrib/contrib-global.mk
1818
endif
19-
20-
21-
test: install
22-
$(MAKE) installcheck || { less regression.diffs; exit 1; }
23-
24-
ack:
25-
cp results/* expected/
26-

contrib/txid/README.txid

Lines changed: 11 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
1+
txid - export transaction IDs to user level
2+
===========================================
13

2-
txid - export transaction id's to user level
3-
============================================
4-
5-
The goal is to make PostgreSQL internal transaction ID and snapshot
4+
The goal is to make PostgreSQL's internal transaction ID and snapshot
65
data usable externally. This allows very efficient queue
76
implementation done inside database.
87

@@ -32,7 +31,7 @@ txid_snapshot_xmax( snap ) returns int8
3231
txid_snapshot_xip( snap ) setof int8
3332

3433
List of in-progress TXID's in snapshot, that are invisible.
35-
Values are between xmin and xmax.
34+
Values are between xmin (inclusive) and xmax (exclusive).
3635

3736
txid_visible_in_snapshot(id, snap) returns bool
3837

@@ -73,8 +72,8 @@ fetching possible txids below snap1.xmax explicitly:
7372
AND NOT txid_visible_in_snapshot(ev_txid, :snap1)
7473
AND txid_visible_in_snapshot(ev_txid, :snap2);
7574

76-
Note that although the above queries work, the PostgreSQL fails to
77-
plan them correctly. For actual usage the values for txid_snapshot_xmin,
75+
Note that although the above queries work, PostgreSQL fails to
76+
plan them efficiently. For actual usage the values for txid_snapshot_xmin,
7877
txid_snapshot_xmax and txid_snapshot_xip should be filled in directly,
7978
only then will they use index.
8079

@@ -92,20 +91,16 @@ To see example code for that it's best to see pgq.batch_event_sql() function in
9291
Dumping and restoring data containing TXIDs.
9392
--------------------------------------------
9493

95-
[towrite: reason for epoch increase]
96-
97-
You can look at current epoch with query:
98-
99-
SELECT txid_current() >> 32 as epoch;
94+
When reloading TXID data you will typically want to be sure that the current
95+
XID counter is beyond the reloaded data. The easiest way to do this is to
96+
increase the XID epoch to beyond the largest one in the input data.
10097

101-
So new epoch should be:
98+
You can look at current epoch with queries such as:
10299

103-
SELECT (txid_current() >> 32) + 1 as newepoch;
100+
SELECT MAX(txid) >> 32 as epoch FROM ...;
104101

105102
Epoch can be changed with pg_resetxlog command:
106103

107104
pg_resetxlog -e NEWEPOCH DATADIR
108105

109106
Database needs to be shut down for that moment.
110-
111-

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy