提交 865f132a 编写于 作者: G Georgios Kokolatos

Remove duplicating code in vacuumStatement_Relation

vacuum_rel already performs the tests and all current codepaths
pass through it. Block decorated by GPDB_93_MERGE_FIXME tag.
Reviewed-by: NHeikki Linnakangas <hlinnakangas@pivotal.io>
上级 7c3dfb65
......@@ -730,46 +730,6 @@ vacuumStatement_Relation(VacuumStmt *vacstmt, Oid relid,
return;
}
/*
* Check that it's a plain table; we used to do this in get_rel_oids() but
* seems safer to check after we've locked the relation.
*/
/*
* GPDB_93_MERGE_FIXME: this is the same test we have in vacuum_rel. Can we
* get rid of the redundancy?
*/
if ((onerel->rd_rel->relkind != RELKIND_RELATION &&
onerel->rd_rel->relkind != RELKIND_MATVIEW &&
onerel->rd_rel->relkind != RELKIND_TOASTVALUE &&
onerel->rd_rel->relkind != RELKIND_AOSEGMENTS &&
onerel->rd_rel->relkind != RELKIND_AOBLOCKDIR &&
onerel->rd_rel->relkind != RELKIND_AOVISIMAP)
|| RelationIsExternal(onerel))
{
ereport(WARNING,
(errmsg("skipping \"%s\" --- cannot vacuum non-tables or special system tables",
RelationGetRelationName(onerel))));
relation_close(onerel, lmode);
PopActiveSnapshot();
CommitTransactionCommand();
return;
}
/*
* Silently ignore tables that are temp tables of other backends ---
* trying to vacuum these will lead to great unhappiness, since their
* contents are probably not up-to-date on disk. (We don't throw a
* warning here; it would just lead to chatter during a database-wide
* VACUUM.)
*/
if (isOtherTempNamespace(RelationGetNamespace(onerel)))
{
relation_close(onerel, lmode);
PopActiveSnapshot();
CommitTransactionCommand();
return;
}
/*
* Get a session-level lock too. This will protect our access to the
* relation across multiple transactions, so that we can vacuum the
......
......@@ -328,3 +328,8 @@ SELECT relname, reltuples, relpages FROM pg_catalog.pg_class WHERE relname like
(3 rows)
reset gp_autostats_mode;
-- Check forbidden relkind for vacuum is correctly skipped
CREATE SEQUENCE s_serial START 100;
VACUUM (ANALYZE, VERBOSE) s_serial;
WARNING: skipping "s_serial" --- cannot vacuum non-tables or special system tables
DROP SEQUENCE s_serial;
......@@ -202,3 +202,8 @@ SELECT relname, reltuples, relpages FROM pg_catalog.pg_class WHERE relname like
VACUUM ANALYZE vacuum_gp_pt;
SELECT relname, reltuples, relpages FROM pg_catalog.pg_class WHERE relname like 'vacuum_gp_pt%';
reset gp_autostats_mode;
-- Check forbidden relkind for vacuum is correctly skipped
CREATE SEQUENCE s_serial START 100;
VACUUM (ANALYZE, VERBOSE) s_serial;
DROP SEQUENCE s_serial;
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册