You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hive.apache.org by kh...@apache.org on 2015/05/06 22:50:17 UTC

hive git commit: HIVE-10614 : schemaTool upgrade from 0.14.0 to 1.3.0 causes failure (Hari Subramaniyan via Sushanth Sowmyan, Thejas Nair) (branch-1.2)

Repository: hive
Updated Branches:
  refs/heads/branch-1.2 c8616882b -> cf4b9c1f9


HIVE-10614 : schemaTool upgrade from 0.14.0 to 1.3.0 causes failure (Hari Subramaniyan via Sushanth Sowmyan, Thejas Nair) (branch-1.2)


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

Branch: refs/heads/branch-1.2
Commit: cf4b9c1f94fc5b08a4bdbdea796eb3ea4e61c903
Parents: c861688
Author: Sushanth Sowmyan <kh...@gmail.com>
Authored: Wed May 6 13:49:24 2015 -0700
Committer: Sushanth Sowmyan <kh...@gmail.com>
Committed: Wed May 6 13:50:14 2015 -0700

----------------------------------------------------------------------
 .../upgrade/mysql/021-HIVE-7018.mysql.sql       | 53 --------------------
 .../upgrade/mysql/hive-schema-1.2.0.mysql.sql   | 10 +++-
 .../mysql/upgrade-1.1.0-to-1.2.0.mysql.sql      |  2 +-
 3 files changed, 9 insertions(+), 56 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hive/blob/cf4b9c1f/metastore/scripts/upgrade/mysql/021-HIVE-7018.mysql.sql
----------------------------------------------------------------------
diff --git a/metastore/scripts/upgrade/mysql/021-HIVE-7018.mysql.sql b/metastore/scripts/upgrade/mysql/021-HIVE-7018.mysql.sql
deleted file mode 100644
index 08208f9..0000000
--- a/metastore/scripts/upgrade/mysql/021-HIVE-7018.mysql.sql
+++ /dev/null
@@ -1,53 +0,0 @@
-SELECT '< HIVE-7018 Remove Table and Partition tables column LINK_TARGET_ID from Mysql for other DBs do not have it >' AS ' ';
-
-DELIMITER $$
-DROP PROCEDURE IF EXISTS RM_TLBS_LINKID $$
-DROP PROCEDURE IF EXISTS RM_PARTITIONS_LINKID $$
-DROP PROCEDURE IF EXISTS RM_LINKID $$
-
-/* Call this procedure to drop column LINK_TARGET_ID for TBLS */
-CREATE PROCEDURE RM_TLBS_LINKID()
-  BEGIN
-    IF EXISTS (SELECT * FROM `INFORMATION_SCHEMA`.`COLUMNS` WHERE `TABLE_NAME` = 'TBLS' AND `COLUMN_NAME` = 'LINK_TARGET_ID') THEN
-      ALTER TABLE `TBLS`
-        DROP FOREIGN KEY `TBLS_FK3`
-      ;
-      ALTER TABLE `TBLS`
-        DROP KEY `TBLS_N51`
-      ;
-      ALTER TABLE `TBLS`
-        DROP COLUMN `LINK_TARGET_ID`
-      ;
-    END IF;
-  END $$
-
-/* Call this procedure to drop column LINK_TARGET_ID for PARTITIONS */
-CREATE PROCEDURE RM_PARTITIONS_LINKID()
-  BEGIN
-    IF EXISTS (SELECT * FROM `INFORMATION_SCHEMA`.`COLUMNS` WHERE `TABLE_NAME` = 'PARTITIONS' AND `COLUMN_NAME` = 'LINK_TARGET_ID') THEN
-      ALTER TABLE `PARTITIONS`
-        DROP FOREIGN KEY `PARTITIONS_FK3`
-      ;
-      ALTER TABLE `PARTITIONS`
-        DROP KEY `PARTITIONS_N51`
-      ;
-      ALTER TABLE `PARTITIONS`
-        DROP COLUMN `LINK_TARGET_ID`
-      ;
-    END IF;
-  END $$
-
-/*
- * Check and drop column LINK_TARGET_ID
- */
-CREATE PROCEDURE RM_LINKID()
-  BEGIN
-    call RM_PARTITIONS_LINKID();
-    call RM_TLBS_LINKID();
-    SELECT 'Completed remove LINK_TARGET_ID';
-  END $$
-
-
-DELIMITER ;
-
-CALL RM_LINKID();
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/hive/blob/cf4b9c1f/metastore/scripts/upgrade/mysql/hive-schema-1.2.0.mysql.sql
----------------------------------------------------------------------
diff --git a/metastore/scripts/upgrade/mysql/hive-schema-1.2.0.mysql.sql b/metastore/scripts/upgrade/mysql/hive-schema-1.2.0.mysql.sql
index cdda8db..07dce8f 100644
--- a/metastore/scripts/upgrade/mysql/hive-schema-1.2.0.mysql.sql
+++ b/metastore/scripts/upgrade/mysql/hive-schema-1.2.0.mysql.sql
@@ -211,12 +211,15 @@ CREATE TABLE IF NOT EXISTS `PARTITIONS` (
   `PART_NAME` varchar(767) CHARACTER SET latin1 COLLATE latin1_bin DEFAULT NULL,
   `SD_ID` bigint(20) DEFAULT NULL,
   `TBL_ID` bigint(20) DEFAULT NULL,
+  `LINK_TARGET_ID` bigint(20) DEFAULT NULL,
   PRIMARY KEY (`PART_ID`),
   UNIQUE KEY `UNIQUEPARTITION` (`PART_NAME`,`TBL_ID`),
   KEY `PARTITIONS_N49` (`TBL_ID`),
   KEY `PARTITIONS_N50` (`SD_ID`),
+  KEY `PARTITIONS_N51` (`LINK_TARGET_ID`)
   CONSTRAINT `PARTITIONS_FK1` FOREIGN KEY (`TBL_ID`) REFERENCES `TBLS` (`TBL_ID`),
-  CONSTRAINT `PARTITIONS_FK2` FOREIGN KEY (`SD_ID`) REFERENCES `SDS` (`SD_ID`)
+  CONSTRAINT `PARTITIONS_FK2` FOREIGN KEY (`SD_ID`) REFERENCES `SDS` (`SD_ID`),
+  CONSTRAINT `PARTITIONS_FK3` FOREIGN KEY (`LINK_TARGET_ID`) REFERENCES `PARTITIONS` (`PART_ID`)
 ) ENGINE=InnoDB DEFAULT CHARSET=latin1;
 /*!40101 SET character_set_client = @saved_cs_client */;
 
