You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hive.apache.org by ga...@apache.org on 2018/03/23 16:50:25 UTC

hive git commit: HIVE-18967 Standalone metastore SQL upgrade scripts do not properly set schema version (Alan Gates, reviewed by Thejas Nair)

Repository: hive
Updated Branches:
  refs/heads/master cc7377c61 -> 325c37a1e


HIVE-18967 Standalone metastore SQL upgrade scripts do not properly set schema version (Alan Gates, reviewed by Thejas Nair)


Project: http://git-wip-us.apache.org/repos/asf/hive/repo
Commit: http://git-wip-us.apache.org/repos/asf/hive/commit/325c37a1
Tree: http://git-wip-us.apache.org/repos/asf/hive/tree/325c37a1
Diff: http://git-wip-us.apache.org/repos/asf/hive/diff/325c37a1

Branch: refs/heads/master
Commit: 325c37a1ed285534a9f74b74ed721537e69d0741
Parents: cc7377c
Author: Alan Gates <ga...@hortonworks.com>
Authored: Fri Mar 23 09:49:15 2018 -0700
Committer: Alan Gates <ga...@hortonworks.com>
Committed: Fri Mar 23 09:49:15 2018 -0700

----------------------------------------------------------------------
 .../src/main/sql/derby/upgrade-2.3.0-to-3.0.0.derby.sql     | 5 +++--
 .../src/main/sql/mssql/upgrade-2.3.0-to-3.0.0.mssql.sql     | 9 +++++----
 .../src/main/sql/mysql/upgrade-2.3.0-to-3.0.0.mysql.sql     | 9 +++++----
 .../src/main/sql/oracle/upgrade-2.3.0-to-3.0.0.oracle.sql   | 7 ++++---
 .../main/sql/postgres/upgrade-2.3.0-to-3.0.0.postgres.sql   | 7 ++++---
 5 files changed, 21 insertions(+), 16 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hive/blob/325c37a1/standalone-metastore/src/main/sql/derby/upgrade-2.3.0-to-3.0.0.derby.sql
