pg.ddx.io  pgsql-hackers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Alvaro Herrera <alvherre@2ndquadrant.com>
To: Jim Nasby <Jim.Nasby@BlueTreble.com>
Cc: Josh Berkus <josh@agliodbs.com>
Cc: pgsql-hackers@postgresql.org
Subject: Re: Need Multixact Freezing Docs
Date: Fri, 19 Jun 2015 18:52:31 -0300
Message-ID: <20150619215231.GT133018@postgresql.org> (raw)
In-Reply-To: <557F6D32.8080508@BlueTreble.com>
References: <534DA3D1.2010000@agliodbs.com>
	<WM!e71c36af513bace4ff046f7349231f370d2b74c4adee803b2eb3ed330aada82b5badd712b47f9556d3fa55d2ab73a3e0!@asav-3.01.com>
	<534DB22A.2040909@agliodbs.com>
	<20140416133233.GL5822@eldon.alvh.no-ip.org>
	<WM!a70b2681d2ac0ed55eb2d3eed44e6730e9c71b5fad8c5320503fde8b18a03fd98a6af6244821ca39d47c1d9e758c45ff!@asav-2.01.com>
	<534EC69B.9010107@agliodbs.com>
	<20150614145018.GE133018@postgresql.org>
	<557F6D32.8080508@BlueTreble.com>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-hackers>

Jim Nasby wrote:
> On 6/14/15 9:50 AM, Alvaro Herrera wrote:
> >+	values[0] = MultiXactState->oldestMultiXactId;
> 
> What about oldestOffset and offsetStopLimit? Seems those would be useful
> too. Looks good other than that.

Yeah, that's what I was trying to say.  How about this?

I realized that pg_get_multixact_members() was not documented, so I
added a blurb about it too.  I guess I could backpatch that part to 9.3
because it's been present all along.

-- 
Álvaro Herrera                http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services

-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

Attachments:

