提交 fdd6d997 编写于 作者: H Heikki Linnakangas 提交者: Xin Zhang

Don't allow CREATE/DROP TABLESPACE in transaction. Like in upstream.

We had allowed it in GPDB, when we had all the fancy persistent table
and filespace mechanisms to track the created-but-not-yet-committed
tablespace creation. The upstream mechanism is more crude, and can't
handle that gracefully. For example, if you abort the CREATE TABLESPACE
transaction, the directory structure would be left behind. Or worse,
when you DROP TABLESPACE, the underlying directory is deleted immediately,
even if the transaction aborts. Hence, put back the upstream limitation.
That's been acceptable for Postgres, and is surely acceptable for GPDB
as well.
上级 e4c178f1
......@@ -708,14 +708,26 @@ ProcessUtility(Node *parsetree,
break;
case T_CreateTableSpaceStmt:
if (Gp_role != GP_ROLE_EXECUTE)
{
/*
* Don't allow master to call this in a transaction block. Segments
* are ok as distributed transaction participants.
*/
PreventTransactionChain(isTopLevel, "CREATE TABLESPACE");
}
CreateTableSpace((CreateTableSpaceStmt *) parsetree);
break;
case T_DropTableSpaceStmt:
/* In GPDB; this is allowed in a transaction */
#if 0
PreventTransactionChain(isTopLevel, "DROP TABLESPACE");
#endif
if (Gp_role != GP_ROLE_EXECUTE)
{
/*
* Don't allow master to call this in a transaction block. Segments are ok as
* distributed transaction participants.
*/
PreventTransactionChain(isTopLevel, "DROP TABLESPACE");
}
DropTableSpace((DropTableSpaceStmt *) parsetree);
break;
......@@ -1180,7 +1192,7 @@ ProcessUtility(Node *parsetree,
{
/*
* Don't allow master to call this in a transaction block. Segments
* are ok as distributed transaction participants.
* are ok as distributed transaction participants.
*/
PreventTransactionChain(isTopLevel, "CREATE DATABASE");
}
......@@ -1202,7 +1214,7 @@ ProcessUtility(Node *parsetree,
if (Gp_role != GP_ROLE_EXECUTE)
{
/*
* Don't allow master tp call this in a transaction block. Segments are ok as
* Don't allow master to call this in a transaction block. Segments are ok as
* distributed transaction participants.
*/
PreventTransactionChain(isTopLevel, "DROP DATABASE");
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册