@@ -587,12 +590,15 @@ CREATE TABLE IF NOT EXISTS `TBLS` (
   `TBL_TYPE` varchar(128) CHARACTER SET latin1 COLLATE latin1_bin DEFAULT NULL,
   `VIEW_EXPANDED_TEXT` mediumtext,
   `VIEW_ORIGINAL_TEXT` mediumtext,
+  `LINK_TARGET_ID` bigint(20) DEFAULT NULL,
   PRIMARY KEY (`TBL_ID`),
   UNIQUE KEY `UNIQUETABLE` (`TBL_NAME`,`DB_ID`),
   KEY `TBLS_N50` (`SD_ID`),
   KEY `TBLS_N49` (`DB_ID`),
+  KEY `TBLS_N51` (`LINK_TARGET_ID`),
   CONSTRAINT `TBLS_FK1` FOREIGN KEY (`SD_ID`) REFERENCES `SDS` (`SD_ID`),
-  CONSTRAINT `TBLS_FK2` FOREIGN KEY (`DB_ID`) REFERENCES `DBS` (`DB_ID`)
+  CONSTRAINT `TBLS_FK2` FOREIGN KEY (`DB_ID`) REFERENCES `DBS` (`DB_ID`),
+  CONSTRAINT `TBLS_FK3` FOREIGN KEY (`LINK_TARGET_ID`) REFERENCES `TBLS` (`TBL_ID`)
 ) ENGINE=InnoDB DEFAULT CHARSET=latin1;
 /*!40101 SET character_set_client = @saved_cs_client */;
 

http://git-wip-us.apache.org/repos/asf/hive/blob/cf4b9c1f/metastore/scripts/upgrade/mysql/upgrade-1.1.0-to-1.2.0.mysql.sql
----------------------------------------------------------------------
diff --git a/metastore/scripts/upgrade/mysql/upgrade-1.1.0-to-1.2.0.mysql.sql b/metastore/scripts/upgrade/mysql/upgrade-1.1.0-to-1.2.0.mysql.sql
index e15c758..406504b 100644
--- a/metastore/scripts/upgrade/mysql/upgrade-1.1.0-to-1.2.0.mysql.sql
+++ b/metastore/scripts/upgrade/mysql/upgrade-1.1.0-to-1.2.0.mysql.sql
@@ -1,5 +1,5 @@
 SELECT 'Upgrading MetaStore schema from 1.1.0 to 1.2.0' AS ' ';
-SOURCE 021-HIVE-7018.mysql.sql;
+
 UPDATE VERSION SET SCHEMA_VERSION='1.2.0', VERSION_COMMENT='Hive release version 1.2.0' where VER_ID=1;
 SELECT 'Finished upgrading MetaStore schema from 1.1.0 to 1.2.0' AS ' ';