pg_get_multixact_range-2.patch (text/x-diff, 5.7K) download diff --git a/doc/src/sgml/func.sgml b/doc/src/sgml/func.sgml index 9a2a1f6..1925c6c 100644 --- a/doc/src/sgml/func.sgml +++ b/doc/src/sgml/func.sgml @@ -14874,6 +14874,57 @@ SELECT collation for ('foo' COLLATE "de_DE"); For example <literal>10:20:10,14,15</literal> means <literal>xmin=10, xmax=20, xip_list=10, 14, 15</literal>. </para> + + <indexterm> + <primary>pg_get_multixact_members</primary> + </indexterm> + + <indexterm> + <primary>pg_get_multixact_range</primary> + </indexterm> + + <para> + The functions shown in <xref linkend="functions-info-multixact-table"> + obtain information relative to multixacts in the system. + </para> + + <table id="functions-info-multixact-table"> + <title>Multixact Functions</title> + <tgroup cols="3"> + <thead> + <row><entry>Name</entry> <entry>Return Type</entry> <entry>Description</entry></row> + </thead> + + <tbody> + <row> + <entry><literal><function>pg_get_multixact_range()</function></literal></entry> + <entry> + <parameter>oldestmulti</parameter><type>xid</type>, + <parameter>nextmulti</parameter><type>xid</type>, + <parameter>stopmulti</parameter><type>xid</type>, + <parameter>oldestmember</parameter><type>xid</type>, + <parameter>nextmember</parameter><type>xid</type>, + <parameter>stopmember</parameter><type>xid</type> + </entry> + <entry> + get current oldest, next and stop limits for multixact IDs, + and oldest, next and stop limit for multixact members + </entry> + </row> + + <row> + <entry><literal><function>pg_get_multixact_members(<type>xid</type>)</function></literal></entry> + <entry> + <parameter>xid</parameter><type>xid</type>, + <parameter>mode</parameter><type>text</type> + </entry> + <entry> + get Xid and mode of the members of the given multixact + </entry> + </row> + </tbody> + </tgroup> + </table> </sect1> <sect1 id="functions-admin"> diff --git a/doc/src/sgml/maintenance.sgml b/doc/src/sgml/maintenance.sgml index 4383862..db4d457 100644 --- a/doc/src/sgml/maintenance.sgml +++ b/doc/src/sgml/maintenance.sgml @@ -662,6 +662,14 @@ HINT: Stop the postmaster and use a standalone backend to VACUUM in "mydb". Both of these kinds of whole-table scans will occur even if autovacuum is nominally disabled. </para> + + <para> + To know the limits of the live range of both the multixact ID counter and + of the members storage area, and the limits which would cause further + multixact creation to be rejected, see + <xref linkend="functions-info-multixact-table">. + </para> + </sect3> </sect2> diff --git a/src/backend/access/transam/multixact.c b/src/backend/access/transam/multixact.c index 5c25c2f..296c85b 100644 --- a/src/backend/access/transam/multixact.c +++ b/src/backend/access/transam/multixact.c @@ -66,6 +66,7 @@ */ #include "postgres.h" +#include "access/htup_details.h" #include "access/multixact.h" #include "access/slru.h" #include "access/transam.h" @@ -3308,3 +3309,38 @@ pg_get_multixact_members(PG_FUNCTION_ARGS) SRF_RETURN_DONE(funccxt); } + +Datum +pg_get_multixact_range(PG_FUNCTION_ARGS) +{ + TupleDesc tupdesc; + HeapTuple htup; + Datum values[6]; + bool nulls[6]; + + /* Build a tuple descriptor for our result type */ + if (get_call_result_type(fcinfo, NULL, &tupdesc) != TYPEFUNC_COMPOSITE) + elog(ERROR, "return type must be a row type"); + tupdesc = BlessTupleDesc(tupdesc); + + MemSet(nulls, 0, sizeof(nulls)); + + LWLockAcquire(MultiXactGenLock, LW_SHARED); + values[0] = MultiXactState->oldestMultiXactId; + values[1] = MultiXactState->nextMXact; + values[2] = MultiXactState->multiStopLimit; + if (MultiXactState->oldestOffsetKnown) + values[3] = MultiXactState->oldestOffset; + else + nulls[3] = true; + values[4] = MultiXactState->nextOffset; + if (MultiXactState->offsetStopLimitKnown) + values[5] = MultiXactState->offsetStopLimit; + else + nulls[5] = true; + LWLockRelease(MultiXactGenLock); + + htup = heap_form_tuple(tupdesc, values, nulls); + + PG_RETURN_DATUM(HeapTupleGetDatum(htup)); +} diff --git a/src/include/catalog/pg_proc.h b/src/include/catalog/pg_proc.h index 92af36d..8241732 100644 --- a/src/include/catalog/pg_proc.h +++ b/src/include/catalog/pg_proc.h @@ -2911,6 +2911,8 @@ DATA(insert OID = 1065 ( pg_prepared_xact PGNSP PGUID 12 1 1000 0 0 f f f f t t DESCR("view two-phase transactions"); DATA(insert OID = 3819 ( pg_get_multixact_members PGNSP PGUID 12 1 1000 0 0 f f f f t t v 1 0 2249 "28" "{28,28,25}" "{i,o,o}" "{multixid,xid,mode}" _null_ pg_get_multixact_members _null_ _null_ _null_ )); DESCR("view members of a multixactid"); +DATA(insert OID = 3846 ( pg_get_multixact_range PGNSP PGUID 12 1 0 0 0 f f f f t f s 0 0 2249 "" "{28,28,28,28,28,28}" "{o,o,o,o,o,o}" "{oldestmulti,nextmulti,stopmulti,oldestmember,nextmember,stopmember}" _null_ pg_get_multixact_range _null_ _null_ _null_ )); +DESCR("get range and limits of multixacts"); DATA(insert OID = 3537 ( pg_describe_object PGNSP PGUID 12 1 0 0 0 f f f f t f s 3 0 25 "26 26 23" _null_ _null_ _null_ _null_ pg_describe_object _null_ _null_ _null_ )); DESCR("get identification of SQL object"); diff --git a/src/include/utils/builtins.h b/src/include/utils/builtins.h index 929a728..2fd612c 100644 --- a/src/include/utils/builtins.h +++ b/src/include/utils/builtins.h @@ -1143,6 +1143,7 @@ extern Datum pg_prepared_xact(PG_FUNCTION_ARGS); /* access/transam/multixact.c */ extern Datum pg_get_multixact_members(PG_FUNCTION_ARGS); +extern Datum pg_get_multixact_range(PG_FUNCTION_ARGS); /* catalogs/dependency.c */ extern Datum pg_describe_object(PG_FUNCTION_ARGS);

view thread (18+ messages)

Message-ID: <20150619215231.GT133018@postgresql.org>
Permalink:  ../20150619215231.GT133018@postgresql.org/
Also on:    postgresql.org/message-id/20150619215231.GT133018@postgresql.org

 ·  · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-hackers@postgresql.org
  Cc: alvherre@2ndquadrant.com, Jim.Nasby@BlueTreble.com, josh@agliodbs.com
  Subject: Re: Need Multixact Freezing Docs
  In-Reply-To: <20150619215231.GT133018@postgresql.org>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox