You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hawq.apache.org by sh...@apache.org on 2015/09/30 23:37:22 UTC
[1/2] incubator-hawq git commit: HAWQ-18. Error out database_size
function on hcatalog
Repository: incubator-hawq
Updated Branches:
refs/heads/master 8bce795db -> 3581ed37a
HAWQ-18. Error out database_size function on hcatalog
Project: http://git-wip-us.apache.org/repos/asf/incubator-hawq/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-hawq/commit/621bc978
Tree: http://git-wip-us.apache.org/repos/asf/incubator-hawq/tree/621bc978
Diff: http://git-wip-us.apache.org/repos/asf/incubator-hawq/diff/621bc978
Branch: refs/heads/master
Commit: 621bc97830c9b4fcd320f6ce6e2d5c4388466954
Parents: 8bce795
Author: Jimmy Da <jd...@pivotal.io>
Authored: Fri Sep 18 11:05:11 2015 -0700
Committer: Jimmy Da <jd...@pivotal.io>
Committed: Wed Sep 30 14:32:30 2015 -0700
----------------------------------------------------------------------
src/backend/utils/adt/dbsize.c | 6 ++++++
src/test/regress/input/hcatalog_lookup.source | 4 +++-
src/test/regress/output/hcatalog_lookup.source | 5 +++++
3 files changed, 14 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/621bc978/src/backend/utils/adt/dbsize.c
----------------------------------------------------------------------
diff --git a/src/backend/utils/adt/dbsize.c b/src/backend/utils/adt/dbsize.c
index ab5e04b..7103a99 100644
--- a/src/backend/utils/adt/dbsize.c
+++ b/src/backend/utils/adt/dbsize.c
@@ -24,6 +24,7 @@
#include "catalog/catalog.h"
#include "catalog/catquery.h"
#include "catalog/namespace.h"
+#include "catalog/pg_database.h"
#include "catalog/pg_tablespace.h"
#include "commands/dbcommands.h"
#include "commands/tablespace.h"
@@ -178,6 +179,11 @@ calculate_database_size(Oid dbOid)
Assert(Gp_role != GP_ROLE_EXECUTE);
+ if (dbOid == HcatalogDbOid)
+ ereport(ERROR,
+ (ERRCODE_UNDEFINED_DATABASE,
+ errmsg("database hcatalog (OID 6120) is reserved")));
+
/* User must have connect privilege for target database */
aclresult = pg_database_aclcheck(dbOid, GetUserId(), ACL_CONNECT);
if (aclresult != ACLCHECK_OK)
http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/621bc978/src/test/regress/input/hcatalog_lookup.source
----------------------------------------------------------------------
diff --git a/src/test/regress/input/hcatalog_lookup.source b/src/test/regress/input/hcatalog_lookup.source
index 06c6389..a011abf 100644
--- a/src/test/regress/input/hcatalog_lookup.source
+++ b/src/test/regress/input/hcatalog_lookup.source
@@ -134,7 +134,9 @@ select r1.*, r2.* from hcatalog.test_schema.r r1, test_schema.r r2;
-- negative test: partitioned tables and hcatalog
alter table test_schema.p exchange partition p1 with table hcatalog.test_schema.r;
-
+-- negative test: cannot run pg_database_size on hcatalog
+select pg_catalog.pg_database_size('hcatalog');
+select pg_catalog.pg_database_size(6120);
-- cleanup
DROP schema test_schema cascade;
http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/621bc978/src/test/regress/output/hcatalog_lookup.source
----------------------------------------------------------------------
diff --git a/src/test/regress/output/hcatalog_lookup.source b/src/test/regress/output/hcatalog_lookup.source
index c649215..8708e59 100644
--- a/src/test/regress/output/hcatalog_lookup.source
+++ b/src/test/regress/output/hcatalog_lookup.source
@@ -261,6 +261,11 @@ select r1.*, r2.* from hcatalog.test_schema.r r1, test_schema.r r2;
-- negative test: partitioned tables and hcatalog
alter table test_schema.p exchange partition p1 with table hcatalog.test_schema.r;
ERROR: reference to hcatalog table "hcatalog.test_schema.r" is not allowed in this context
+-- negative test: cannot run pg_database_size on hcatalog
+select pg_catalog.pg_database_size('hcatalog');
+ERROR: database hcatalog (OID 6120) is reserved (SOMEFILE:SOMEFUNC)
+select pg_catalog.pg_database_size(6120);
+ERROR: database hcatalog (OID 6120) is reserved (SOMEFILE:SOMEFUNC)
-- cleanup
DROP schema test_schema cascade;
NOTICE: drop cascades to append only table test_schema.r
[2/2] incubator-hawq git commit: HAWQ-6. Skip hcatalog in
PersistentBuild_TruncateAllGpRelationNode
Posted by sh...@apache.org.
HAWQ-6. Skip hcatalog in PersistentBuild_TruncateAllGpRelationNode
Project: http://git-wip-us.apache.org/repos/asf/incubator-hawq/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-hawq/commit/3581ed37
Tree: http://git-wip-us.apache.org/repos/asf/incubator-hawq/tree/3581ed37
Diff: http://git-wip-us.apache.org/repos/asf/incubator-hawq/diff/3581ed37
Branch: refs/heads/master
Commit: 3581ed37af6d7af93227b9bf708cc58631a76d8e
Parents: 621bc97
Author: Jimmy Da <jd...@pivotal.io>
Authored: Tue Sep 22 16:06:35 2015 -0700
Committer: Jimmy Da <jd...@pivotal.io>
Committed: Wed Sep 30 14:33:05 2015 -0700
----------------------------------------------------------------------
src/backend/cdb/cdbpersistentbuild.c | 3 +++
1 file changed, 3 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/3581ed37/src/backend/cdb/cdbpersistentbuild.c
----------------------------------------------------------------------
diff --git a/src/backend/cdb/cdbpersistentbuild.c b/src/backend/cdb/cdbpersistentbuild.c
index 416718e..e161060 100755
--- a/src/backend/cdb/cdbpersistentbuild.c
+++ b/src/backend/cdb/cdbpersistentbuild.c
@@ -892,6 +892,9 @@ PersistentBuild_TruncateAllGpRelationNode(void)
dbOid = HeapTupleGetOid(tuple);
dattablespace = form_pg_database->dattablespace;
+ if (dbOid == HcatalogDbOid)
+ continue;
+
if (Debug_persistent_print)
elog(Persistent_DebugPrintLevel(),
"PersistentBuild_TruncateAllGpRelationNode: dbOid %u, '%s'",