Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
P
Postgres FD Implementation
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Abuhujair Javed
Postgres FD Implementation
Commits
36ad1a87
Commit
36ad1a87
authored
Sep 10, 2014
by
Bruce Momjian
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Implement mxid_age() to compute multi-xid age
Report by Josh Berkus
parent
84aa8ba1
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
26 additions
and
2 deletions
+26
-2
doc/src/sgml/maintenance.sgml
doc/src/sgml/maintenance.sgml
+6
-1
src/backend/utils/adt/xid.c
src/backend/utils/adt/xid.c
+16
-0
src/include/catalog/catversion.h
src/include/catalog/catversion.h
+1
-1
src/include/catalog/pg_proc.h
src/include/catalog/pg_proc.h
+2
-0
src/include/utils/builtins.h
src/include/utils/builtins.h
+1
-0
No files found.
doc/src/sgml/maintenance.sgml
View file @
36ad1a87
...
...
@@ -640,7 +640,12 @@ HINT: Stop the postmaster and vacuum that database in single-user mode.
possible multixact ID still appearing in any tuple of that table.
If this value is older than
<xref linkend="guc-vacuum-multixact-freeze-table-age">, a whole-table
scan is forced. Whole-table <command>VACUUM</> scans, regardless of
scan is forced. <function>mxid_age()</> can be used on
<structname>pg_class</>.<structfield>relminmxid</> to find its age.
</para>
<para>
Whole-table <command>VACUUM</> scans, regardless of
what causes them, enable advancing the value for that table.
Eventually, as all tables in all databases are scanned and their
oldest multixact values are advanced, on-disk storage for older
...
...
src/backend/utils/adt/xid.c
View file @
36ad1a87
...
...
@@ -16,6 +16,7 @@
#include <limits.h>
#include "access/multixact.h"
#include "access/transam.h"
#include "access/xact.h"
#include "libpq/pqformat.h"
...
...
@@ -102,6 +103,21 @@ xid_age(PG_FUNCTION_ARGS)
PG_RETURN_INT32
((
int32
)
(
now
-
xid
));
}
/*
* mxid_age - compute age of a multi XID (relative to latest stable mxid)
*/
Datum
mxid_age
(
PG_FUNCTION_ARGS
)
{
TransactionId
xid
=
PG_GETARG_TRANSACTIONID
(
0
);
MultiXactId
now
=
ReadNextMultiXactId
();
if
(
!
MultiXactIdIsValid
(
xid
))
PG_RETURN_INT32
(
INT_MAX
);
PG_RETURN_INT32
((
int32
)
(
now
-
xid
));
}
/*
* xidComparator
* qsort comparison function for XIDs
...
...
src/include/catalog/catversion.h
View file @
36ad1a87
...
...
@@ -53,6 +53,6 @@
*/
/* yyyymmddN */
#define CATALOG_VERSION_NO 201409
09
1
#define CATALOG_VERSION_NO 201409
10
1
#endif
src/include/catalog/pg_proc.h
View file @
36ad1a87
...
...
@@ -1279,6 +1279,8 @@ DATA(insert OID = 1180 ( abstime PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 7
DESCR
(
"convert timestamp with time zone to abstime"
);
DATA
(
insert
OID
=
1181
(
age
PGNSP
PGUID
12
1
0
0
0
f
f
f
f
t
f
s
1
0
23
"28"
_null_
_null_
_null_
_null_
xid_age
_null_
_null_
_null_
));
DESCR
(
"age of a transaction ID, in transactions before current transaction"
);
DATA
(
insert
OID
=
3939
(
mxid_age
PGNSP
PGUID
12
1
0
0
0
f
f
f
f
t
f
s
1
0
23
"28"
_null_
_null_
_null_
_null_
mxid_age
_null_
_null_
_null_
));
DESCR
(
"age of a multi-transaction ID, in multi-transactions before current multi-transaction"
);
DATA
(
insert
OID
=
1188
(
timestamptz_mi
PGNSP
PGUID
12
1
0
0
0
f
f
f
f
t
f
i
2
0
1186
"1184 1184"
_null_
_null_
_null_
_null_
timestamp_mi
_null_
_null_
_null_
));
DATA
(
insert
OID
=
1189
(
timestamptz_pl_interval
PGNSP
PGUID
12
1
0
0
0
f
f
f
f
t
f
s
2
0
1184
"1184 1186"
_null_
_null_
_null_
_null_
timestamptz_pl_interval
_null_
_null_
_null_
));
...
...
src/include/utils/builtins.h
View file @
36ad1a87
...
...
@@ -845,6 +845,7 @@ extern Datum xidrecv(PG_FUNCTION_ARGS);
extern
Datum
xidsend
(
PG_FUNCTION_ARGS
);
extern
Datum
xideq
(
PG_FUNCTION_ARGS
);
extern
Datum
xid_age
(
PG_FUNCTION_ARGS
);
extern
Datum
mxid_age
(
PG_FUNCTION_ARGS
);
extern
int
xidComparator
(
const
void
*
arg1
,
const
void
*
arg2
);
extern
Datum
cidin
(
PG_FUNCTION_ARGS
);
extern
Datum
cidout
(
PG_FUNCTION_ARGS
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment