Repository: incubator-hawq
Updated Branches:
  refs/heads/master 2984ec6f9 -> 6345f8de1


Revert "HAWQ-322. Fixed DROP TABLESPACE doesnot check 
sub-object(database/relation) in some cases" because installcheck-good find a 
new bug after it fixed.

This reverts commit ba500a5c05a8518c3c5abc401583a90f8d28f0b7.


Project: http://git-wip-us.apache.org/repos/asf/incubator-hawq/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-hawq/commit/6345f8de
Tree: http://git-wip-us.apache.org/repos/asf/incubator-hawq/tree/6345f8de
Diff: http://git-wip-us.apache.org/repos/asf/incubator-hawq/diff/6345f8de

Branch: refs/heads/master
Commit: 6345f8de194029fc1f8b9b58011727a11813eb5f
Parents: 2984ec6
Author: Ming LI <m...@pivotal.io>
Authored: Thu Jan 14 15:55:17 2016 +0800
Committer: Ming LI <m...@pivotal.io>
Committed: Thu Jan 14 15:55:17 2016 +0800

----------------------------------------------------------------------
 src/backend/commands/tablespace.c | 53 ++--------------------------------
 1 file changed, 3 insertions(+), 50 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/6345f8de/src/backend/commands/tablespace.c
----------------------------------------------------------------------
diff --git a/src/backend/commands/tablespace.c 
b/src/backend/commands/tablespace.c
index 54a9f97..3b4c6f7 100644
--- a/src/backend/commands/tablespace.c
+++ b/src/backend/commands/tablespace.c
@@ -60,7 +60,6 @@
 #include "catalog/indexing.h"
 #include "catalog/pg_filespace.h"
 #include "catalog/pg_tablespace.h"
-#include "catalog/pg_database.h"
 #include "catalog/pg_type.h"
 #include "cdb/cdbmirroredflatfile.h"
 #include "commands/comment.h"
@@ -276,7 +275,7 @@ void
 RemoveTableSpace(List *names, DropBehavior behavior, bool missing_ok)
 {
        char        *tablespacename;
-       Relation         rel, rel1;
+       Relation         rel;
        HeapTuple        tuple;
        cqContext                                        cqc;
        cqContext                                       *pcqCtx;
@@ -362,55 +361,9 @@ RemoveTableSpace(List *names, DropBehavior behavior, bool 
missing_ok)
         * Check for any databases or relations defined in this tablespace, 
this 
         * is logically the same as checkSharedDependencies, however we don't 
         * actually track these in pg_shdepend, instead we lookup this 
information 
-        * in the related catalog. The reason why we don't based on the 
persistent
-     * table (gp_persistent_database/relation_node) is:
-     * it will has concurrency problem because there is no 2-phrase-lock
-     * for persistent table.
+        * in the gp_persistent_database/relation_node tables.
         */
-
-       /*
-        * Check for any databases defined in this tablespace
-        */
-       rel1 = heap_open(DatabaseRelationId, AccessShareLock);
-
-       pcqCtx = caql_addrel(cqclr(&cqc), rel1); 
-
-       tuple = caql_getfirst(
-                       pcqCtx,
-                       cql("SELECT * FROM pg_database "
-                                " WHERE dat2tablespace = :1 ", 
-                               ObjectIdGetDatum(tablespaceoid)));
-
-       if (HeapTupleIsValid(tuple))
-       {
-               ereport(ERROR,
-                               
(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-                                errmsg("tablespace \"%s\" is not empty: 
existing database.", tablespacename)));
-
-       }
-    heap_close(rel1, AccessShareLock);
-    
-       /*
-        * Check for any databases defined in this tablespace
-        */
-       rel1 = heap_open(RelationRelationId, AccessShareLock);
-
-       pcqCtx = caql_addrel(cqclr(&cqc), rel1); 
-
-       tuple = caql_getfirst(
-                       pcqCtx,
-                       cql("SELECT * FROM pg_class "
-                                " WHERE reltablespace = :1 ", 
-                               ObjectIdGetDatum(tablespaceoid)));
-
-       if (HeapTupleIsValid(tuple))
-       {
-               ereport(ERROR,
-                               
(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-                                errmsg("tablespace \"%s\" is not empty: 
existing table.", tablespacename)));
-
-       }
-    heap_close(rel1, AccessShareLock);
+       /* ... */
 
        /*
         * Remove the pg_tablespace tuple (this will roll back if we fail below)

Reply via email to