Artificially increase TransactionID?

Started by Robert A. Klahnover 18 years ago4 messages
#1Robert A. Klahn
robert@kint.org
1 attachment(s)

Greetings:

I am interested in increasing the PostgreSQL TransactionID, as part
of testing a (yet another) replication system that I am working on.
(http://bruce.codehaus.org/ for the interested). I would like to test
what happens when the transactionID crosses 2^31 and when it wraps
around at 2^32-1. Other than running "select now()" 2^31 times, is
there a practical way to raise the transactionID by large amounts?

I need to test against Pg 8.1.X and 8.2.X, and probably 8.3 while Im
at it.

Many thanks in advance.....Bob.

Attachments:

smime.p7sapplication/pkcs7-signature; name=smime.p7sDownload
#2Joshua D. Drake
jd@commandprompt.com
In reply to: Robert A. Klahn (#1)
Re: Artificially increase TransactionID?

On Wed, 10 Oct 2007 17:57:57 -0700
"Robert A. Klahn" <robert@kint.org> wrote:

Greetings:

I am interested in increasing the PostgreSQL TransactionID, as part
of testing a (yet another) replication system that I am working on.
(http://bruce.codehaus.org/ for the interested). I would like to
test what happens when the transactionID crosses 2^31 and when it
wraps around at 2^32-1. Other than running "select now()" 2^31 times,
is there a practical way to raise the transactionID by large amounts?

I need to test against Pg 8.1.X and 8.2.X, and probably 8.3 while Im
at it.

Well without significant changes, my guess is what will happen is
postgresql will shut itself down and make you vacuum :)

Joshua D. Drake

Many thanks in advance.....Bob.

--

=== The PostgreSQL Company: Command Prompt, Inc. ===
Sales/Support: +1.503.667.4564 24x7/Emergency: +1.800.492.2240
PostgreSQL solutions since 1997 http://www.commandprompt.com/
UNIQUE NOT NULL
Donate to the PostgreSQL Project: http://www.postgresql.org/about/donate
PostgreSQL Replication: http://www.commandprompt.com/products/

#3Tom Lane
tgl@sss.pgh.pa.us
In reply to: Robert A. Klahn (#1)
Re: Artificially increase TransactionID?

"Robert A. Klahn" <robert@kint.org> writes:

I am interested in increasing the PostgreSQL TransactionID, as part
of testing a (yet another) replication system that I am working on.
(http://bruce.codehaus.org/ for the interested). I would like to test
what happens when the transactionID crosses 2^31 and when it wraps
around at 2^32-1. Other than running "select now()" 2^31 times, is
there a practical way to raise the transactionID by large amounts?

Shut down postmaster, use pg_resetxlog to set NextXID to whatever you
want, restart and test. You might need to artificially create pg_clog
and pg_subtrans segments matching the chosen starting point, but other
than that there's not a lot of memory of latest XID in the system.

Bumping it by more than 2G-less-reasonable-safety-margin is unfair of
course ...

regards, tom lane

#4Robert A. Klahn
robert@kint.org
In reply to: Tom Lane (#3)
1 attachment(s)
Re: Artificially increase TransactionID?

Works perfectly. I did need to artificially create pg_clog segments.

Tom: Thanks for the quick response.....

Bob.

On Oct 10, 2007, at 8:46 PM, Tom Lane wrote:

Show quoted text

"Robert A. Klahn" <robert@kint.org> writes:

I am interested in increasing the PostgreSQL TransactionID, as part
of testing a (yet another) replication system that I am working on.
(http://bruce.codehaus.org/ for the interested). I would like to test
what happens when the transactionID crosses 2^31 and when it wraps
around at 2^32-1. Other than running "select now()" 2^31 times, is
there a practical way to raise the transactionID by large amounts?

Shut down postmaster, use pg_resetxlog to set NextXID to whatever you
want, restart and test. You might need to artificially create pg_clog
and pg_subtrans segments matching the chosen starting point, but other
than that there's not a lot of memory of latest XID in the system.

Bumping it by more than 2G-less-reasonable-safety-margin is unfair of
course ...

regards, tom lane

Attachments:

smime.p7sapplication/pkcs7-signature; name=smime.p7sDownload