Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1Z64Ia-0003Fn-27 for pgsql-hackers@arkaria.postgresql.org; Fri, 19 Jun 2015 21:58:08 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.80) (envelope-from ) id 1Z64IZ-0006Im-Hv for pgsql-hackers@arkaria.postgresql.org; Fri, 19 Jun 2015 21:58:07 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:RSA_AES_256_CBC_SHA256:256) (Exim 4.80) (envelope-from ) id 1Z64IY-0006If-DQ for pgsql-hackers@postgresql.org; Fri, 19 Jun 2015 21:58:06 +0000 Received: from smtp-auth.no-ip.com ([8.23.224.61] helo=out.smtp-auth.no-ip.com) by magus.postgresql.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.84) (envelope-from ) id 1Z64IS-0007r7-OZ for pgsql-hackers@postgresql.org; Fri, 19 Jun 2015 21:58:05 +0000 X-No-IP: alvh.no-ip.org@noip-smtp X-Report-Spam-To: abuse@no-ip.com Received: from alvin.alvh.no-ip.org (unknown [184.151.246.72]) (Authenticated sender: alvh.no-ip.org@noip-smtp) by smtp-auth.no-ip.com (Postfix) with ESMTPA id A6CF44013A9; Fri, 19 Jun 2015 14:57:57 -0700 (PDT) Received: by alvin.alvh.no-ip.org (Postfix, from userid 1000) id CED303ECF; Fri, 19 Jun 2015 18:52:31 -0300 (CLT) Date: Fri, 19 Jun 2015 18:52:31 -0300 From: Alvaro Herrera To: Jim Nasby Cc: Josh Berkus , pgsql-hackers@postgresql.org Subject: Re: Need Multixact Freezing Docs Message-ID: <20150619215231.GT133018@postgresql.org> References: <534DA3D1.2010000@agliodbs.com> <534DB22A.2040909@agliodbs.com> <20140416133233.GL5822@eldon.alvh.no-ip.org> <534EC69B.9010107@agliodbs.com> <20150614145018.GE133018@postgresql.org> <557F6D32.8080508@BlueTreble.com> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="xkXJwpr35CY/Lc3I" Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <557F6D32.8080508@BlueTreble.com> User-Agent: Mutt/1.5.23 (2014-03-12) X-Pg-Spam-Score: -2.6 (--) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-hackers Precedence: bulk Sender: pgsql-hackers-owner@postgresql.org --xkXJwpr35CY/Lc3I Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit 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 --xkXJwpr35CY/Lc3I Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="pg_get_multixact_range-2.patch" 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 10:20:10,14,15 means xmin=10, xmax=20, xip_list=10, 14, 15. + + + pg_get_multixact_members + + + + pg_get_multixact_range + + + + The functions shown in + obtain information relative to multixacts in the system. + + + + Multixact Functions + + + Name Return Type Description + + + + + pg_get_multixact_range() + + oldestmultixid, + nextmultixid, + stopmultixid, + oldestmemberxid, + nextmemberxid, + stopmemberxid + + + get current oldest, next and stop limits for multixact IDs, + and oldest, next and stop limit for multixact members + + + + + pg_get_multixact_members(xid) + + xidxid, + modetext + + + get Xid and mode of the members of the given multixact + + + + +
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. + + + 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 + . + + 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); --xkXJwpr35CY/Lc3I Content-Type: text/plain Content-Disposition: inline Content-Transfer-Encoding: 8bit MIME-Version: 1.0 -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers --xkXJwpr35CY/Lc3I--