You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hive.apache.org by ng...@apache.org on 2017/05/09 10:04:36 UTC
hive git commit: HIVE-16556 Hive Metastore schema changes to add
METASTORE_DB_PROPERTIES table (Vihang Karajgaonkar, reviewed by Naveen Gangam)
Repository: hive
Updated Branches:
refs/heads/master 6bd3f6f62 -> 5835503d4
HIVE-16556 Hive Metastore schema changes to add METASTORE_DB_PROPERTIES table (Vihang Karajgaonkar, reviewed by Naveen Gangam)
Project: http://git-wip-us.apache.org/repos/asf/hive/repo
Commit: http://git-wip-us.apache.org/repos/asf/hive/commit/5835503d
Tree: http://git-wip-us.apache.org/repos/asf/hive/tree/5835503d
Diff: http://git-wip-us.apache.org/repos/asf/hive/diff/5835503d
Branch: refs/heads/master
Commit: 5835503d42f6ba793c7b77cb903e06bb78d497c3
Parents: 6bd3f6f
Author: Naveen Gangam <ng...@apache.org>
Authored: Tue May 9 06:04:09 2017 -0400
Committer: Naveen Gangam <ng...@apache.org>
Committed: Tue May 9 06:04:09 2017 -0400
----------------------------------------------------------------------
.../org/apache/hive/beeline/TestSchemaTool.java | 27 ++++++++++++++++++++
.../upgrade/derby/041-HIVE-16556.derby.sql | 5 ++++
.../upgrade/derby/hive-schema-3.0.0.derby.sql | 12 ++++++---
.../derby/upgrade-2.3.0-to-3.0.0.derby.sql | 2 ++
.../upgrade/mssql/026-HIVE-16556.mssql.sql | 10 ++++++++
.../upgrade/mssql/hive-schema-3.0.0.mssql.sql | 10 ++++++++
.../mssql/upgrade-2.3.0-to-3.0.0.mssql.sql | 2 ++
.../upgrade/mysql/041-HIVE-16556.mysql.sql | 11 ++++++++
.../upgrade/mysql/hive-schema-3.0.0.mysql.sql | 12 +++++++++
.../mysql/upgrade-2.3.0-to-3.0.0.mysql.sql | 2 ++
.../upgrade/oracle/041-HIVE-16556.oracle.sql | 11 ++++++++
.../upgrade/oracle/hive-schema-3.0.0.oracle.sql | 11 ++++++++
.../oracle/upgrade-2.3.0-to-3.0.0.oracle.sql | 2 ++
.../postgres/040-HIVE-16556.postgres.sql | 13 ++++++++++
.../postgres/hive-schema-3.0.0.postgres.sql | 16 +++++++++++-
.../upgrade-2.3.0-to-3.0.0.postgres.sql | 2 ++
16 files changed, 144 insertions(+), 4 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/hive/blob/5835503d/itests/hive-unit/src/test/java/org/apache/hive/beeline/TestSchemaTool.java
----------------------------------------------------------------------
diff --git a/itests/hive-unit/src/test/java/org/apache/hive/beeline/TestSchemaTool.java b/itests/hive-unit/src/test/java/org/apache/hive/beeline/TestSchemaTool.java
index 604c234..586fc72 100644
--- a/itests/hive-unit/src/test/java/org/apache/hive/beeline/TestSchemaTool.java
+++ b/itests/hive-unit/src/test/java/org/apache/hive/beeline/TestSchemaTool.java
@@ -663,6 +663,17 @@ public class TestSchemaTool extends TestCase {
assertFalse(isValid);
}
+ public void testHiveMetastoreDbPropertiesTable() throws HiveMetaException, IOException {
+ schemaTool.doInit("3.0.0");
+ validateMetastoreDbPropertiesTable();
+ }
+
+ public void testMetastoreDbPropertiesAfterUpgrade() throws HiveMetaException, IOException {
+ schemaTool.doInit("2.0.0");
+ schemaTool.doUpgrade();
+ validateMetastoreDbPropertiesTable();
+ }
+
private File generateTestScript(String [] stmts) throws IOException {
File testScriptFile = File.createTempFile("schematest", ".sql");
testScriptFile.deleteOnExit();
@@ -676,6 +687,22 @@ public class TestSchemaTool extends TestCase {
return testScriptFile;
}
+ private void validateMetastoreDbPropertiesTable() throws HiveMetaException, IOException {
+ boolean isValid = (boolean) schemaTool.validateSchemaTables(conn);
+ assertTrue(isValid);
+ // adding same property key twice should throw unique key constraint violation exception
+ String[] scripts = new String[] {
+ "insert into METASTORE_DB_PROPERTIES values (1, 'guid', 'test-uuid-1', 'dummy uuid 1')",
+ "insert into METASTORE_DB_PROPERTIES values (2, 'guid', 'test-uuid-2', 'dummy uuid 2')", };
+ File scriptFile = generateTestScript(scripts);
+ Exception ex = null;
+ try {
+ schemaTool.runBeeLine(scriptFile.getPath());
+ } catch (Exception iox) {
+ ex = iox;
+ }
+ assertTrue(ex != null && ex instanceof IOException);
+ }
/**
* Write out a dummy pre-upgrade script with given SQL statement.
*/
http://git-wip-us.apache.org/repos/asf/hive/blob/5835503d/metastore/scripts/upgrade/derby/041-HIVE-16556.derby.sql
----------------------------------------------------------------------
diff --git a/metastore/scripts/upgrade/derby/041-HIVE-16556.derby.sql b/metastore/scripts/upgrade/derby/041-HIVE-16556.derby.sql
new file mode 100644
index 0000000..ea5f24a
--- /dev/null
+++ b/metastore/scripts/upgrade/derby/041-HIVE-16556.derby.sql
@@ -0,0 +1,5 @@
+CREATE TABLE "APP"."METASTORE_DB_PROPERTIES" ("PROPERTY_ID" BIGINT NOT NULL, "PROPERTY_KEY" VARCHAR(255) NOT NULL, "PROPERTY_VALUE" VARCHAR(1000) NOT NULL, "DESCRIPTION" VARCHAR(1000));
+
+ALTER TABLE "APP"."METASTORE_DB_PROPERTIES" ADD CONSTRAINT "UNIQUE_PROPERTY_KEY" UNIQUE ("PROPERTY_KEY");
+
+ALTER TABLE "APP"."METASTORE_DB_PROPERTIES" ADD CONSTRAINT "PROPERTY_ID_PK" PRIMARY KEY ("PROPERTY_ID");
http://git-wip-us.apache.org/repos/asf/hive/blob/5835503d/metastore/scripts/upgrade/derby/hive-schema-3.0.0.derby.sql
----------------------------------------------------------------------
diff --git a/metastore/scripts/upgrade/derby/hive-schema-3.0.0.derby.sql b/metastore/scripts/upgrade/derby/hive-schema-3.0.0.derby.sql
index 8877681..ee04bfd 100644
--- a/metastore/scripts/upgrade/derby/hive-schema-3.0.0.derby.sql
+++ b/metastore/scripts/upgrade/derby/hive-schema-3.0.0.derby.sql
@@ -108,9 +108,7 @@ CREATE TABLE "APP"."NOTIFICATION_SEQUENCE" ("NNI_ID" BIGINT NOT NULL, "NEXT_EVEN
CREATE TABLE "APP"."KEY_CONSTRAINTS" ("CHILD_CD_ID" BIGINT, "CHILD_INTEGER_IDX" INTEGER NOT NULL, "CHILD_TBL_ID" BIGINT, "PARENT_CD_ID" BIGINT NOT NULL, "PARENT_INTEGER_IDX" INTEGER, "PARENT_TBL_ID" BIGINT NOT NULL, "POSITION" BIGINT NOT NULL, "CONSTRAINT_NAME" VARCHAR(400) NOT NULL, "CONSTRAINT_TYPE" SMALLINT NOT NULL, "UPDATE_RULE" SMALLINT, "DELETE_RULE" SMALLINT, "ENABLE_VALIDATE_RELY" SMALLINT NOT NULL);
-ALTER TABLE "APP"."KEY_CONSTRAINTS" ADD CONSTRAINT "CONSTRAINTS_PK" PRIMARY KEY ("CONSTRAINT_NAME", "POSITION");
-
-CREATE INDEX "APP"."CONSTRAINTS_PARENT_TBL_ID_INDEX" ON "APP"."KEY_CONSTRAINTS"("PARENT_TBL_ID");
+CREATE TABLE "APP"."METASTORE_DB_PROPERTIES" ("PROPERTY_ID" BIGINT NOT NULL, "PROPERTY_KEY" VARCHAR(255) NOT NULL, "PROPERTY_VALUE" VARCHAR(1000) NOT NULL, "DESCRIPTION" VARCHAR(1000));
-- ----------------------------------------------
-- DDL Statements for indexes
@@ -150,6 +148,8 @@ CREATE INDEX "APP"."FUNCS_N49" ON "APP"."FUNCS" ("DB_ID");
CREATE INDEX "APP"."FUNC_RU_N49" ON "APP"."FUNC_RU" ("FUNC_ID");
+CREATE INDEX "APP"."CONSTRAINTS_PARENT_TBL_ID_INDEX" ON "APP"."KEY_CONSTRAINTS"("PARENT_TBL_ID");
+
-- ----------------------------------------------
-- DDL Statements for keys
-- ----------------------------------------------
@@ -241,6 +241,12 @@ ALTER TABLE "APP"."NOTIFICATION_LOG" ADD CONSTRAINT "NOTIFICATION_LOG_PK" PRIMAR
ALTER TABLE "APP"."NOTIFICATION_SEQUENCE" ADD CONSTRAINT "NOTIFICATION_SEQUENCE_PK" PRIMARY KEY ("NNI_ID");
+ALTER TABLE "APP"."KEY_CONSTRAINTS" ADD CONSTRAINT "CONSTRAINTS_PK" PRIMARY KEY ("CONSTRAINT_NAME", "POSITION");
+
+ALTER TABLE "APP"."METASTORE_DB_PROPERTIES" ADD CONSTRAINT "PROPERTY_ID_PK" PRIMARY KEY ("PROPERTY_ID");
+
+ALTER TABLE "APP"."METASTORE_DB_PROPERTIES" ADD CONSTRAINT "UNIQUE_PROPERTY_KEY" UNIQUE ("PROPERTY_KEY");
+
-- foreign
ALTER TABLE "APP"."IDXS" ADD CONSTRAINT "IDXS_FK1" FOREIGN KEY ("ORIG_TBL_ID") REFERENCES "APP"."TBLS" ("TBL_ID") ON DELETE NO ACTION ON UPDATE NO ACTION;
http://git-wip-us.apache.org/repos/asf/hive/blob/5835503d/metastore/scripts/upgrade/derby/upgrade-2.3.0-to-3.0.0.derby.sql
----------------------------------------------------------------------
diff --git a/metastore/scripts/upgrade/derby/upgrade-2.3.0-to-3.0.0.derby.sql b/metastore/scripts/upgrade/derby/upgrade-2.3.0-to-3.0.0.derby.sql
index 3bba523..455651f 100644
--- a/metastore/scripts/upgrade/derby/upgrade-2.3.0-to-3.0.0.derby.sql
+++ b/metastore/scripts/upgrade/derby/upgrade-2.3.0-to-3.0.0.derby.sql
@@ -1,3 +1,5 @@
-- Upgrade MetaStore schema from 2.3.0 to 3.0.0
+RUN '041-HIVE-16556.derby.sql';
+
UPDATE "APP".VERSION SET SCHEMA_VERSION='3.0.0', VERSION_COMMENT='Hive release version 3.0.0' where VER_ID=1;
http://git-wip-us.apache.org/repos/asf/hive/blob/5835503d/metastore/scripts/upgrade/mssql/026-HIVE-16556.mssql.sql
----------------------------------------------------------------------
diff --git a/metastore/scripts/upgrade/mssql/026-HIVE-16556.mssql.sql b/metastore/scripts/upgrade/mssql/026-HIVE-16556.mssql.sql
new file mode 100644
index 0000000..088e702
--- /dev/null
+++ b/metastore/scripts/upgrade/mssql/026-HIVE-16556.mssql.sql
@@ -0,0 +1,10 @@
+CREATE TABLE METASTORE_DB_PROPERTIES (
+ PROPERTY_ID BIGINT NOT NULL,
+ PROPERTY_KEY VARCHAR(255) NOT NULL,
+ PROPERTY_VALUE VARCHAR(1000) NOT NULL,
+ DESCRIPTION VARCHAR(1000)
+);
+
+ALTER TABLE METASTORE_DB_PROPERTIES ADD CONSTRAINT METASTORE_DB_PROPERTIES_PK PRIMARY KEY (PROPERTY_ID);
+
+ALTER TABLE METASTORE_DB_PROPERTIES ADD CONSTRAINT UNIQUE_PROPERTY_KEY UNIQUE (PROPERTY_KEY);
http://git-wip-us.apache.org/repos/asf/hive/blob/5835503d/metastore/scripts/upgrade/mssql/hive-schema-3.0.0.mssql.sql
----------------------------------------------------------------------
diff --git a/metastore/scripts/upgrade/mssql/hive-schema-3.0.0.mssql.sql b/metastore/scripts/upgrade/mssql/hive-schema-3.0.0.mssql.sql
index 54d593c..416f3d9 100644
--- a/metastore/scripts/upgrade/mssql/hive-schema-3.0.0.mssql.sql
+++ b/metastore/scripts/upgrade/mssql/hive-schema-3.0.0.mssql.sql
@@ -1016,6 +1016,16 @@ CREATE TABLE WRITE_SET (
WS_OPERATION_TYPE char(1) NOT NULL
);
+CREATE TABLE METASTORE_DB_PROPERTIES (
+ PROPERTY_ID BIGINT NOT NULL,
+ PROPERTY_KEY VARCHAR(255) NOT NULL,
+ PROPERTY_VALUE VARCHAR(1000) NOT NULL,
+ DESCRIPTION VARCHAR(1000)
+);
+
+ALTER TABLE METASTORE_DB_PROPERTIES ADD CONSTRAINT METASTORE_DB_PROPERTIES_PK PRIMARY KEY (PROPERTY_ID);
+
+ALTER TABLE METASTORE_DB_PROPERTIES ADD CONSTRAINT UNIQUE_PROPERTY_KEY UNIQUE (PROPERTY_KEY);
-- -----------------------------------------------------------------
-- Record schema version. Should be the last step in the init script
http://git-wip-us.apache.org/repos/asf/hive/blob/5835503d/metastore/scripts/upgrade/mssql/upgrade-2.3.0-to-3.0.0.mssql.sql
----------------------------------------------------------------------
diff --git a/metastore/scripts/upgrade/mssql/upgrade-2.3.0-to-3.0.0.mssql.sql b/metastore/scripts/upgrade/mssql/upgrade-2.3.0-to-3.0.0.mssql.sql
index 94d18a3..e579dac 100644
--- a/metastore/scripts/upgrade/mssql/upgrade-2.3.0-to-3.0.0.mssql.sql
+++ b/metastore/scripts/upgrade/mssql/upgrade-2.3.0-to-3.0.0.mssql.sql
@@ -1,4 +1,6 @@
SELECT 'Upgrading MetaStore schema from 2.3.0 to 3.0.0' AS MESSAGE;
+:r 026-HIVE-16556.mssql.sql
+
UPDATE VERSION SET SCHEMA_VERSION='3.0.0', VERSION_COMMENT='Hive release version 3.0.0' where VER_ID=1;
SELECT 'Finished upgrading MetaStore schema from 2.3.0 to 3.0.0' AS MESSAGE;
http://git-wip-us.apache.org/repos/asf/hive/blob/5835503d/metastore/scripts/upgrade/mysql/041-HIVE-16556.mysql.sql
----------------------------------------------------------------------
diff --git a/metastore/scripts/upgrade/mysql/041-HIVE-16556.mysql.sql b/metastore/scripts/upgrade/mysql/041-HIVE-16556.mysql.sql
new file mode 100644
index 0000000..8afc196
--- /dev/null
+++ b/metastore/scripts/upgrade/mysql/041-HIVE-16556.mysql.sql
@@ -0,0 +1,11 @@
+--
+-- Table structure for table METASTORE_DB_PROPERTIES
+--
+CREATE TABLE IF NOT EXISTS `METASTORE_DB_PROPERTIES` (
+ `PROPERTY_ID` BIGINT(20) NOT NULL,
+ `PROPERTY_KEY` varchar(255) NOT NULL,
+ `PROPERTY_VALUE` varchar(1000) NOT NULL,
+ `DESCRIPTION` varchar(1000),
+ PRIMARY KEY(`PROPERTY_ID`),
+ UNIQUE KEY `UNIQUE_PROPERTY_KEY` (`PROPERTY_KEY`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1;
http://git-wip-us.apache.org/repos/asf/hive/blob/5835503d/metastore/scripts/upgrade/mysql/hive-schema-3.0.0.mysql.sql
----------------------------------------------------------------------
diff --git a/metastore/scripts/upgrade/mysql/hive-schema-3.0.0.mysql.sql b/metastore/scripts/upgrade/mysql/hive-schema-3.0.0.mysql.sql
index 4db2f34..09b8cf0 100644
--- a/metastore/scripts/upgrade/mysql/hive-schema-3.0.0.mysql.sql
+++ b/metastore/scripts/upgrade/mysql/hive-schema-3.0.0.mysql.sql
@@ -829,6 +829,18 @@ CREATE TABLE IF NOT EXISTS `KEY_CONSTRAINTS`
CREATE INDEX `CONSTRAINTS_PARENT_TABLE_ID_INDEX` ON KEY_CONSTRAINTS (`PARENT_TBL_ID`) USING BTREE;
+-- -----------------------------
+-- Metastore DB Properties table
+-- -----------------------------
+CREATE TABLE IF NOT EXISTS `METASTORE_DB_PROPERTIES` (
+ `PROPERTY_ID` BIGINT(20) NOT NULL,
+ `PROPERTY_KEY` varchar(255) NOT NULL,
+ `PROPERTY_VALUE` varchar(1000) NOT NULL,
+ `DESCRIPTION` varchar(1000),
+ PRIMARY KEY(`PROPERTY_ID`),
+ UNIQUE KEY `UNIQUE_PROPERTY_KEY` (`PROPERTY_KEY`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1;
+
-- ----------------------------
-- Transaction and Lock Tables
-- ----------------------------
http://git-wip-us.apache.org/repos/asf/hive/blob/5835503d/metastore/scripts/upgrade/mysql/upgrade-2.3.0-to-3.0.0.mysql.sql
----------------------------------------------------------------------
diff --git a/metastore/scripts/upgrade/mysql/upgrade-2.3.0-to-3.0.0.mysql.sql b/metastore/scripts/upgrade/mysql/upgrade-2.3.0-to-3.0.0.mysql.sql
index e5d82e1..2884387 100644
--- a/metastore/scripts/upgrade/mysql/upgrade-2.3.0-to-3.0.0.mysql.sql
+++ b/metastore/scripts/upgrade/mysql/upgrade-2.3.0-to-3.0.0.mysql.sql
@@ -1,5 +1,7 @@
SELECT 'Upgrading MetaStore schema from 2.3.0 to 3.0.0' AS ' ';
+SOURCE 041-HIVE-16556.mysql.sql;
+
UPDATE VERSION SET SCHEMA_VERSION='3.0.0', VERSION_COMMENT='Hive release version 3.0.0' where VER_ID=1;
SELECT 'Finished upgrading MetaStore schema from 2.3.0 to 3.0.0' AS ' ';
http://git-wip-us.apache.org/repos/asf/hive/blob/5835503d/metastore/scripts/upgrade/oracle/041-HIVE-16556.oracle.sql
----------------------------------------------------------------------
diff --git a/metastore/scripts/upgrade/oracle/041-HIVE-16556.oracle.sql b/metastore/scripts/upgrade/oracle/041-HIVE-16556.oracle.sql
new file mode 100644
index 0000000..14a2bdb
--- /dev/null
+++ b/metastore/scripts/upgrade/oracle/041-HIVE-16556.oracle.sql
@@ -0,0 +1,11 @@
+CREATE TABLE METASTORE_DB_PROPERTIES
+(
+ PROPERTY_ID NUMBER NOT NULL,
+ PROPERTY_KEY VARCHAR(255) NOT NULL,
+ PROPERTY_VALUE VARCHAR(1000) NOT NULL,
+ DESCRIPTION VARCHAR(1000)
+);
+
+ALTER TABLE METASTORE_DB_PROPERTIES ADD CONSTRAINT UNIQUE_PROPERTY_KEY UNIQUE (PROPERTY_KEY);
+
+ALTER TABLE METASTORE_DB_PROPERTIES ADD CONSTRAINT PROPERTY_ID_PK PRIMARY KEY (PROPERTY_ID);
http://git-wip-us.apache.org/repos/asf/hive/blob/5835503d/metastore/scripts/upgrade/oracle/hive-schema-3.0.0.oracle.sql
----------------------------------------------------------------------
diff --git a/metastore/scripts/upgrade/oracle/hive-schema-3.0.0.oracle.sql b/metastore/scripts/upgrade/oracle/hive-schema-3.0.0.oracle.sql
index 7907c59..0ad28b2 100644
--- a/metastore/scripts/upgrade/oracle/hive-schema-3.0.0.oracle.sql
+++ b/metastore/scripts/upgrade/oracle/hive-schema-3.0.0.oracle.sql
@@ -799,7 +799,18 @@ ALTER TABLE KEY_CONSTRAINTS ADD CONSTRAINT CONSTRAINTS_PK PRIMARY KEY (CONSTRAIN
CREATE INDEX CONSTRAINTS_PT_INDEX ON KEY_CONSTRAINTS(PARENT_TBL_ID);
+-- Table for METASTORE_DB_PROPERTIES and its constraints
+CREATE TABLE METASTORE_DB_PROPERTIES
+(
+ PROPERTY_ID NUMBER NOT NULL,
+ PROPERTY_KEY VARCHAR(255) NOT NULL,
+ PROPERTY_VALUE VARCHAR(1000) NOT NULL,
+ DESCRIPTION VARCHAR(1000)
+);
+
+ALTER TABLE METASTORE_DB_PROPERTIES ADD CONSTRAINT UNIQUE_PROPERTY_KEY UNIQUE (PROPERTY_KEY);
+ALTER TABLE METASTORE_DB_PROPERTIES ADD CONSTRAINT PROPERTY_ID_PK PRIMARY KEY (PROPERTY_ID);
------------------------------
-- Transaction and lock tables
------------------------------
http://git-wip-us.apache.org/repos/asf/hive/blob/5835503d/metastore/scripts/upgrade/oracle/upgrade-2.3.0-to-3.0.0.oracle.sql
----------------------------------------------------------------------
diff --git a/metastore/scripts/upgrade/oracle/upgrade-2.3.0-to-3.0.0.oracle.sql b/metastore/scripts/upgrade/oracle/upgrade-2.3.0-to-3.0.0.oracle.sql
index 31c4f5d..a15f288 100644
--- a/metastore/scripts/upgrade/oracle/upgrade-2.3.0-to-3.0.0.oracle.sql
+++ b/metastore/scripts/upgrade/oracle/upgrade-2.3.0-to-3.0.0.oracle.sql
@@ -1,4 +1,6 @@
SELECT 'Upgrading MetaStore schema from 2.3.0 to 3.0.0' AS Status from dual;
+@041-HIVE-16556.oracle.sql;
+
UPDATE VERSION SET SCHEMA_VERSION='3.0.0', VERSION_COMMENT='Hive release version 3.0.0' where VER_ID=1;
SELECT 'Finished upgrading MetaStore schema from 2.3.0 to 3.0.0' AS Status from dual;
http://git-wip-us.apache.org/repos/asf/hive/blob/5835503d/metastore/scripts/upgrade/postgres/040-HIVE-16556.postgres.sql
----------------------------------------------------------------------
diff --git a/metastore/scripts/upgrade/postgres/040-HIVE-16556.postgres.sql b/metastore/scripts/upgrade/postgres/040-HIVE-16556.postgres.sql
new file mode 100644
index 0000000..9a3ff03
--- /dev/null
+++ b/metastore/scripts/upgrade/postgres/040-HIVE-16556.postgres.sql
@@ -0,0 +1,13 @@
+CREATE TABLE "METASTORE_DB_PROPERTIES"
+(
+ "PROPERTY_ID" BIGINT NOT NULL,
+ "PROPERTY_KEY" VARCHAR(255) NOT NULL,
+ "PROPERTY_VALUE" VARCHAR(1000) NOT NULL,
+ "DESCRIPTION" VARCHAR(1000)
+);
+
+ALTER TABLE ONLY "METASTORE_DB_PROPERTIES"
+ ADD CONSTRAINT "UNIQUE_PROPERTY_KEY" UNIQUE ("PROPERTY_KEY");
+
+ALTER TABLE ONLY "METASTORE_DB_PROPERTIES"
+ ADD CONSTRAINT "METASTORE_DB_PROPERTIES_pkey" PRIMARY KEY ("PROPERTY_ID");
http://git-wip-us.apache.org/repos/asf/hive/blob/5835503d/metastore/scripts/upgrade/postgres/hive-schema-3.0.0.postgres.sql
----------------------------------------------------------------------
diff --git a/metastore/scripts/upgrade/postgres/hive-schema-3.0.0.postgres.sql b/metastore/scripts/upgrade/postgres/hive-schema-3.0.0.postgres.sql
index 49976d0..89183e7 100644
--- a/metastore/scripts/upgrade/postgres/hive-schema-3.0.0.postgres.sql
+++ b/metastore/scripts/upgrade/postgres/hive-schema-3.0.0.postgres.sql
@@ -604,7 +604,16 @@ CREATE TABLE "KEY_CONSTRAINTS"
PRIMARY KEY ("CONSTRAINT_NAME", "POSITION")
) ;
-CREATE INDEX "CONSTRAINTS_PARENT_TBLID_INDEX" ON "KEY_CONSTRAINTS" USING BTREE ("PARENT_TBL_ID");
+---
+--- Table structure for METASTORE_DB_PROPERTIES
+---
+CREATE TABLE "METASTORE_DB_PROPERTIES"
+(
+ "PROPERTY_ID" BIGINT NOT NULL,
+ "PROPERTY_KEY" VARCHAR(255) NOT NULL,
+ "PROPERTY_VALUE" VARCHAR(1000) NOT NULL,
+ "DESCRIPTION" VARCHAR(1000)
+);
--
-- Name: BUCKETING_COLS_pkey; Type: CONSTRAINT; Schema: public; Owner: hiveuser; Tablespace:
@@ -950,7 +959,11 @@ ALTER TABLE ONLY "TYPES"
ALTER TABLE ONLY "ROLE_MAP"
ADD CONSTRAINT "USERROLEMAPINDEX" UNIQUE ("PRINCIPAL_NAME", "ROLE_ID", "GRANTOR", "GRANTOR_TYPE");
+ALTER TABLE ONLY "METASTORE_DB_PROPERTIES"
+ ADD CONSTRAINT "UNIQUE_PROPERTY_KEY" UNIQUE ("PROPERTY_KEY");
+ALTER TABLE ONLY "METASTORE_DB_PROPERTIES"
+ ADD CONSTRAINT "METASTORE_DB_PROPERTIES_pkey" PRIMARY KEY ("PROPERTY_ID");
--
-- Name: BUCKETING_COLS_N49; Type: INDEX; Schema: public; Owner: hiveuser; Tablespace:
--
@@ -1197,6 +1210,7 @@ CREATE INDEX "FUNCS_N49" ON "FUNCS" ("DB_ID");
CREATE INDEX "FUNC_RU_N49" ON "FUNC_RU" ("FUNC_ID");
+CREATE INDEX "CONSTRAINTS_PARENT_TBLID_INDEX" ON "KEY_CONSTRAINTS" USING BTREE ("PARENT_TBL_ID");
ALTER TABLE ONLY "SKEWED_STRING_LIST_VALUES"
ADD CONSTRAINT "SKEWED_STRING_LIST_VALUES_fkey" FOREIGN KEY ("STRING_LIST_ID") REFERENCES "SKEWED_STRING_LIST"("STRING_LIST_ID") DEFERRABLE;
http://git-wip-us.apache.org/repos/asf/hive/blob/5835503d/metastore/scripts/upgrade/postgres/upgrade-2.3.0-to-3.0.0.postgres.sql
----------------------------------------------------------------------
diff --git a/metastore/scripts/upgrade/postgres/upgrade-2.3.0-to-3.0.0.postgres.sql b/metastore/scripts/upgrade/postgres/upgrade-2.3.0-to-3.0.0.postgres.sql
index 2dd9bb9..4d8f0cd 100644
--- a/metastore/scripts/upgrade/postgres/upgrade-2.3.0-to-3.0.0.postgres.sql
+++ b/metastore/scripts/upgrade/postgres/upgrade-2.3.0-to-3.0.0.postgres.sql
@@ -1,5 +1,7 @@
SELECT 'Upgrading MetaStore schema from 2.3.0 to 3.0.0';
+\i 040-HIVE-16556.postgres.sql;
+
UPDATE "VERSION" SET "SCHEMA_VERSION"='3.0.0', "VERSION_COMMENT"='Hive release version 3.0.0' where "VER_ID"=1;
SELECT 'Finished upgrading MetaStore schema from 2.3.0 to 3.0.0';