----------------------------------------------------------------------
diff --git a/standalone-metastore/src/main/sql/derby/upgrade-2.3.0-to-3.0.0.derby.sql b/standalone-metastore/src/main/sql/derby/upgrade-2.3.0-to-3.0.0.derby.sql
index 9f187f9..8925fa8 100644
--- a/standalone-metastore/src/main/sql/derby/upgrade-2.3.0-to-3.0.0.derby.sql
+++ b/standalone-metastore/src/main/sql/derby/upgrade-2.3.0-to-3.0.0.derby.sql
@@ -77,8 +77,6 @@ CREATE TABLE "APP"."SCHEMA_VERSION" (
 
 CREATE UNIQUE INDEX "APP"."UNIQUE_SCHEMA_VERSION" ON "APP"."SCHEMA_VERSION" ("SCHEMA_ID", "VERSION");
 
-UPDATE "APP".VERSION SET SCHEMA_VERSION='3.0.0', VERSION_COMMENT='Hive release version 3.0.0' where VER_ID=1;
-
 -- 048-HIVE-14498
 -- create mv_creation_metadata table
 CREATE TABLE "APP"."MV_CREATION_METADATA" (
@@ -161,3 +159,6 @@ ALTER TABLE COMPLETED_TXN_COMPONENTS ADD CTC_WRITEID bigint;
 ALTER TABLE "APP"."KEY_CONSTRAINTS" ADD COLUMN "DEFAULT_VALUE" VARCHAR(400);
 
 ALTER TABLE "APP"."HIVE_LOCKS" ALTER COLUMN "HL_TXNID" NOT NULL;
+
+-- This needs to be the last thing done.  Insert any changes above this line.
+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/325c37a1/standalone-metastore/src/main/sql/mssql/upgrade-2.3.0-to-3.0.0.mssql.sql
----------------------------------------------------------------------
diff --git a/standalone-metastore/src/main/sql/mssql/upgrade-2.3.0-to-3.0.0.mssql.sql b/standalone-metastore/src/main/sql/mssql/upgrade-2.3.0-to-3.0.0.mssql.sql
index 0b5f8a4..c5041b3 100644
--- a/standalone-metastore/src/main/sql/mssql/upgrade-2.3.0-to-3.0.0.mssql.sql
+++ b/standalone-metastore/src/main/sql/mssql/upgrade-2.3.0-to-3.0.0.mssql.sql
@@ -136,9 +136,6 @@ CREATE TABLE "SCHEMA_VERSION" (
   unique ("SCHEMA_ID", "VERSION")
 );
 
-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;
-
 -- 033-HIVE-14498
 CREATE TABLE MV_CREATION_METADATA
 (
@@ -213,4 +210,8 @@ ALTER TABLE COMPLETED_TXN_COMPONENTS ADD CTC_WRITEID bigint;
   -- add a new column to support default value for DEFAULT constraint
  ALTER TABLE KEY_CONSTRAINTS ADD DEFAULT_VALUE VARCHAR(400);
 
-ALTER TABLE HIVE_LOCKS MODIFY ALTER COLUMN HL_TXNID bigint NOT NULL;
+ALTER TABLE HIVE_LOCKS ALTER COLUMN HL_TXNID bigint NOT NULL;
+
+-- These lines need to be last.  Insert any changes above.
+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/325c37a1/standalone-metastore/src/main/sql/mysql/upgrade-2.3.0-to-3.0.0.mysql.sql
----------------------------------------------------------------------
diff --git a/standalone-metastore/src/main/sql/mysql/upgrade-2.3.0-to-3.0.0.mysql.sql b/standalone-metastore/src/main/sql/mysql/upgrade-2.3.0-to-3.0.0.mysql.sql
index d7c49e4..5a483ab 100644
--- a/standalone-metastore/src/main/sql/mysql/upgrade-2.3.0-to-3.0.0.mysql.sql
+++ b/standalone-metastore/src/main/sql/mysql/upgrade-2.3.0-to-3.0.0.mysql.sql
@@ -126,9 +126,6 @@ CREATE TABLE `SCHEMA_VERSION` (
   KEY `UNIQUE_VERSION` (`SCHEMA_ID`, `VERSION`)
 ) ENGINE=InnoDB DEFAULT CHARSET=latin1;
 
-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 ' ';
-
 -- 048-HIVE-14498
 CREATE TABLE IF NOT EXISTS `MV_CREATION_METADATA` (
   `MV_CREATION_METADATA_ID` bigint(20) NOT NULL,
@@ -203,4 +200,8 @@ ALTER TABLE COMPLETED_TXN_COMPONENTS ADD CTC_WRITEID bigint;
 -- add a new column to support default value for DEFAULT constraint
 ALTER TABLE `KEY_CONSTRAINTS` ADD COLUMN `DEFAULT_VALUE` VARCHAR(400);
 
-ALTER TABLE `HIVE_LOCKS` MODIFY COLUMN `HL_TXNID` NOT NULL;
+ALTER TABLE `HIVE_LOCKS` CHANGE COLUMN `HL_TXNID` `HL_TXNID` bigint NOT NULL;
+
+-- These lines need to be last.  Insert any changes above.
+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/325c37a1/standalone-metastore/src/main/sql/oracle/upgrade-2.3.0-to-3.0.0.oracle.sql
----------------------------------------------------------------------
diff --git a/standalone-metastore/src/main/sql/oracle/upgrade-2.3.0-to-3.0.0.oracle.sql b/standalone-metastore/src/main/sql/oracle/upgrade-2.3.0-to-3.0.0.oracle.sql
index 51eff3e..f95819e 100644
--- a/standalone-metastore/src/main/sql/oracle/upgrade-2.3.0-to-3.0.0.oracle.sql
+++ b/standalone-metastore/src/main/sql/oracle/upgrade-2.3.0-to-3.0.0.oracle.sql
@@ -138,9 +138,6 @@ CREATE TABLE "SCHEMA_VERSION" (
 );
 
 
-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;
-
 -- 048-HIVE-14498
 CREATE TABLE MV_CREATION_METADATA
 (
@@ -224,3 +221,7 @@ ALTER TABLE COMPLETED_TXN_COMPONENTS ADD CTC_WRITEID number(19);
 ALTER TABLE KEY_CONSTRAINTS ADD DEFAULT_VALUE VARCHAR(400);
 
 ALTER TABLE HIVE_LOCKS MODIFY(HL_TXNID NOT NULL);
+
+-- These lines need to be last.  Insert any changes above.
+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/325c37a1/standalone-metastore/src/main/sql/postgres/upgrade-2.3.0-to-3.0.0.postgres.sql
----------------------------------------------------------------------
diff --git a/standalone-metastore/src/main/sql/postgres/upgrade-2.3.0-to-3.0.0.postgres.sql b/standalone-metastore/src/main/sql/postgres/upgrade-2.3.0-to-3.0.0.postgres.sql
index 2766568..f7d8c73 100644
--- a/standalone-metastore/src/main/sql/postgres/upgrade-2.3.0-to-3.0.0.postgres.sql
+++ b/standalone-metastore/src/main/sql/postgres/upgrade-2.3.0-to-3.0.0.postgres.sql
@@ -152,9 +152,6 @@ CREATE TABLE "SCHEMA_VERSION" (
 );
 
 
-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';
-
 -- 047-HIVE-14498
 CREATE TABLE "MV_CREATION_METADATA" (
     "MV_CREATION_METADATA_ID" bigint NOT NULL,
@@ -239,3 +236,7 @@ ALTER TABLE COMPLETED_TXN_COMPONENTS ADD CTC_WRITEID bigint;
 ALTER TABLE "KEY_CONSTRAINTS" ADD COLUMN "DEFAULT_VALUE" VARCHAR(400);
 
 ALTER TABLE HIVE_LOCKS ALTER COLUMN HL_TXNID SET NOT NULL;
+
+-- These lines need to be last.  Insert any changes above.
+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';