mirror of
https://github.com/postgres/postgres.git
synced 2025-08-27 07:42:10 +03:00
Create a "relation mapping" infrastructure to support changing the relfilenodes
of shared or nailed system catalogs. This has two key benefits: * The new CLUSTER-based VACUUM FULL can be applied safely to all catalogs. * We no longer have to use an unsafe reindex-in-place approach for reindexing shared catalogs. CLUSTER on nailed catalogs now works too, although I left it disabled on shared catalogs because the resulting pg_index.indisclustered update would only be visible in one database. Since reindexing shared system catalogs is now fully transactional and crash-safe, the former special cases in REINDEX behavior have been removed; shared catalogs are treated the same as non-shared. This commit does not do anything about the recently-discussed problem of deadlocks between VACUUM FULL/CLUSTER on a system catalog and other concurrent queries; will address that in a separate patch. As a stopgap, parallel_schedule has been tweaked to run vacuum.sql by itself, to avoid such failures during the regression tests.
This commit is contained in:
@@ -9,7 +9,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $PostgreSQL: pgsql/src/backend/bootstrap/bootparse.y,v 1.104 2010/01/28 23:21:11 petere Exp $
|
||||
* $PostgreSQL: pgsql/src/backend/bootstrap/bootparse.y,v 1.105 2010/02/07 20:48:09 tgl Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@@ -185,11 +185,26 @@ Boot_CreateStmt:
|
||||
RPAREN
|
||||
{
|
||||
TupleDesc tupdesc;
|
||||
bool shared_relation;
|
||||
bool mapped_relation;
|
||||
|
||||
do_start();
|
||||
|
||||
tupdesc = CreateTupleDesc(numattr, !($6), attrtypes);
|
||||
|
||||
shared_relation = $5;
|
||||
|
||||
/*
|
||||
* The catalogs that use the relation mapper are the
|
||||
* bootstrap catalogs plus the shared catalogs. If this
|
||||
* ever gets more complicated, we should invent a BKI
|
||||
* keyword to mark the mapped catalogs, but for now a
|
||||
* quick hack seems the most appropriate thing. Note in
|
||||
* particular that all "nailed" heap rels (see formrdesc
|
||||
* in relcache.c) must be mapped.
|
||||
*/
|
||||
mapped_relation = ($4 || shared_relation);
|
||||
|
||||
if ($4)
|
||||
{
|
||||
if (boot_reldesc)
|
||||
@@ -200,11 +215,12 @@ Boot_CreateStmt:
|
||||
|
||||
boot_reldesc = heap_create($2,
|
||||
PG_CATALOG_NAMESPACE,
|
||||
$5 ? GLOBALTABLESPACE_OID : 0,
|
||||
shared_relation ? GLOBALTABLESPACE_OID : 0,
|
||||
$3,
|
||||
tupdesc,
|
||||
RELKIND_RELATION,
|
||||
$5,
|
||||
shared_relation,
|
||||
mapped_relation,
|
||||
true);
|
||||
elog(DEBUG4, "bootstrap relation created");
|
||||
}
|
||||
@@ -214,7 +230,7 @@ Boot_CreateStmt:
|
||||
|
||||
id = heap_create_with_catalog($2,
|
||||
PG_CATALOG_NAMESPACE,
|
||||
$5 ? GLOBALTABLESPACE_OID : 0,
|
||||
shared_relation ? GLOBALTABLESPACE_OID : 0,
|
||||
$3,
|
||||
$7,
|
||||
InvalidOid,
|
||||
@@ -222,7 +238,8 @@ Boot_CreateStmt:
|
||||
tupdesc,
|
||||
NIL,
|
||||
RELKIND_RELATION,
|
||||
$5,
|
||||
shared_relation,
|
||||
mapped_relation,
|
||||
true,
|
||||
0,
|
||||
ONCOMMIT_NOOP,
|
||||
|
Reference in New Issue
Block a user