You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hawq.apache.org by ml...@apache.org on 2016/02/25 04:41:22 UTC
incubator-hawq git commit: Revert "HAWQ-441. Remove catalog table
"gp_id" because it is useless"
Repository: incubator-hawq
Updated Branches:
refs/heads/master 04b80d045 -> 7fd8bc683
Revert "HAWQ-441. Remove catalog table "gp_id" because it is useless"
This reverts commit dd52db55422dd93b93ef885d8ee4d4bf246cd8f6.
Project: http://git-wip-us.apache.org/repos/asf/incubator-hawq/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-hawq/commit/7fd8bc68
Tree: http://git-wip-us.apache.org/repos/asf/incubator-hawq/tree/7fd8bc68
Diff: http://git-wip-us.apache.org/repos/asf/incubator-hawq/diff/7fd8bc68
Branch: refs/heads/master
Commit: 7fd8bc68325491aedba8656318d90ff377303b4a
Parents: 04b80d0
Author: Ming LI <ml...@pivotal.io>
Authored: Thu Feb 25 11:40:42 2016 +0800
Committer: Ming LI <ml...@pivotal.io>
Committed: Thu Feb 25 11:40:42 2016 +0800
----------------------------------------------------------------------
src/all_src_files.txt | 1 +
src/backend/access/index/catquery.c | 1 +
src/backend/access/index/gperf.init | 1 +
src/backend/catalog/Makefile | 2 +-
src/backend/catalog/catalog.c | 2 +
src/backend/catalog/core/catcoregen.py | 1 +
src/include/catalog/calico.pl | 1 +
src/include/catalog/gp_id.h | 89 ++++++++++++++++++++
src/include/catalog/gp_persistent.h | 4 +-
src/include/catalog/pg_tidycat.h | 1 +
src/include/catalog/tidycat.pl | 1 +
src/include/cdb/cdbcat.h | 1 +
.../regress/expected/validator_function.out | 2 +-
tools/bin/gppylib/data/2.0.json | 44 ++++++++++
14 files changed, 148 insertions(+), 3 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/7fd8bc68/src/all_src_files.txt
----------------------------------------------------------------------
diff --git a/src/all_src_files.txt b/src/all_src_files.txt
index feabe2a..31630c8 100644
--- a/src/all_src_files.txt
+++ b/src/all_src_files.txt
@@ -865,6 +865,7 @@ include/catalog/genbki.h
include/catalog/gp_configuration.h
include/catalog/gp_fastsequence.h
include/catalog/gp_global_sequence.h
+include/catalog/gp_id.h
include/catalog/gp_master_mirroring.h
include/catalog/gp_persistent.h
include/catalog/gp_policy.h
http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/7fd8bc68/src/backend/access/index/catquery.c
----------------------------------------------------------------------
diff --git a/src/backend/access/index/catquery.c b/src/backend/access/index/catquery.c
index ee90cce..c843a11 100644
--- a/src/backend/access/index/catquery.c
+++ b/src/backend/access/index/catquery.c
@@ -131,6 +131,7 @@ ARGV: \-meta\ \/Users\/jianl\/Git\/hawq\/mn\/cdb\-pg\/\.\.\/gpMgmt\/bin\/gppylib
#include "catalog/gp_master_mirroring.h"
#include "catalog/gp_persistent.h"
#include "catalog/gp_global_sequence.h"
+#include "catalog/gp_id.h"
#include "catalog/gp_version.h"
#include "catalog/toasting.h"
#include "catalog/gp_policy.h"
http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/7fd8bc68/src/backend/access/index/gperf.init
----------------------------------------------------------------------
diff --git a/src/backend/access/index/gperf.init b/src/backend/access/index/gperf.init
index eeef440..6a5cdec 100644
--- a/src/backend/access/index/gperf.init
+++ b/src/backend/access/index/gperf.init
@@ -100,6 +100,7 @@ ARGV: \-meta\ \/Users\/yjin\/hawq_main\/gpMgmt\/bin\/gppylib\/data\/2\.0\.json\
#include "catalog/gp_master_mirroring.h"
#include "catalog/gp_persistent.h"
#include "catalog/gp_global_sequence.h"
+#include "catalog/gp_id.h"
#include "catalog/gp_version.h"
#include "catalog/toasting.h"
#include "catalog/gp_policy.h"
http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/7fd8bc68/src/backend/catalog/Makefile
----------------------------------------------------------------------
diff --git a/src/backend/catalog/Makefile b/src/backend/catalog/Makefile
index 1654a53..08622f1 100644
--- a/src/backend/catalog/Makefile
+++ b/src/backend/catalog/Makefile
@@ -108,7 +108,7 @@ POSTGRES_BKI_SRCS := $(addprefix $(top_srcdir)/src/include/catalog/,\
pg_namespace.h pg_conversion.h pg_depend.h \
pg_database.h pg_tablespace.h pg_pltemplate.h \
pg_authid.h pg_auth_members.h pg_shdepend.h pg_shdescription.h pg_resqueue.h \
- gp_configuration.h gp_policy.h gp_version.h \
+ gp_configuration.h gp_id.h gp_policy.h gp_version.h \
gp_segment_config.h gp_san_config.h \
gp_verification_history.h \
pg_window.h \
http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/7fd8bc68/src/backend/catalog/catalog.c
----------------------------------------------------------------------
diff --git a/src/backend/catalog/catalog.c b/src/backend/catalog/catalog.c
index dd10dc2..4af2c28 100755
--- a/src/backend/catalog/catalog.c
+++ b/src/backend/catalog/catalog.c
@@ -48,6 +48,7 @@
#include "catalog/gp_master_mirroring.h"
#include "catalog/gp_persistent.h"
#include "catalog/gp_global_sequence.h"
+#include "catalog/gp_id.h"
#include "catalog/gp_version.h"
#include "catalog/toasting.h"
#include "catalog/gp_policy.h"
@@ -748,6 +749,7 @@ IsSharedRelation(Oid relationId)
relationId == FileSpaceRelationId ||
relationId == TableSpaceRelationId ||
+ relationId == GpIdRelationId ||
relationId == GpVersionRelationId ||
relationId == GpPersistentRelfileNodeRelationId ||
http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/7fd8bc68/src/backend/catalog/core/catcoregen.py
----------------------------------------------------------------------
diff --git a/src/backend/catalog/core/catcoregen.py b/src/backend/catalog/core/catcoregen.py
index 327b560..16c0f31 100644
--- a/src/backend/catalog/core/catcoregen.py
+++ b/src/backend/catalog/core/catcoregen.py
@@ -420,6 +420,7 @@ CatCoreTableTemplate = """
#include "catalog/catcore.h"
#include "catalog/catalog.h"
#include "catalog/gp_configuration.h"
+#include "catalog/gp_id.h"
#include "catalog/gp_master_mirroring.h"
#include "catalog/gp_policy.h"
#include "catalog/gp_san_config.h"
http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/7fd8bc68/src/include/catalog/calico.pl
----------------------------------------------------------------------
diff --git a/src/include/catalog/calico.pl b/src/include/catalog/calico.pl
index 8ec35d7..207950b 100755
--- a/src/include/catalog/calico.pl
+++ b/src/include/catalog/calico.pl
@@ -3522,6 +3522,7 @@ sub more_header
#include "catalog/gp_master_mirroring.h"
#include "catalog/gp_persistent.h"
#include "catalog/gp_global_sequence.h"
+#include "catalog/gp_id.h"
#include "catalog/gp_version.h"
#include "catalog/toasting.h"
#include "catalog/gp_policy.h"
http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/7fd8bc68/src/include/catalog/gp_id.h
----------------------------------------------------------------------
diff --git a/src/include/catalog/gp_id.h b/src/include/catalog/gp_id.h
new file mode 100644
index 0000000..599e1e3
--- /dev/null
+++ b/src/include/catalog/gp_id.h
@@ -0,0 +1,89 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+/*-------------------------------------------------------------------------
+ *
+ * gp_id.h
+ * definition of the system "database identifier" relation (gp_dbid)
+ * along with the relation's initial contents.
+ *
+ * NOTES
+ * Historically this table was used to supply every segment with its
+ * identification information. However in the 4.0 release when the file
+ * replication feature was added it could no longer serve this purpose
+ * because it became a requirement for all tables to have the same physical
+ * contents on both the primary and mirror segments. To resolve this the
+ * information is now passed to each segment on startup based on the
+ * gp_segment_configuration (stored on the master only), and each segment
+ * has a file in its datadirectory (gp_dbid) that uniquely identifies the
+ * segment.
+ *
+ * The contents of the table are now irrelevant, with the exception that
+ * several tools began relying on this table for use as a method of remote
+ * function invocation via gp_dist_random('gp_id') due to the fact that this
+ * table was guaranteed of having exactly one row on every segment. The
+ * contents of the row have no defined meaning, but this property is still
+ * relied upon.
+ */
+#ifndef _GP_ID_H_
+#define _GP_ID_H_
+
+
+#include "catalog/genbki.h"
+/*
+ * Defines for gp_id table
+ */
+#define GpIdRelationName "gp_id"
+
+/* TIDYCAT_BEGINFAKEDEF
+
+ CREATE TABLE gp_id
+ with (shared=true, oid=false, relid=5001, content=SEGMENT_LOCAL)
+ (
+ gpname name ,
+ numsegments smallint ,
+ dbid smallint ,
+ content smallint
+ );
+
+ TIDYCAT_ENDFAKEDEF
+*/
+
+#define GpIdRelationId 5001
+
+CATALOG(gp_id,5001) BKI_SHARED_RELATION BKI_WITHOUT_OIDS
+{
+ NameData gpname;
+ int2 numsegments;
+ int2 dbid;
+ int2 content;
+} FormData_gp_id;
+
+#define Natts_gp_id 4
+#define Anum_gp_id_gpname 1
+#define Anum_gp_id_numsegments 2
+#define Anum_gp_id_dbid 3
+#define Anum_gp_id_content 4
+
+/*
+ * The contract of the gp_id table is that it must have exactly one row on
+ * every segment. The contents of the row do not matter.
+ */
+DATA(insert (Greenplum -1 -1 -1));
+
+#endif /*_GP_ID_H_*/
http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/7fd8bc68/src/include/catalog/gp_persistent.h
----------------------------------------------------------------------
diff --git a/src/include/catalog/gp_persistent.h b/src/include/catalog/gp_persistent.h
index e07a626..a0c92c6 100755
--- a/src/include/catalog/gp_persistent.h
+++ b/src/include/catalog/gp_persistent.h
@@ -41,6 +41,7 @@
#include "access/xlogdefs.h"
#include "catalog/indexing.h"
#include "catalog/gp_global_sequence.h"
+#include "catalog/gp_id.h"
#include "catalog/pg_shdepend.h"
#define int8 int64
@@ -582,7 +583,8 @@ inline static bool GpPersistent_SkipXLogInfo(
/*
* gp_id and pg_shdepend
*/
- if (testOid == SharedDependRelationId) // 1214
+ if (testOid == GpIdRelationId || // 5001
+ testOid == SharedDependRelationId) // 1214
return true;
return false;
http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/7fd8bc68/src/include/catalog/pg_tidycat.h
----------------------------------------------------------------------
diff --git a/src/include/catalog/pg_tidycat.h b/src/include/catalog/pg_tidycat.h
index 49c7ff3..7d96d0c 100644
--- a/src/include/catalog/pg_tidycat.h
+++ b/src/include/catalog/pg_tidycat.h
@@ -28,6 +28,7 @@
#include "catalog/gp_configuration.h"
#include "catalog/gp_global_sequence.h"
+#include "catalog/gp_id.h"
#include "catalog/gp_master_mirroring.h"
#include "catalog/gp_persistent.h"
#include "catalog/gp_policy.h"
http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/7fd8bc68/src/include/catalog/tidycat.pl
----------------------------------------------------------------------
diff --git a/src/include/catalog/tidycat.pl b/src/include/catalog/tidycat.pl
index ce56496..4711b8a 100755
--- a/src/include/catalog/tidycat.pl
+++ b/src/include/catalog/tidycat.pl
@@ -426,6 +426,7 @@ my %dynamic_reltype_h =
(
5000 => "gp_configuration",
5002 => "gp_distribution_policy",
+ 5001 => "gp_id",
5008 => "gp_master_mirroring",
5003 => "gp_version_at_initdb",
2600 => "pg_aggregate",
http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/7fd8bc68/src/include/cdb/cdbcat.h
----------------------------------------------------------------------
diff --git a/src/include/cdb/cdbcat.h b/src/include/cdb/cdbcat.h
index 010bff5..9b492d4 100644
--- a/src/include/cdb/cdbcat.h
+++ b/src/include/cdb/cdbcat.h
@@ -30,6 +30,7 @@
#include "access/genam.h"
#include "access/heapam.h"
+#include "catalog/gp_id.h"
#include "catalog/gp_policy.h"
extern void checkPolicyForUniqueIndex(Relation rel, AttrNumber *indattr,
http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/7fd8bc68/src/test/regress/expected/validator_function.out
----------------------------------------------------------------------
diff --git a/src/test/regress/expected/validator_function.out b/src/test/regress/expected/validator_function.out
index 361a48b..3e5aedf 100644
--- a/src/test/regress/expected/validator_function.out
+++ b/src/test/regress/expected/validator_function.out
@@ -53,7 +53,7 @@ FROM (
SELECT oid FROM pg_proc
WHERE proname = 'foo'
) AS bar;
-ERROR: language validation function 2248 called for language 10885 in stead of 10884
+ERROR: language validation function 2248 called for language 10886 in stead of 10885
-- --------------------------------------
-- Cannot run validator on functions to
-- which user has no privilege to execute
http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/7fd8bc68/tools/bin/gppylib/data/2.0.json
----------------------------------------------------------------------
diff --git a/tools/bin/gppylib/data/2.0.json b/tools/bin/gppylib/data/2.0.json
index c65e12d..e4e989c 100644
--- a/tools/bin/gppylib/data/2.0.json
+++ b/tools/bin/gppylib/data/2.0.json
@@ -308,6 +308,50 @@
"text" : "with (camelcase=GpGlobalSequence, oid=false, relid=5096, reltype_oid=6995, content=PERSISTENT)"
}
},
+ "gp_id" : {
+ "CamelCaseRelationId" : "GpIdRelationId",
+ "colh" : {
+ "content" : "int2",
+ "dbid" : "int2",
+ "gpname" : "NameData",
+ "numsegments" : "int2"
+ },
+ "cols" : [
+ {
+ "colname" : "gpname",
+ "ctype" : "NameData",
+ "precomment" : "\n**TK_BLANK_LINE**",
+ "sqltype" : "name"
+ },
+ {
+ "colname" : "numsegments",
+ "ctype" : "int2",
+ "sqltype" : "smallint"
+ },
+ {
+ "colname" : "dbid",
+ "ctype" : "int2",
+ "sqltype" : "smallint"
+ },
+ {
+ "colname" : "content",
+ "ctype" : "int2",
+ "sqltype" : "smallint"
+ }
+ ],
+ "filename" : "gp_id.h",
+ "relid_comment_tag" : "/* relation id: 5001 - gp_id */\n",
+ "tabdef_text" : "\n CREATE TABLE gp_id\n with (shared=true, oid=false, relid=5001, content=SEGMENT_LOCAL)\n (\n gpname name ,\n numsegments smallint ,\n dbid smallint ,\n content smallint \n )",
+ "with" : {
+ "bootstrap" : 0,
+ "camelcase" : "GpId",
+ "content" : "SEGMENT_LOCAL",
+ "oid" : "",
+ "relid" : "5001",
+ "shared" : "1",
+ "text" : "with (shared=true, oid=false, relid=5001, content=SEGMENT_LOCAL)"
+ }
+ },
"gp_interfaces" : {
"CamelCaseRelationId" : "GpInterfacesRelationId",
"UppercaseReltypeOid" : "GP_INTERFACES_RELTYPE_OID",