diff --git standalone-metastore/src/main/java/org/apache/hadoop/hive/metastore/model/MPartition.java standalone-metastore/src/main/java/org/apache/hadoop/hive/metastore/model/MPartition.java index 4a97f891fe..56f904835e 100644 --- standalone-metastore/src/main/java/org/apache/hadoop/hive/metastore/model/MPartition.java +++ standalone-metastore/src/main/java/org/apache/hadoop/hive/metastore/model/MPartition.java @@ -30,7 +30,8 @@ private int lastAccessTime; private MStorageDescriptor sd; private Map parameters; - + private long txnId; + private String writeIdList; public MPartition() {} @@ -152,4 +153,19 @@ public void setCreateTime(int createTime) { this.createTime = createTime; } + public long getTxnId() { + return txnId; + } + + public void setTxnId(long txnId) { + this.txnId = txnId; + } + + public String getWriteIdList() { + return writeIdList; + } + + public void setWriteIdList(String writeIdList) { + this.writeIdList = writeIdList; + } } diff --git standalone-metastore/src/main/java/org/apache/hadoop/hive/metastore/model/MPartitionColumnStatistics.java standalone-metastore/src/main/java/org/apache/hadoop/hive/metastore/model/MPartitionColumnStatistics.java index 50d9c5b0cf..ff68eba4df 100644 --- standalone-metastore/src/main/java/org/apache/hadoop/hive/metastore/model/MPartitionColumnStatistics.java +++ standalone-metastore/src/main/java/org/apache/hadoop/hive/metastore/model/MPartitionColumnStatistics.java @@ -55,6 +55,7 @@ private Long numTrues; private Long numFalses; private long lastAnalyzed; + private long txnId; public MPartitionColumnStatistics() {} @@ -278,4 +279,12 @@ public void setDecimalHighValue(String decimalHighValue) { public void setBitVector(byte[] bitVector) { this.bitVector = bitVector; } + + public long getTxnId() { + return txnId; + } + + public void setTxnId(long txnId) { + this.txnId = txnId; + } } diff --git standalone-metastore/src/main/java/org/apache/hadoop/hive/metastore/model/MTable.java standalone-metastore/src/main/java/org/apache/hadoop/hive/metastore/model/MTable.java index 38ad47915b..2ab046c450 100644 --- standalone-metastore/src/main/java/org/apache/hadoop/hive/metastore/model/MTable.java +++ standalone-metastore/src/main/java/org/apache/hadoop/hive/metastore/model/MTable.java @@ -37,6 +37,8 @@ private String viewExpandedText; private boolean rewriteEnabled; private String tableType; + private long txnId; + private String writeIdList; public MTable() {} @@ -270,4 +272,20 @@ public void setTableType(String tableType) { public String getTableType() { return tableType; } + + public long getTxnId() { + return txnId; + } + + public void setTxnId(long txnId) { + this.txnId = txnId; + } + + public String getWriteIdList() { + return writeIdList; + } + + public void setWriteIdList(String writeIdList) { + this.writeIdList = writeIdList; + } } diff --git standalone-metastore/src/main/java/org/apache/hadoop/hive/metastore/model/MTableColumnStatistics.java standalone-metastore/src/main/java/org/apache/hadoop/hive/metastore/model/MTableColumnStatistics.java index 731cd6f7fa..9d687e4efb 100644 --- standalone-metastore/src/main/java/org/apache/hadoop/hive/metastore/model/MTableColumnStatistics.java +++ standalone-metastore/src/main/java/org/apache/hadoop/hive/metastore/model/MTableColumnStatistics.java @@ -53,6 +53,7 @@ private Long numTrues; private Long numFalses; private long lastAnalyzed; + private long txnId; public MTableColumnStatistics() {} @@ -269,4 +270,12 @@ public void setDecimalHighValue(String decimalHighValue) { public void setBitVector(byte[] bitVector) { this.bitVector = bitVector; } + + public long getTxnId() { + return txnId; + } + + public void setTxnId(long txnId) { + this.txnId = txnId; + } } diff --git standalone-metastore/src/main/java/org/apache/hadoop/hive/metastore/model/MUpdaterTransaction.java standalone-metastore/src/main/java/org/apache/hadoop/hive/metastore/model/MUpdaterTransaction.java new file mode 100644 index 0000000000..e51ef9252b --- /dev/null +++ standalone-metastore/src/main/java/org/apache/hadoop/hive/metastore/model/MUpdaterTransaction.java @@ -0,0 +1,81 @@ +/* + * 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. + */ + +package org.apache.hadoop.hive.metastore.model; + +import java.sql.Timestamp; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +public class MUpdaterTransaction { + private long tblId; + private long txnId; // The corresponding column name is TXN_ID. + private String writeIdList; + // Column UPDATE_ID is used as database identity. + + public MUpdaterTransaction() {} + + public MUpdaterTransaction( + long tblId, + long txnId, + String writeIdList) { + this.tblId = tblId; + this.txnId = txnId; + this.writeIdList = writeIdList; + } + + public MUpdaterTransaction( + long txnId, + String writeIdList) { + this.txnId = txnId; + this.writeIdList = writeIdList; + } + + public MUpdaterTransaction( + long tblId, + long txnId) { + this.tblId = tblId; + this.txnId = txnId; + } + + public long getTblId() { + return tblId; + } + + public void setTblId(long tblId) { + this.tblId = tblId; + } + + public long getTxnId() { + return txnId; + } + + public void setTxnId(long txnId) { + this.txnId = txnId; + } + + public String getWriteIdList() { + return writeIdList; + } + + public void setWriteIdList(String writeIdList) { + this.writeIdList = writeIdList; + } +} + diff --git standalone-metastore/src/main/resources/package.jdo standalone-metastore/src/main/resources/package.jdo index 2d2cb19991..3bbbdb6c5f 100644 --- standalone-metastore/src/main/resources/package.jdo +++ standalone-metastore/src/main/resources/package.jdo @@ -210,6 +210,12 @@ + + + + + + @@ -489,6 +495,12 @@ + + + + + + @@ -965,6 +977,9 @@ + + + @@ -1035,6 +1050,9 @@ + + + diff --git standalone-metastore/src/main/sql/derby/hive-schema-3.0.0.derby.sql standalone-metastore/src/main/sql/derby/hive-schema-3.0.0.derby.sql index 8e097553c3..7610200dff 100644 --- standalone-metastore/src/main/sql/derby/hive-schema-3.0.0.derby.sql +++ standalone-metastore/src/main/sql/derby/hive-schema-3.0.0.derby.sql @@ -47,7 +47,7 @@ CREATE TABLE "APP"."IDXS" ("INDEX_ID" BIGINT NOT NULL, "CREATE_TIME" INTEGER NOT CREATE TABLE "APP"."INDEX_PARAMS" ("INDEX_ID" BIGINT NOT NULL, "PARAM_KEY" VARCHAR(256) NOT NULL, "PARAM_VALUE" VARCHAR(4000)); -CREATE TABLE "APP"."PARTITIONS" ("PART_ID" BIGINT NOT NULL, "CREATE_TIME" INTEGER NOT NULL, "LAST_ACCESS_TIME" INTEGER NOT NULL, "PART_NAME" VARCHAR(767), "SD_ID" BIGINT, "TBL_ID" BIGINT); +CREATE TABLE "APP"."PARTITIONS" ("PART_ID" BIGINT NOT NULL, "CREATE_TIME" INTEGER NOT NULL, "LAST_ACCESS_TIME" INTEGER NOT NULL, "PART_NAME" VARCHAR(767), "SD_ID" BIGINT, "TBL_ID" BIGINT, "TXN_ID" BIGINT DEFAULT 0, "WRITEID_LIST" CLOB); CREATE TABLE "APP"."SERDES" ("SERDE_ID" BIGINT NOT NULL, "NAME" VARCHAR(128), "SLIB" VARCHAR(4000), "DESCRIPTION" VARCHAR(4000), "SERIALIZER_CLASS" VARCHAR(4000), "DESERIALIZER_CLASS" VARCHAR(4000), SERDE_TYPE INTEGER); @@ -75,7 +75,7 @@ CREATE TABLE "APP"."COLUMNS" ("SD_ID" BIGINT NOT NULL, "COMMENT" VARCHAR(256), " CREATE TABLE "APP"."ROLES" ("ROLE_ID" BIGINT NOT NULL, "CREATE_TIME" INTEGER NOT NULL, "OWNER_NAME" VARCHAR(128), "ROLE_NAME" VARCHAR(128)); -CREATE TABLE "APP"."TBLS" ("TBL_ID" BIGINT NOT NULL, "CREATE_TIME" INTEGER NOT NULL, "DB_ID" BIGINT, "LAST_ACCESS_TIME" INTEGER NOT NULL, "OWNER" VARCHAR(767), "OWNER_TYPE" VARCHAR(10), "RETENTION" INTEGER NOT NULL, "SD_ID" BIGINT, "TBL_NAME" VARCHAR(256), "TBL_TYPE" VARCHAR(128), "VIEW_EXPANDED_TEXT" LONG VARCHAR, "VIEW_ORIGINAL_TEXT" LONG VARCHAR, "IS_REWRITE_ENABLED" CHAR(1) NOT NULL DEFAULT 'N'); +CREATE TABLE "APP"."TBLS" ("TBL_ID" BIGINT NOT NULL, "CREATE_TIME" INTEGER NOT NULL, "DB_ID" BIGINT, "LAST_ACCESS_TIME" INTEGER NOT NULL, "OWNER" VARCHAR(767), "OWNER_TYPE" VARCHAR(10), "RETENTION" INTEGER NOT NULL, "SD_ID" BIGINT, "TBL_NAME" VARCHAR(256), "TBL_TYPE" VARCHAR(128), "VIEW_EXPANDED_TEXT" LONG VARCHAR, "VIEW_ORIGINAL_TEXT" LONG VARCHAR, "IS_REWRITE_ENABLED" CHAR(1) NOT NULL DEFAULT 'N', "TXN_ID" BIGINT DEFAULT 0, "WRITEID_LIST" CLOB); CREATE TABLE "APP"."PARTITION_KEYS" ("TBL_ID" BIGINT NOT NULL, "PKEY_COMMENT" VARCHAR(4000), "PKEY_NAME" VARCHAR(128) NOT NULL, "PKEY_TYPE" VARCHAR(767) NOT NULL, "INTEGER_IDX" INTEGER NOT NULL); @@ -106,7 +106,8 @@ CREATE TABLE "APP"."TAB_COL_STATS"( "LAST_ANALYZED" BIGINT, "CS_ID" BIGINT NOT NULL, "TBL_ID" BIGINT NOT NULL, - "BIT_VECTOR" BLOB + "BIT_VECTOR" BLOB, + "TXN_ID" BIGINT DEFAULT 0 ); CREATE TABLE "APP"."TABLE_PARAMS" ("TBL_ID" BIGINT NOT NULL, "PARAM_KEY" VARCHAR(256) NOT NULL, "PARAM_VALUE" CLOB); @@ -155,7 +156,8 @@ CREATE TABLE "APP"."PART_COL_STATS"( "NUM_FALSES" BIGINT, "LAST_ANALYZED" BIGINT, "CS_ID" BIGINT NOT NULL, - "PART_ID" BIGINT NOT NULL + "PART_ID" BIGINT NOT NULL, + "TXN_ID" BIGINT DEFAULT 0 ); CREATE TABLE "APP"."VERSION" ("VER_ID" BIGINT NOT NULL, "SCHEMA_VERSION" VARCHAR(127) NOT NULL, "VERSION_COMMENT" VARCHAR(255)); @@ -373,7 +375,6 @@ ALTER TABLE "APP"."MV_CREATION_METADATA" ADD CONSTRAINT "MV_CREATION_METADATA_PK ALTER TABLE "APP"."CTLGS" ADD CONSTRAINT "CTLG_PK" PRIMARY KEY ("CTLG_ID"); - -- 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; diff --git standalone-metastore/src/main/sql/derby/upgrade-2.3.0-to-3.0.0.derby.sql standalone-metastore/src/main/sql/derby/upgrade-2.3.0-to-3.0.0.derby.sql index 73bef36d68..2cb3c878c2 100644 --- standalone-metastore/src/main/sql/derby/upgrade-2.3.0-to-3.0.0.derby.sql +++ standalone-metastore/src/main/sql/derby/upgrade-2.3.0-to-3.0.0.derby.sql @@ -254,6 +254,14 @@ CREATE TABLE "APP"."RUNTIME_STATS" ( CREATE INDEX IDX_RUNTIME_STATS_CREATE_TIME ON RUNTIME_STATS(CREATE_TIME); +-- HIVE-19416 +ALTER TABLE "APP"."TBLS" ADD WRITEID_LIST CLOB; +ALTER TABLE "APP"."TBLS" ADD TXN_ID bigint DEFAULT 0; +ALTER TABLE "APP"."PARTITIONS" ADD WRITEID_LIST CLOB; +ALTER TABLE "APP"."PARTITIONS" ADD TXN_ID bigint DEFAULT 0; +ALTER TABLE "APP"."TAB_COL_STATS" ADD TXN_ID bigint DEFAULT 0; +ALTER TABLE "APP"."PART_COL_STATS" ADD TXN_ID bigint DEFAULT 0; + -- 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; diff --git standalone-metastore/src/main/sql/derby/upgrade.order.derby standalone-metastore/src/main/sql/derby/upgrade.order.derby index d7091b5228..f43da9af19 100644 --- standalone-metastore/src/main/sql/derby/upgrade.order.derby +++ standalone-metastore/src/main/sql/derby/upgrade.order.derby @@ -14,3 +14,4 @@ 2.1.0-to-2.2.0 2.2.0-to-2.3.0 2.3.0-to-3.0.0 +3.0.0-to-3.1.0 diff --git standalone-metastore/src/main/sql/mssql/hive-schema-3.0.0.mssql.sql standalone-metastore/src/main/sql/mssql/hive-schema-3.0.0.mssql.sql index 51df92cff1..e87d0603e9 100644 --- standalone-metastore/src/main/sql/mssql/hive-schema-3.0.0.mssql.sql +++ standalone-metastore/src/main/sql/mssql/hive-schema-3.0.0.mssql.sql @@ -94,7 +94,8 @@ CREATE TABLE PART_COL_STATS PART_ID bigint NULL, PARTITION_NAME nvarchar(767) NOT NULL, "TABLE_NAME" nvarchar(256) NOT NULL, - "CAT_NAME" nvarchar(256) NOT NULL + "CAT_NAME" nvarchar(256) NOT NULL, + TXN_ID bigint NULL ); ALTER TABLE PART_COL_STATS ADD CONSTRAINT PART_COL_STATS_PK PRIMARY KEY (CS_ID); @@ -144,7 +145,9 @@ CREATE TABLE PARTITIONS LAST_ACCESS_TIME int NOT NULL, PART_NAME nvarchar(767) NULL, SD_ID bigint NULL, - TBL_ID bigint NULL + TBL_ID bigint NULL, + TXN_ID bigint NULL, + WRITEID_LIST text NULL ); ALTER TABLE PARTITIONS ADD CONSTRAINT PARTITIONS_PK PRIMARY KEY (PART_ID); @@ -238,7 +241,8 @@ CREATE TABLE TAB_COL_STATS NUM_TRUES bigint NULL, TBL_ID bigint NULL, "TABLE_NAME" nvarchar(256) NOT NULL, - "CAT_NAME" nvarchar(256) NOT NULL + "CAT_NAME" nvarchar(256) NOT NULL, + TXN_ID bigint NULL ); ALTER TABLE TAB_COL_STATS ADD CONSTRAINT TAB_COL_STATS_PK PRIMARY KEY (CS_ID); @@ -369,7 +373,9 @@ CREATE TABLE TBLS TBL_TYPE nvarchar(128) NULL, VIEW_EXPANDED_TEXT text NULL, VIEW_ORIGINAL_TEXT text NULL, - IS_REWRITE_ENABLED bit NOT NULL DEFAULT 0 + IS_REWRITE_ENABLED bit NOT NULL DEFAULT 0, + TXN_ID bigint NULL, + WRITEID_LIST text NULL ); ALTER TABLE TBLS ADD CONSTRAINT TBLS_PK PRIMARY KEY (TBL_ID); diff --git standalone-metastore/src/main/sql/mssql/upgrade-2.3.0-to-3.0.0.mssql.sql standalone-metastore/src/main/sql/mssql/upgrade-2.3.0-to-3.0.0.mssql.sql index a7232dd443..681a69c16b 100644 --- standalone-metastore/src/main/sql/mssql/upgrade-2.3.0-to-3.0.0.mssql.sql +++ standalone-metastore/src/main/sql/mssql/upgrade-2.3.0-to-3.0.0.mssql.sql @@ -321,6 +321,14 @@ CREATE TABLE RUNTIME_STATS ( CREATE INDEX IDX_RUNTIME_STATS_CREATE_TIME ON RUNTIME_STATS(CREATE_TIME); +-- HIVE-19416 +ALTER TABLE TBLS ADD WRITEID_LIST text NULL; +ALTER TABLE TBLS ADD TXN_ID bigint NULL; +ALTER TABLE PARTITIONS ADD WRITEID_LIST text NULL; +ALTER TABLE PARTITIONS ADD TXN_ID bigint NULL; +ALTER TABLE TAB_COL_STATS ADD TXN_ID bigint NULL; +ALTER TABLE PART_COL_STATS ADD TXN_ID bigint 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; diff --git standalone-metastore/src/main/sql/mysql/hive-schema-3.0.0.mysql.sql standalone-metastore/src/main/sql/mysql/hive-schema-3.0.0.mysql.sql index 8e55e94374..949229858f 100644 --- standalone-metastore/src/main/sql/mysql/hive-schema-3.0.0.mysql.sql +++ standalone-metastore/src/main/sql/mysql/hive-schema-3.0.0.mysql.sql @@ -222,6 +222,8 @@ 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, + `TXN_ID` bigint(20) DEFAULT 0, + `WRITEID_LIST` text DEFAULT NULL, PRIMARY KEY (`PART_ID`), UNIQUE KEY `UNIQUEPARTITION` (`PART_NAME`,`TBL_ID`), KEY `PARTITIONS_N49` (`TBL_ID`), @@ -625,6 +627,8 @@ CREATE TABLE IF NOT EXISTS `TBLS` ( `VIEW_EXPANDED_TEXT` mediumtext, `VIEW_ORIGINAL_TEXT` mediumtext, `IS_REWRITE_ENABLED` bit(1) NOT NULL DEFAULT 0, + `TXN_ID` bigint(20) DEFAULT 0, + `WRITEID_LIST` text DEFAULT NULL, PRIMARY KEY (`TBL_ID`), UNIQUE KEY `UNIQUETABLE` (`TBL_NAME`,`DB_ID`), KEY `TBLS_N50` (`SD_ID`), @@ -720,6 +724,7 @@ CREATE TABLE IF NOT EXISTS `TAB_COL_STATS` ( `NUM_TRUES` bigint(20), `NUM_FALSES` bigint(20), `LAST_ANALYZED` bigint(20) NOT NULL, + `TXN_ID` bigint(20) DEFAULT 0, PRIMARY KEY (`CS_ID`), CONSTRAINT `TAB_COL_STATS_FK` FOREIGN KEY (`TBL_ID`) REFERENCES `TBLS` (`TBL_ID`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1; @@ -750,6 +755,7 @@ CREATE TABLE IF NOT EXISTS `PART_COL_STATS` ( `NUM_TRUES` bigint(20), `NUM_FALSES` bigint(20), `LAST_ANALYZED` bigint(20) NOT NULL, + `TXN_ID` bigint(20) DEFAULT 0, PRIMARY KEY (`CS_ID`), CONSTRAINT `PART_COL_STATS_FK` FOREIGN KEY (`PART_ID`) REFERENCES `PARTITIONS` (`PART_ID`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1; diff --git standalone-metastore/src/main/sql/mysql/upgrade-2.3.0-to-3.0.0.mysql.sql standalone-metastore/src/main/sql/mysql/upgrade-2.3.0-to-3.0.0.mysql.sql index 9a48346c5c..261c6f6ff2 100644 --- standalone-metastore/src/main/sql/mysql/upgrade-2.3.0-to-3.0.0.mysql.sql +++ standalone-metastore/src/main/sql/mysql/upgrade-2.3.0-to-3.0.0.mysql.sql @@ -292,8 +292,16 @@ CREATE TABLE RUNTIME_STATS ( CREATE INDEX IDX_RUNTIME_STATS_CREATE_TIME ON RUNTIME_STATS(CREATE_TIME); +-- HIVE-19416 +ALTER TABLE TBLS ADD TXN_ID bigint; +ALTER TABLE TBLS ADD WRITEID_LIST CLOB; +ALTER TABLE PARTITIONS ADD TXN_ID bigint; +ALTER TABLE PARTITIONS ADD WRITEID_LIST CLOB; +ALTER TABLE TAB_COL_STATS ADD TXN_ID bigint; +ALTER TABLE PART_COL_STATS ADD TXN_ID bigint; + -- 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 ' '; -ALTER TABLE `TBLS` ADD COLUMN `OWNER_TYPE` VARCHAR(10) CHARACTER SET latin1 COLLATE latin1_bin DEFAULT NULL; \ No newline at end of file +ALTER TABLE `TBLS` ADD COLUMN `OWNER_TYPE` VARCHAR(10) CHARACTER SET latin1 COLLATE latin1_bin DEFAULT NULL; diff --git standalone-metastore/src/main/sql/oracle/hive-schema-3.0.0.oracle.sql standalone-metastore/src/main/sql/oracle/hive-schema-3.0.0.oracle.sql index 3a12e087a6..942e3914e0 100644 --- standalone-metastore/src/main/sql/oracle/hive-schema-3.0.0.oracle.sql +++ standalone-metastore/src/main/sql/oracle/hive-schema-3.0.0.oracle.sql @@ -162,7 +162,9 @@ CREATE TABLE PARTITIONS LAST_ACCESS_TIME NUMBER (10) NOT NULL, PART_NAME VARCHAR2(767) NULL, SD_ID NUMBER NULL, - TBL_ID NUMBER NULL + TBL_ID NUMBER NULL, + TXN_ID NUMBER NULL, + WRITEID_LIST CLOB NULL ); ALTER TABLE PARTITIONS ADD CONSTRAINT PARTITIONS_PK PRIMARY KEY (PART_ID); @@ -392,7 +394,9 @@ CREATE TABLE TBLS TBL_TYPE VARCHAR2(128) NULL, VIEW_EXPANDED_TEXT CLOB NULL, VIEW_ORIGINAL_TEXT CLOB NULL, - IS_REWRITE_ENABLED NUMBER(1) DEFAULT 0 NOT NULL CHECK (IS_REWRITE_ENABLED IN (1,0)) + IS_REWRITE_ENABLED NUMBER(1) DEFAULT 0 NOT NULL CHECK (IS_REWRITE_ENABLED IN (1,0)), + TXN_ID NUMBER NULL, + WRITEID_LIST CLOB NULL ); ALTER TABLE TBLS ADD CONSTRAINT TBLS_PK PRIMARY KEY (TBL_ID); @@ -525,7 +529,8 @@ CREATE TABLE TAB_COL_STATS ( MAX_COL_LEN NUMBER, NUM_TRUES NUMBER, NUM_FALSES NUMBER, - LAST_ANALYZED NUMBER NOT NULL + LAST_ANALYZED NUMBER NOT NULL, + TXN_ID NUMBER NULL ); CREATE TABLE VERSION ( @@ -563,7 +568,8 @@ CREATE TABLE PART_COL_STATS ( MAX_COL_LEN NUMBER, NUM_TRUES NUMBER, NUM_FALSES NUMBER, - LAST_ANALYZED NUMBER NOT NULL + LAST_ANALYZED NUMBER NOT NULL, + TXN_ID NUMBER NULL ); ALTER TABLE PART_COL_STATS ADD CONSTRAINT PART_COL_STATS_PKEY PRIMARY KEY (CS_ID); @@ -1134,7 +1140,6 @@ CREATE TABLE RUNTIME_STATS ( CREATE INDEX IDX_RUNTIME_STATS_CREATE_TIME ON RUNTIME_STATS(CREATE_TIME); - -- ----------------------------------------------------------------- -- Record schema version. Should be the last step in the init script -- ----------------------------------------------------------------- diff --git standalone-metastore/src/main/sql/oracle/upgrade-2.3.0-to-3.0.0.oracle.sql standalone-metastore/src/main/sql/oracle/upgrade-2.3.0-to-3.0.0.oracle.sql index 3be7e65713..8283c94055 100644 --- standalone-metastore/src/main/sql/oracle/upgrade-2.3.0-to-3.0.0.oracle.sql +++ standalone-metastore/src/main/sql/oracle/upgrade-2.3.0-to-3.0.0.oracle.sql @@ -310,8 +310,15 @@ CREATE TABLE RUNTIME_STATS ( CREATE INDEX IDX_RUNTIME_STATS_CREATE_TIME ON RUNTIME_STATS(CREATE_TIME); +ALTER TABLE TBLS ADD TXN_ID number NULL; +ALTER TABLE TBLS ADD WRITEID_LIST CLOB NULL; +ALTER TABLE PARTITIONS ADD TXN_ID number NULL; +ALTER TABLE PARTITIONS ADD WRITEID_LIST CLOB NULL; +ALTER TABLE TAB_COL_STATS ADD TXN_ID number NULL; +ALTER TABLE PART_COL_STATS ADD TXN_ID number 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; -ALTER TABLE TBLS ADD OWNER_TYPE VARCHAR2(10) NULL; \ No newline at end of file +ALTER TABLE TBLS ADD OWNER_TYPE VARCHAR2(10) NULL; diff --git standalone-metastore/src/main/sql/postgres/hive-schema-3.0.0.postgres.sql standalone-metastore/src/main/sql/postgres/hive-schema-3.0.0.postgres.sql index 0152f48050..2720902f41 100644 --- standalone-metastore/src/main/sql/postgres/hive-schema-3.0.0.postgres.sql +++ standalone-metastore/src/main/sql/postgres/hive-schema-3.0.0.postgres.sql @@ -166,7 +166,9 @@ CREATE TABLE "PARTITIONS" ( "LAST_ACCESS_TIME" bigint NOT NULL, "PART_NAME" character varying(767) DEFAULT NULL::character varying, "SD_ID" bigint, - "TBL_ID" bigint + "TBL_ID" bigint, + "TXN_ID" bigint, + "WRITEID_LIST" text ); @@ -388,7 +390,9 @@ CREATE TABLE "TBLS" ( "TBL_TYPE" character varying(128) DEFAULT NULL::character varying, "VIEW_EXPANDED_TEXT" text, "VIEW_ORIGINAL_TEXT" text, - "IS_REWRITE_ENABLED" boolean NOT NULL DEFAULT false + "IS_REWRITE_ENABLED" boolean NOT NULL DEFAULT false, + "TXN_ID" bigint, + "WRITEID_LIST" text ); -- @@ -539,7 +543,8 @@ CREATE TABLE "TAB_COL_STATS" ( "MAX_COL_LEN" bigint, "NUM_TRUES" bigint, "NUM_FALSES" bigint, - "LAST_ANALYZED" bigint NOT NULL + "LAST_ANALYZED" bigint NOT NULL, + "TXN_ID" bigint ); -- @@ -577,7 +582,8 @@ CREATE TABLE "PART_COL_STATS" ( "MAX_COL_LEN" bigint, "NUM_TRUES" bigint, "NUM_FALSES" bigint, - "LAST_ANALYZED" bigint NOT NULL + "LAST_ANALYZED" bigint NOT NULL, + "TXN_ID" bigint ); -- @@ -1074,6 +1080,8 @@ ALTER TABLE ONLY "WM_MAPPING" ALTER TABLE ONLY "WM_MAPPING" ADD CONSTRAINT "UNIQUE_WM_MAPPING" UNIQUE ("RP_ID", "ENTITY_TYPE", "ENTITY_NAME"); +-- Transactional table stats PK constraints + -- -- Name: BUCKETING_COLS_N49; Type: INDEX; Schema: public; Owner: hiveuser; Tablespace: -- @@ -1618,6 +1626,8 @@ ALTER TABLE ONLY "MV_TABLES_USED" ALTER TABLE ONLY "MV_TABLES_USED" ADD CONSTRAINT "MV_TABLES_USED_FK2" FOREIGN KEY ("TBL_ID") REFERENCES "TBLS" ("TBL_ID") DEFERRABLE; +-- Transactional table stats FK constraints + -- -- Name: public; Type: ACL; Schema: -; Owner: hiveuser -- @@ -1822,7 +1832,6 @@ CREATE TABLE RUNTIME_STATS ( CREATE INDEX IDX_RUNTIME_STATS_CREATE_TIME ON RUNTIME_STATS(CREATE_TIME); - -- ----------------------------------------------------------------- -- Record schema version. Should be the last step in the init script -- ----------------------------------------------------------------- diff --git standalone-metastore/src/main/sql/postgres/upgrade-2.3.0-to-3.0.0.postgres.sql standalone-metastore/src/main/sql/postgres/upgrade-2.3.0-to-3.0.0.postgres.sql index fed8a93ed6..2739389e07 100644 --- standalone-metastore/src/main/sql/postgres/upgrade-2.3.0-to-3.0.0.postgres.sql +++ standalone-metastore/src/main/sql/postgres/upgrade-2.3.0-to-3.0.0.postgres.sql @@ -329,6 +329,14 @@ CREATE TABLE RUNTIME_STATS ( CREATE INDEX IDX_RUNTIME_STATS_CREATE_TIME ON RUNTIME_STATS(CREATE_TIME); +-- HIVE-19416 +ALTER TABLE "TBLS" ADD "TXN_ID" bigint; +ALTER TABLE "TBLS" ADD "WRITEID_LIST" text; +ALTER TABLE "PARTITIONS" ADD "TXN_ID" bigint; +ALTER TABLE "PARTITIONS" ADD "WRITEID_LIST" text; +ALTER TABLE "TAB_COL_STATS" ADD "TXN_ID" bigint; +ALTER TABLE "PART_COL_STATS" ADD "TXN_ID" bigint; + -- 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'; diff --git standalone-metastore/src/main/thrift/hive_metastore.thrift standalone-metastore/src/main/thrift/hive_metastore.thrift index 19d4433078..18292772bd 100644 --- standalone-metastore/src/main/thrift/hive_metastore.thrift +++ standalone-metastore/src/main/thrift/hive_metastore.thrift @@ -233,6 +233,12 @@ enum SchemaVersionState { DELETED = 8 } +enum IsolationLevelCompliance { + YES = 1, + NO = 2, + UNKNOWN = 3 +} + struct HiveObjectRef{ 1: HiveObjectType objectType, 2: string dbName, @@ -424,7 +430,10 @@ struct Table { 15: optional bool rewriteEnabled, // rewrite enabled or not 16: optional CreationMetadata creationMetadata, // only for MVs, it stores table names used and txn list at MV creation 17: optional string catName, // Name of the catalog the table is in - 18: optional PrincipalType ownerType = PrincipalType.USER // owner type of this table (default to USER for backward compatibility) + 18: optional PrincipalType ownerType = PrincipalType.USER, // owner type of this table (default to USER for backward compatibility) + 19: optional i64 txnId=-1, + 20: optional string validWriteIdList, + 21: optional IsolationLevelCompliance isStatsCompliant } struct Partition { @@ -436,7 +445,10 @@ struct Partition { 6: StorageDescriptor sd, 7: map parameters, 8: optional PrincipalPrivilegeSet privileges, - 9: optional string catName + 9: optional string catName, + 10: optional i64 txnId=-1, + 11: optional string validWriteIdList, + 12: optional IsolationLevelCompliance isStatsCompliant } struct PartitionWithoutSD { @@ -450,7 +462,7 @@ struct PartitionWithoutSD { struct PartitionSpecWithSharedSD { 1: list partitions, - 2: StorageDescriptor sd, + 2: StorageDescriptor sd } struct PartitionListComposingSpec { @@ -463,7 +475,10 @@ struct PartitionSpec { 3: string rootPath, 4: optional PartitionSpecWithSharedSD sharedSDPartitionSpec, 5: optional PartitionListComposingSpec partitionList, - 6: optional string catName + 6: optional string catName, + 7: optional i64 txnId=-1, + 8: optional string validWriteIdList, + 9: optional IsolationLevelCompliance isStatsCompliant } // column statistics @@ -558,17 +573,23 @@ struct ColumnStatisticsDesc { struct ColumnStatistics { 1: required ColumnStatisticsDesc statsDesc, -2: required list statsObj; +2: required list statsObj, +3: optional i64 txnId=-1, +4: optional string validWriteIdList, +5: optional IsolationLevelCompliance isStatsCompliant } struct AggrStats { 1: required list colStats, -2: required i64 partsFound // number of partitions for which stats were found +2: required i64 partsFound, // number of partitions for which stats were found +3: optional IsolationLevelCompliance isStatsCompliant } struct SetPartitionsStatsRequest { 1: required list colStats, -2: optional bool needMerge //stats need to be merged with the existing stats +2: optional bool needMerge, //stats need to be merged with the existing stats +3: optional i64 txnId=-1, +4: optional string validWriteIdList } // schema of the table/query results etc. @@ -697,18 +718,22 @@ struct PartitionsByExprRequest { } struct TableStatsResult { - 1: required list tableStats + 1: required list tableStats, + 2: optional IsolationLevelCompliance isStatsCompliant } struct PartitionsStatsResult { - 1: required map> partStats + 1: required map> partStats, + 2: optional IsolationLevelCompliance isStatsCompliant } struct TableStatsRequest { 1: required string dbName, 2: required string tblName, 3: required list colNames - 4: optional string catName + 4: optional string catName, + 5: optional i64 txnId=-1, + 6: optional string validWriteIdList } struct PartitionsStatsRequest { @@ -716,12 +741,15 @@ struct PartitionsStatsRequest { 2: required string tblName, 3: required list colNames, 4: required list partNames, - 5: optional string catName + 5: optional string catName, + 6: optional i64 txnId=-1, + 7: optional string validWriteIdList } // Return type for add_partitions_req struct AddPartitionsResult { 1: optional list partitions, + 2: optional IsolationLevelCompliance isStatsCompliant } // Request type for add_partitions_req @@ -731,7 +759,9 @@ struct AddPartitionsRequest { 3: required list parts, 4: required bool ifNotExists, 5: optional bool needResult=true, - 6: optional string catName + 6: optional string catName, + 7: optional i64 txnId=-1, + 8: optional string validWriteIdList } // Return type for drop_partitions_req @@ -1203,11 +1233,14 @@ struct GetTableRequest { 1: required string dbName, 2: required string tblName, 3: optional ClientCapabilities capabilities, - 4: optional string catName + 4: optional string catName, + 5: optional i64 txnId=-1, + 6: optional string validWriteIdList } struct GetTableResult { - 1: required Table table + 1: required Table table, + 2: optional IsolationLevelCompliance isStatsCompliant } struct GetTablesRequest { @@ -1538,6 +1571,17 @@ struct GetRuntimeStatsRequest { 2: required i32 maxCreateTime } +struct AddTableWriteSnapshotRequest { + 1: required string catName, + 2: required string dbName, + 3: required string tblName, + 4: required i64 txnId=-1, + 5: required string validWriteIdList, +} + +struct AddTableWriteSnapshotResponse { +} + // Exceptions. exception MetaException { @@ -1867,374 +1911,377 @@ service ThriftHiveMetastore extends fb303.FacebookService // prehooks are fired together followed by all post hooks void alter_partitions(1:string db_name, 2:string tbl_name, 3:list new_parts) throws (1:InvalidOperationException o1, 2:MetaException o2) - void alter_partitions_with_environment_context(1:string db_name, 2:string tbl_name, 3:list new_parts, 4:EnvironmentContext environment_context) throws (1:InvalidOperationException o1, 2:MetaException o2) - - void alter_partition_with_environment_context(1:string db_name, - 2:string tbl_name, 3:Partition new_part, - 4:EnvironmentContext environment_context) - throws (1:InvalidOperationException o1, 2:MetaException o2) - - // rename the old partition to the new partition object by changing old part values to the part values - // in the new_part. old partition is identified from part_vals. - // partition keys in new_part should be the same as those in old partition. - void rename_partition(1:string db_name, 2:string tbl_name, 3:list part_vals, 4:Partition new_part) - throws (1:InvalidOperationException o1, 2:MetaException o2) - - // returns whether or not the partition name is valid based on the value of the config - // hive.metastore.partition.name.whitelist.pattern - bool partition_name_has_valid_characters(1:list part_vals, 2:bool throw_exception) - throws(1: MetaException o1) - - // gets the value of the configuration key in the metastore server. returns - // defaultValue if the key does not exist. if the configuration key does not - // begin with "hive", "mapred", or "hdfs", a ConfigValSecurityException is - // thrown. - string get_config_value(1:string name, 2:string defaultValue) - throws(1:ConfigValSecurityException o1) - - // converts a partition name into a partition values array - list partition_name_to_vals(1: string part_name) - throws(1: MetaException o1) - // converts a partition name into a partition specification (a mapping from - // the partition cols to the values) - map partition_name_to_spec(1: string part_name) - throws(1: MetaException o1) - - void markPartitionForEvent(1:string db_name, 2:string tbl_name, 3:map part_vals, - 4:PartitionEventType eventType) throws (1: MetaException o1, 2: NoSuchObjectException o2, - 3: UnknownDBException o3, 4: UnknownTableException o4, 5: UnknownPartitionException o5, - 6: InvalidPartitionException o6) - bool isPartitionMarkedForEvent(1:string db_name, 2:string tbl_name, 3:map part_vals, - 4: PartitionEventType eventType) throws (1: MetaException o1, 2:NoSuchObjectException o2, - 3: UnknownDBException o3, 4: UnknownTableException o4, 5: UnknownPartitionException o5, - 6: InvalidPartitionException o6) - - //primary keys and foreign keys - PrimaryKeysResponse get_primary_keys(1:PrimaryKeysRequest request) - throws(1:MetaException o1, 2:NoSuchObjectException o2) - ForeignKeysResponse get_foreign_keys(1:ForeignKeysRequest request) - throws(1:MetaException o1, 2:NoSuchObjectException o2) - // other constraints - UniqueConstraintsResponse get_unique_constraints(1:UniqueConstraintsRequest request) - throws(1:MetaException o1, 2:NoSuchObjectException o2) - NotNullConstraintsResponse get_not_null_constraints(1:NotNullConstraintsRequest request) - throws(1:MetaException o1, 2:NoSuchObjectException o2) - DefaultConstraintsResponse get_default_constraints(1:DefaultConstraintsRequest request) - throws(1:MetaException o1, 2:NoSuchObjectException o2) - CheckConstraintsResponse get_check_constraints(1:CheckConstraintsRequest request) - throws(1:MetaException o1, 2:NoSuchObjectException o2) - - // column statistics interfaces - - // update APIs persist the column statistics object(s) that are passed in. If statistics already - // exists for one or more columns, the existing statistics will be overwritten. The update APIs - // validate that the dbName, tableName, partName, colName[] passed in as part of the ColumnStatistics - // struct are valid, throws InvalidInputException/NoSuchObjectException if found to be invalid - bool update_table_column_statistics(1:ColumnStatistics stats_obj) throws (1:NoSuchObjectException o1, - 2:InvalidObjectException o2, 3:MetaException o3, 4:InvalidInputException o4) - bool update_partition_column_statistics(1:ColumnStatistics stats_obj) throws (1:NoSuchObjectException o1, - 2:InvalidObjectException o2, 3:MetaException o3, 4:InvalidInputException o4) - - // get APIs return the column statistics corresponding to db_name, tbl_name, [part_name], col_name if - // such statistics exists. If the required statistics doesn't exist, get APIs throw NoSuchObjectException - // For instance, if get_table_column_statistics is called on a partitioned table for which only - // partition level column stats exist, get_table_column_statistics will throw NoSuchObjectException - ColumnStatistics get_table_column_statistics(1:string db_name, 2:string tbl_name, 3:string col_name) throws - (1:NoSuchObjectException o1, 2:MetaException o2, 3:InvalidInputException o3, 4:InvalidObjectException o4) - ColumnStatistics get_partition_column_statistics(1:string db_name, 2:string tbl_name, 3:string part_name, - 4:string col_name) throws (1:NoSuchObjectException o1, 2:MetaException o2, - 3:InvalidInputException o3, 4:InvalidObjectException o4) - TableStatsResult get_table_statistics_req(1:TableStatsRequest request) throws - (1:NoSuchObjectException o1, 2:MetaException o2) - PartitionsStatsResult get_partitions_statistics_req(1:PartitionsStatsRequest request) throws - (1:NoSuchObjectException o1, 2:MetaException o2) - AggrStats get_aggr_stats_for(1:PartitionsStatsRequest request) throws - (1:NoSuchObjectException o1, 2:MetaException o2) - bool set_aggr_stats_for(1:SetPartitionsStatsRequest request) throws - (1:NoSuchObjectException o1, 2:InvalidObjectException o2, 3:MetaException o3, 4:InvalidInputException o4) - - - // delete APIs attempt to delete column statistics, if found, associated with a given db_name, tbl_name, [part_name] - // and col_name. If the delete API doesn't find the statistics record in the metastore, throws NoSuchObjectException - // Delete API validates the input and if the input is invalid throws InvalidInputException/InvalidObjectException. - bool delete_partition_column_statistics(1:string db_name, 2:string tbl_name, 3:string part_name, 4:string col_name) throws - (1:NoSuchObjectException o1, 2:MetaException o2, 3:InvalidObjectException o3, - 4:InvalidInputException o4) - bool delete_table_column_statistics(1:string db_name, 2:string tbl_name, 3:string col_name) throws - (1:NoSuchObjectException o1, 2:MetaException o2, 3:InvalidObjectException o3, - 4:InvalidInputException o4) - - // - // user-defined functions - // - - void create_function(1:Function func) - throws (1:AlreadyExistsException o1, - 2:InvalidObjectException o2, - 3:MetaException o3, - 4:NoSuchObjectException o4) - - void drop_function(1:string dbName, 2:string funcName) - throws (1:NoSuchObjectException o1, 2:MetaException o3) - - void alter_function(1:string dbName, 2:string funcName, 3:Function newFunc) - throws (1:InvalidOperationException o1, 2:MetaException o2) - - list get_functions(1:string dbName, 2:string pattern) - throws (1:MetaException o1) - Function get_function(1:string dbName, 2:string funcName) - throws (1:MetaException o1, 2:NoSuchObjectException o2) - - GetAllFunctionsResponse get_all_functions() throws (1:MetaException o1) - - //authorization privileges - - bool create_role(1:Role role) throws(1:MetaException o1) - bool drop_role(1:string role_name) throws(1:MetaException o1) - list get_role_names() throws(1:MetaException o1) - // Deprecated, use grant_revoke_role() - bool grant_role(1:string role_name, 2:string principal_name, 3:PrincipalType principal_type, - 4:string grantor, 5:PrincipalType grantorType, 6:bool grant_option) throws(1:MetaException o1) - // Deprecated, use grant_revoke_role() - bool revoke_role(1:string role_name, 2:string principal_name, 3:PrincipalType principal_type) - throws(1:MetaException o1) - list list_roles(1:string principal_name, 2:PrincipalType principal_type) throws(1:MetaException o1) - GrantRevokeRoleResponse grant_revoke_role(1:GrantRevokeRoleRequest request) throws(1:MetaException o1) - - // get all role-grants for users/roles that have been granted the given role - // Note that in the returned list of RolePrincipalGrants, the roleName is - // redundant as it would match the role_name argument of this function - GetPrincipalsInRoleResponse get_principals_in_role(1: GetPrincipalsInRoleRequest request) throws(1:MetaException o1) - - // get grant information of all roles granted to the given principal - // Note that in the returned list of RolePrincipalGrants, the principal name,type is - // redundant as it would match the principal name,type arguments of this function - GetRoleGrantsForPrincipalResponse get_role_grants_for_principal(1: GetRoleGrantsForPrincipalRequest request) throws(1:MetaException o1) - - PrincipalPrivilegeSet get_privilege_set(1:HiveObjectRef hiveObject, 2:string user_name, - 3: list group_names) throws(1:MetaException o1) - list list_privileges(1:string principal_name, 2:PrincipalType principal_type, - 3: HiveObjectRef hiveObject) throws(1:MetaException o1) - - // Deprecated, use grant_revoke_privileges() - bool grant_privileges(1:PrivilegeBag privileges) throws(1:MetaException o1) - // Deprecated, use grant_revoke_privileges() - bool revoke_privileges(1:PrivilegeBag privileges) throws(1:MetaException o1) - GrantRevokePrivilegeResponse grant_revoke_privileges(1:GrantRevokePrivilegeRequest request) throws(1:MetaException o1); - // Revokes all privileges for the object and adds the newly granted privileges for it. - GrantRevokePrivilegeResponse refresh_privileges(1:HiveObjectRef objToRefresh, 2:GrantRevokePrivilegeRequest grantRequest) throws(1:MetaException o1); - - // this is used by metastore client to send UGI information to metastore server immediately - // after setting up a connection. - list set_ugi(1:string user_name, 2:list group_names) throws (1:MetaException o1) - - //Authentication (delegation token) interfaces - - // get metastore server delegation token for use from the map/reduce tasks to authenticate - // to metastore server - string get_delegation_token(1:string token_owner, 2:string renewer_kerberos_principal_name) - throws (1:MetaException o1) - - // method to renew delegation token obtained from metastore server - i64 renew_delegation_token(1:string token_str_form) throws (1:MetaException o1) - - // method to cancel delegation token obtained from metastore server - void cancel_delegation_token(1:string token_str_form) throws (1:MetaException o1) - - // add a delegation token - bool add_token(1:string token_identifier, 2:string delegation_token) - - // remove a delegation token - bool remove_token(1:string token_identifier) - - // get a delegation token by identifier - string get_token(1:string token_identifier) - - // get all delegation token identifiers - list get_all_token_identifiers() - - // add master key - i32 add_master_key(1:string key) throws (1:MetaException o1) - - // update master key - void update_master_key(1:i32 seq_number, 2:string key) throws (1:NoSuchObjectException o1, 2:MetaException o2) - - // remove master key - bool remove_master_key(1:i32 key_seq) - - // get master keys - list get_master_keys() - - // Transaction and lock management calls - // Get just list of open transactions - GetOpenTxnsResponse get_open_txns() - // Get list of open transactions with state (open, aborted) - GetOpenTxnsInfoResponse get_open_txns_info() - OpenTxnsResponse open_txns(1:OpenTxnRequest rqst) - void abort_txn(1:AbortTxnRequest rqst) throws (1:NoSuchTxnException o1) - void abort_txns(1:AbortTxnsRequest rqst) throws (1:NoSuchTxnException o1) - void commit_txn(1:CommitTxnRequest rqst) throws (1:NoSuchTxnException o1, 2:TxnAbortedException o2) - void repl_tbl_writeid_state(1: ReplTblWriteIdStateRequest rqst) - GetValidWriteIdsResponse get_valid_write_ids(1:GetValidWriteIdsRequest rqst) - throws (1:NoSuchTxnException o1, 2:MetaException o2) - AllocateTableWriteIdsResponse allocate_table_write_ids(1:AllocateTableWriteIdsRequest rqst) - throws (1:NoSuchTxnException o1, 2:TxnAbortedException o2, 3:MetaException o3) - LockResponse lock(1:LockRequest rqst) throws (1:NoSuchTxnException o1, 2:TxnAbortedException o2) - LockResponse check_lock(1:CheckLockRequest rqst) - throws (1:NoSuchTxnException o1, 2:TxnAbortedException o2, 3:NoSuchLockException o3) - void unlock(1:UnlockRequest rqst) throws (1:NoSuchLockException o1, 2:TxnOpenException o2) - ShowLocksResponse show_locks(1:ShowLocksRequest rqst) - void heartbeat(1:HeartbeatRequest ids) throws (1:NoSuchLockException o1, 2:NoSuchTxnException o2, 3:TxnAbortedException o3) - HeartbeatTxnRangeResponse heartbeat_txn_range(1:HeartbeatTxnRangeRequest txns) - void compact(1:CompactionRequest rqst) - CompactionResponse compact2(1:CompactionRequest rqst) - ShowCompactResponse show_compact(1:ShowCompactRequest rqst) - void add_dynamic_partitions(1:AddDynamicPartitions rqst) throws (1:NoSuchTxnException o1, 2:TxnAbortedException o2) - - // Notification logging calls - NotificationEventResponse get_next_notification(1:NotificationEventRequest rqst) - CurrentNotificationEventId get_current_notificationEventId() - NotificationEventsCountResponse get_notification_events_count(1:NotificationEventsCountRequest rqst) - FireEventResponse fire_listener_event(1:FireEventRequest rqst) - void flushCache() - - // Repl Change Management api - CmRecycleResponse cm_recycle(1:CmRecycleRequest request) throws(1:MetaException o1) - - GetFileMetadataByExprResult get_file_metadata_by_expr(1:GetFileMetadataByExprRequest req) - GetFileMetadataResult get_file_metadata(1:GetFileMetadataRequest req) - PutFileMetadataResult put_file_metadata(1:PutFileMetadataRequest req) - ClearFileMetadataResult clear_file_metadata(1:ClearFileMetadataRequest req) - CacheFileMetadataResult cache_file_metadata(1:CacheFileMetadataRequest req) - - // Metastore DB properties - string get_metastore_db_uuid() throws (1:MetaException o1) - - // Workload management API's - WMCreateResourcePlanResponse create_resource_plan(1:WMCreateResourcePlanRequest request) - throws(1:AlreadyExistsException o1, 2:InvalidObjectException o2, 3:MetaException o3) - - WMGetResourcePlanResponse get_resource_plan(1:WMGetResourcePlanRequest request) - throws(1:NoSuchObjectException o1, 2:MetaException o2) - - WMGetActiveResourcePlanResponse get_active_resource_plan(1:WMGetActiveResourcePlanRequest request) - throws(1:MetaException o2) - - WMGetAllResourcePlanResponse get_all_resource_plans(1:WMGetAllResourcePlanRequest request) - throws(1:MetaException o1) - - WMAlterResourcePlanResponse alter_resource_plan(1:WMAlterResourcePlanRequest request) - throws(1:NoSuchObjectException o1, 2:InvalidOperationException o2, 3:MetaException o3) - - WMValidateResourcePlanResponse validate_resource_plan(1:WMValidateResourcePlanRequest request) - throws(1:NoSuchObjectException o1, 2:MetaException o2) - - WMDropResourcePlanResponse drop_resource_plan(1:WMDropResourcePlanRequest request) - throws(1:NoSuchObjectException o1, 2:InvalidOperationException o2, 3:MetaException o3) - - WMCreateTriggerResponse create_wm_trigger(1:WMCreateTriggerRequest request) - throws(1:AlreadyExistsException o1, 2:NoSuchObjectException o2, 3:InvalidObjectException o3, 4:MetaException o4) - - WMAlterTriggerResponse alter_wm_trigger(1:WMAlterTriggerRequest request) - throws(1:NoSuchObjectException o1, 2:InvalidObjectException o2, 3:MetaException o3) - - WMDropTriggerResponse drop_wm_trigger(1:WMDropTriggerRequest request) - throws(1:NoSuchObjectException o1, 2:InvalidOperationException o2, 3:MetaException o3) - - WMGetTriggersForResourePlanResponse get_triggers_for_resourceplan(1:WMGetTriggersForResourePlanRequest request) - throws(1:NoSuchObjectException o1, 2:MetaException o2) - - WMCreatePoolResponse create_wm_pool(1:WMCreatePoolRequest request) - throws(1:AlreadyExistsException o1, 2:NoSuchObjectException o2, 3:InvalidObjectException o3, 4:MetaException o4) - - WMAlterPoolResponse alter_wm_pool(1:WMAlterPoolRequest request) - throws(1:AlreadyExistsException o1, 2:NoSuchObjectException o2, 3:InvalidObjectException o3, 4:MetaException o4) - - WMDropPoolResponse drop_wm_pool(1:WMDropPoolRequest request) - throws(1:NoSuchObjectException o1, 2:InvalidOperationException o2, 3:MetaException o3) - - WMCreateOrUpdateMappingResponse create_or_update_wm_mapping(1:WMCreateOrUpdateMappingRequest request) - throws(1:AlreadyExistsException o1, 2:NoSuchObjectException o2, 3:InvalidObjectException o3, 4:MetaException o4) - - WMDropMappingResponse drop_wm_mapping(1:WMDropMappingRequest request) - throws(1:NoSuchObjectException o1, 2:InvalidOperationException o2, 3:MetaException o3) - - WMCreateOrDropTriggerToPoolMappingResponse create_or_drop_wm_trigger_to_pool_mapping(1:WMCreateOrDropTriggerToPoolMappingRequest request) - throws(1:AlreadyExistsException o1, 2:NoSuchObjectException o2, 3:InvalidObjectException o3, 4:MetaException o4) - - // Schema calls - void create_ischema(1:ISchema schema) throws(1:AlreadyExistsException o1, - NoSuchObjectException o2, 3:MetaException o3) - void alter_ischema(1:AlterISchemaRequest rqst) - throws(1:NoSuchObjectException o1, 2:MetaException o2) - ISchema get_ischema(1:ISchemaName name) throws (1:NoSuchObjectException o1, 2:MetaException o2) - void drop_ischema(1:ISchemaName name) - throws(1:NoSuchObjectException o1, 2:InvalidOperationException o2, 3:MetaException o3) - - void add_schema_version(1:SchemaVersion schemaVersion) - throws(1:AlreadyExistsException o1, 2:NoSuchObjectException o2, 3:MetaException o3) - SchemaVersion get_schema_version(1: SchemaVersionDescriptor schemaVersion) - throws (1:NoSuchObjectException o1, 2:MetaException o2) - SchemaVersion get_schema_latest_version(1: ISchemaName schemaName) - throws (1:NoSuchObjectException o1, 2:MetaException o2) - list get_schema_all_versions(1: ISchemaName schemaName) - throws (1:NoSuchObjectException o1, 2:MetaException o2) - void drop_schema_version(1: SchemaVersionDescriptor schemaVersion) - throws(1:NoSuchObjectException o1, 2:MetaException o2) - FindSchemasByColsResp get_schemas_by_cols(1: FindSchemasByColsRqst rqst) - throws(1:MetaException o1) - // There is no blanket update of SchemaVersion since it is (mostly) immutable. The only - // updates are the specific ones to associate a version with a serde and to change its state - void map_schema_version_to_serde(1: MapSchemaVersionToSerdeRequest rqst) - throws(1:NoSuchObjectException o1, 2:MetaException o2) - void set_schema_version_state(1: SetSchemaVersionStateRequest rqst) - throws(1:NoSuchObjectException o1, 2:InvalidOperationException o2, 3:MetaException o3) - - void add_serde(1: SerDeInfo serde) throws(1:AlreadyExistsException o1, 2:MetaException o2) - SerDeInfo get_serde(1: GetSerdeRequest rqst) throws(1:NoSuchObjectException o1, 2:MetaException o2) - - LockResponse get_lock_materialization_rebuild(1: string dbName, 2: string tableName, 3: i64 txnId) - bool heartbeat_lock_materialization_rebuild(1: string dbName, 2: string tableName, 3: i64 txnId) - - void add_runtime_stats(1: RuntimeStat stat) throws(1:MetaException o1) - list get_runtime_stats(1: GetRuntimeStatsRequest rqst) throws(1:MetaException o1) -} - -// * Note about the DDL_TIME: When creating or altering a table or a partition, -// if the DDL_TIME is not set, the current time will be used. - -// For storing info about archived partitions in parameters - -// Whether the partition is archived -const string IS_ARCHIVED = "is_archived", -// The original location of the partition, before archiving. After archiving, -// this directory will contain the archive. When the partition -// is dropped, this directory will be deleted -const string ORIGINAL_LOCATION = "original_location", - -// Whether or not the table is considered immutable - immutable tables can only be -// overwritten or created if unpartitioned, or if partitioned, partitions inside them -// can only be overwritten or created. Immutability supports write-once and replace -// semantics, but not append. -const string IS_IMMUTABLE = "immutable", - -// these should be needed only for backward compatibility with filestore -const string META_TABLE_COLUMNS = "columns", -const string META_TABLE_COLUMN_TYPES = "columns.types", -const string BUCKET_FIELD_NAME = "bucket_field_name", -const string BUCKET_COUNT = "bucket_count", -const string FIELD_TO_DIMENSION = "field_to_dimension", -const string META_TABLE_NAME = "name", -const string META_TABLE_DB = "db", -const string META_TABLE_LOCATION = "location", -const string META_TABLE_SERDE = "serde", -const string META_TABLE_PARTITION_COLUMNS = "partition_columns", -const string META_TABLE_PARTITION_COLUMN_TYPES = "partition_columns.types", -const string FILE_INPUT_FORMAT = "file.inputformat", -const string FILE_OUTPUT_FORMAT = "file.outputformat", -const string META_TABLE_STORAGE = "storage_handler", -const string TABLE_IS_TRANSACTIONAL = "transactional", -const string TABLE_NO_AUTO_COMPACT = "no_auto_compaction", -const string TABLE_TRANSACTIONAL_PROPERTIES = "transactional_properties", -const string TABLE_BUCKETING_VERSION = "bucketing_version", + void alter_partitions_with_environment_context(1:string db_name, 2:string tbl_name, 3:list new_parts, 4:EnvironmentContext environment_context, 5:i64 txnId, 6:string writeIdList) throws (1:InvalidOperationException o1, 2:MetaException o2) + + void alter_partition_with_environment_context(1:string db_name, + 2:string tbl_name, 3:Partition new_part, + 4:EnvironmentContext environment_context) + throws (1:InvalidOperationException o1, 2:MetaException o2) + + // rename the old partition to the new partition object by changing old part values to the part values + // in the new_part. old partition is identified from part_vals. + // partition keys in new_part should be the same as those in old partition. + void rename_partition(1:string db_name, 2:string tbl_name, 3:list part_vals, 4:Partition new_part) + throws (1:InvalidOperationException o1, 2:MetaException o2) + + // returns whether or not the partition name is valid based on the value of the config + // hive.metastore.partition.name.whitelist.pattern + bool partition_name_has_valid_characters(1:list part_vals, 2:bool throw_exception) + throws(1: MetaException o1) + + // gets the value of the configuration key in the metastore server. returns + // defaultValue if the key does not exist. if the configuration key does not + // begin with "hive", "mapred", or "hdfs", a ConfigValSecurityException is + // thrown. + string get_config_value(1:string name, 2:string defaultValue) + throws(1:ConfigValSecurityException o1) + + // converts a partition name into a partition values array + list partition_name_to_vals(1: string part_name) + throws(1: MetaException o1) + // converts a partition name into a partition specification (a mapping from + // the partition cols to the values) + map partition_name_to_spec(1: string part_name) + throws(1: MetaException o1) + + void markPartitionForEvent(1:string db_name, 2:string tbl_name, 3:map part_vals, + 4:PartitionEventType eventType) throws (1: MetaException o1, 2: NoSuchObjectException o2, + 3: UnknownDBException o3, 4: UnknownTableException o4, 5: UnknownPartitionException o5, + 6: InvalidPartitionException o6) + bool isPartitionMarkedForEvent(1:string db_name, 2:string tbl_name, 3:map part_vals, + 4: PartitionEventType eventType) throws (1: MetaException o1, 2:NoSuchObjectException o2, + 3: UnknownDBException o3, 4: UnknownTableException o4, 5: UnknownPartitionException o5, + 6: InvalidPartitionException o6) + + //primary keys and foreign keys + PrimaryKeysResponse get_primary_keys(1:PrimaryKeysRequest request) + throws(1:MetaException o1, 2:NoSuchObjectException o2) + ForeignKeysResponse get_foreign_keys(1:ForeignKeysRequest request) + throws(1:MetaException o1, 2:NoSuchObjectException o2) + // other constraints + UniqueConstraintsResponse get_unique_constraints(1:UniqueConstraintsRequest request) + throws(1:MetaException o1, 2:NoSuchObjectException o2) + NotNullConstraintsResponse get_not_null_constraints(1:NotNullConstraintsRequest request) + throws(1:MetaException o1, 2:NoSuchObjectException o2) + DefaultConstraintsResponse get_default_constraints(1:DefaultConstraintsRequest request) + throws(1:MetaException o1, 2:NoSuchObjectException o2) + CheckConstraintsResponse get_check_constraints(1:CheckConstraintsRequest request) + throws(1:MetaException o1, 2:NoSuchObjectException o2) + + // column statistics interfaces + + // update APIs persist the column statistics object(s) that are passed in. If statistics already + // exists for one or more columns, the existing statistics will be overwritten. The update APIs + // validate that the dbName, tableName, partName, colName[] passed in as part of the ColumnStatistics + // struct are valid, throws InvalidInputException/NoSuchObjectException if found to be invalid + bool update_table_column_statistics(1:ColumnStatistics stats_obj) throws (1:NoSuchObjectException o1, + 2:InvalidObjectException o2, 3:MetaException o3, 4:InvalidInputException o4) + bool update_partition_column_statistics(1:ColumnStatistics stats_obj) throws (1:NoSuchObjectException o1, + 2:InvalidObjectException o2, 3:MetaException o3, 4:InvalidInputException o4) + + // get APIs return the column statistics corresponding to db_name, tbl_name, [part_name], col_name if + // such statistics exists. If the required statistics doesn't exist, get APIs throw NoSuchObjectException + // For instance, if get_table_column_statistics is called on a partitioned table for which only + // partition level column stats exist, get_table_column_statistics will throw NoSuchObjectException + ColumnStatistics get_table_column_statistics(1:string db_name, 2:string tbl_name, 3:string col_name) throws + (1:NoSuchObjectException o1, 2:MetaException o2, 3:InvalidInputException o3, 4:InvalidObjectException o4) + ColumnStatistics get_partition_column_statistics(1:string db_name, 2:string tbl_name, 3:string part_name, + 4:string col_name) throws (1:NoSuchObjectException o1, 2:MetaException o2, + 3:InvalidInputException o3, 4:InvalidObjectException o4) + TableStatsResult get_table_statistics_req(1:TableStatsRequest request) throws + (1:NoSuchObjectException o1, 2:MetaException o2) + PartitionsStatsResult get_partitions_statistics_req(1:PartitionsStatsRequest request) throws + (1:NoSuchObjectException o1, 2:MetaException o2) + AggrStats get_aggr_stats_for(1:PartitionsStatsRequest request) throws + (1:NoSuchObjectException o1, 2:MetaException o2) + bool set_aggr_stats_for(1:SetPartitionsStatsRequest request) throws + (1:NoSuchObjectException o1, 2:InvalidObjectException o2, 3:MetaException o3, 4:InvalidInputException o4) + + + // delete APIs attempt to delete column statistics, if found, associated with a given db_name, tbl_name, [part_name] + // and col_name. If the delete API doesn't find the statistics record in the metastore, throws NoSuchObjectException + // Delete API validates the input and if the input is invalid throws InvalidInputException/InvalidObjectException. + bool delete_partition_column_statistics(1:string db_name, 2:string tbl_name, 3:string part_name, 4:string col_name) throws + (1:NoSuchObjectException o1, 2:MetaException o2, 3:InvalidObjectException o3, + 4:InvalidInputException o4) + bool delete_table_column_statistics(1:string db_name, 2:string tbl_name, 3:string col_name) throws + (1:NoSuchObjectException o1, 2:MetaException o2, 3:InvalidObjectException o3, + 4:InvalidInputException o4) + + // + // user-defined functions + // + + void create_function(1:Function func) + throws (1:AlreadyExistsException o1, + 2:InvalidObjectException o2, + 3:MetaException o3, + 4:NoSuchObjectException o4) + + void drop_function(1:string dbName, 2:string funcName) + throws (1:NoSuchObjectException o1, 2:MetaException o3) + + void alter_function(1:string dbName, 2:string funcName, 3:Function newFunc) + throws (1:InvalidOperationException o1, 2:MetaException o2) + + list get_functions(1:string dbName, 2:string pattern) + throws (1:MetaException o1) + Function get_function(1:string dbName, 2:string funcName) + throws (1:MetaException o1, 2:NoSuchObjectException o2) + + GetAllFunctionsResponse get_all_functions() throws (1:MetaException o1) + + //authorization privileges + + bool create_role(1:Role role) throws(1:MetaException o1) + bool drop_role(1:string role_name) throws(1:MetaException o1) + list get_role_names() throws(1:MetaException o1) + // Deprecated, use grant_revoke_role() + bool grant_role(1:string role_name, 2:string principal_name, 3:PrincipalType principal_type, + 4:string grantor, 5:PrincipalType grantorType, 6:bool grant_option) throws(1:MetaException o1) + // Deprecated, use grant_revoke_role() + bool revoke_role(1:string role_name, 2:string principal_name, 3:PrincipalType principal_type) + throws(1:MetaException o1) + list list_roles(1:string principal_name, 2:PrincipalType principal_type) throws(1:MetaException o1) + GrantRevokeRoleResponse grant_revoke_role(1:GrantRevokeRoleRequest request) throws(1:MetaException o1) + + // get all role-grants for users/roles that have been granted the given role + // Note that in the returned list of RolePrincipalGrants, the roleName is + // redundant as it would match the role_name argument of this function + GetPrincipalsInRoleResponse get_principals_in_role(1: GetPrincipalsInRoleRequest request) throws(1:MetaException o1) + + // get grant information of all roles granted to the given principal + // Note that in the returned list of RolePrincipalGrants, the principal name,type is + // redundant as it would match the principal name,type arguments of this function + GetRoleGrantsForPrincipalResponse get_role_grants_for_principal(1: GetRoleGrantsForPrincipalRequest request) throws(1:MetaException o1) + + PrincipalPrivilegeSet get_privilege_set(1:HiveObjectRef hiveObject, 2:string user_name, + 3: list group_names) throws(1:MetaException o1) + list list_privileges(1:string principal_name, 2:PrincipalType principal_type, + 3: HiveObjectRef hiveObject) throws(1:MetaException o1) + + // Deprecated, use grant_revoke_privileges() + bool grant_privileges(1:PrivilegeBag privileges) throws(1:MetaException o1) + // Deprecated, use grant_revoke_privileges() + bool revoke_privileges(1:PrivilegeBag privileges) throws(1:MetaException o1) + GrantRevokePrivilegeResponse grant_revoke_privileges(1:GrantRevokePrivilegeRequest request) throws(1:MetaException o1); + // Revokes all privileges for the object and adds the newly granted privileges for it. + GrantRevokePrivilegeResponse refresh_privileges(1:HiveObjectRef objToRefresh, 2:GrantRevokePrivilegeRequest grantRequest) throws(1:MetaException o1); + + // this is used by metastore client to send UGI information to metastore server immediately + // after setting up a connection. + list set_ugi(1:string user_name, 2:list group_names) throws (1:MetaException o1) + + //Authentication (delegation token) interfaces + + // get metastore server delegation token for use from the map/reduce tasks to authenticate + // to metastore server + string get_delegation_token(1:string token_owner, 2:string renewer_kerberos_principal_name) + throws (1:MetaException o1) + + // method to renew delegation token obtained from metastore server + i64 renew_delegation_token(1:string token_str_form) throws (1:MetaException o1) + + // method to cancel delegation token obtained from metastore server + void cancel_delegation_token(1:string token_str_form) throws (1:MetaException o1) + + // add a delegation token + bool add_token(1:string token_identifier, 2:string delegation_token) + + // remove a delegation token + bool remove_token(1:string token_identifier) + + // get a delegation token by identifier + string get_token(1:string token_identifier) + + // get all delegation token identifiers + list get_all_token_identifiers() + + // add master key + i32 add_master_key(1:string key) throws (1:MetaException o1) + + // update master key + void update_master_key(1:i32 seq_number, 2:string key) throws (1:NoSuchObjectException o1, 2:MetaException o2) + + // remove master key + bool remove_master_key(1:i32 key_seq) + + // get master keys + list get_master_keys() + + // Transaction and lock management calls + // Get just list of open transactions + GetOpenTxnsResponse get_open_txns() + // Get list of open transactions with state (open, aborted) + GetOpenTxnsInfoResponse get_open_txns_info() + OpenTxnsResponse open_txns(1:OpenTxnRequest rqst) + void abort_txn(1:AbortTxnRequest rqst) throws (1:NoSuchTxnException o1) + void abort_txns(1:AbortTxnsRequest rqst) throws (1:NoSuchTxnException o1) + void commit_txn(1:CommitTxnRequest rqst) throws (1:NoSuchTxnException o1, 2:TxnAbortedException o2) + void repl_tbl_writeid_state(1: ReplTblWriteIdStateRequest rqst) + GetValidWriteIdsResponse get_valid_write_ids(1:GetValidWriteIdsRequest rqst) + throws (1:NoSuchTxnException o1, 2:MetaException o2) + AllocateTableWriteIdsResponse allocate_table_write_ids(1:AllocateTableWriteIdsRequest rqst) + throws (1:NoSuchTxnException o1, 2:TxnAbortedException o2, 3:MetaException o3) + LockResponse lock(1:LockRequest rqst) throws (1:NoSuchTxnException o1, 2:TxnAbortedException o2) + LockResponse check_lock(1:CheckLockRequest rqst) + throws (1:NoSuchTxnException o1, 2:TxnAbortedException o2, 3:NoSuchLockException o3) + void unlock(1:UnlockRequest rqst) throws (1:NoSuchLockException o1, 2:TxnOpenException o2) + ShowLocksResponse show_locks(1:ShowLocksRequest rqst) + void heartbeat(1:HeartbeatRequest ids) throws (1:NoSuchLockException o1, 2:NoSuchTxnException o2, 3:TxnAbortedException o3) + HeartbeatTxnRangeResponse heartbeat_txn_range(1:HeartbeatTxnRangeRequest txns) + void compact(1:CompactionRequest rqst) + CompactionResponse compact2(1:CompactionRequest rqst) + ShowCompactResponse show_compact(1:ShowCompactRequest rqst) + void add_dynamic_partitions(1:AddDynamicPartitions rqst) throws (1:NoSuchTxnException o1, 2:TxnAbortedException o2) + + // Notification logging calls + NotificationEventResponse get_next_notification(1:NotificationEventRequest rqst) + CurrentNotificationEventId get_current_notificationEventId() + NotificationEventsCountResponse get_notification_events_count(1:NotificationEventsCountRequest rqst) + FireEventResponse fire_listener_event(1:FireEventRequest rqst) + void flushCache() + + // Repl Change Management api + CmRecycleResponse cm_recycle(1:CmRecycleRequest request) throws(1:MetaException o1) + + GetFileMetadataByExprResult get_file_metadata_by_expr(1:GetFileMetadataByExprRequest req) + GetFileMetadataResult get_file_metadata(1:GetFileMetadataRequest req) + PutFileMetadataResult put_file_metadata(1:PutFileMetadataRequest req) + ClearFileMetadataResult clear_file_metadata(1:ClearFileMetadataRequest req) + CacheFileMetadataResult cache_file_metadata(1:CacheFileMetadataRequest req) + + // Metastore DB properties + string get_metastore_db_uuid() throws (1:MetaException o1) + + // Workload management API's + WMCreateResourcePlanResponse create_resource_plan(1:WMCreateResourcePlanRequest request) + throws(1:AlreadyExistsException o1, 2:InvalidObjectException o2, 3:MetaException o3) + + WMGetResourcePlanResponse get_resource_plan(1:WMGetResourcePlanRequest request) + throws(1:NoSuchObjectException o1, 2:MetaException o2) + + WMGetActiveResourcePlanResponse get_active_resource_plan(1:WMGetActiveResourcePlanRequest request) + throws(1:MetaException o2) + + WMGetAllResourcePlanResponse get_all_resource_plans(1:WMGetAllResourcePlanRequest request) + throws(1:MetaException o1) + + WMAlterResourcePlanResponse alter_resource_plan(1:WMAlterResourcePlanRequest request) + throws(1:NoSuchObjectException o1, 2:InvalidOperationException o2, 3:MetaException o3) + + WMValidateResourcePlanResponse validate_resource_plan(1:WMValidateResourcePlanRequest request) + throws(1:NoSuchObjectException o1, 2:MetaException o2) + + WMDropResourcePlanResponse drop_resource_plan(1:WMDropResourcePlanRequest request) + throws(1:NoSuchObjectException o1, 2:InvalidOperationException o2, 3:MetaException o3) + + WMCreateTriggerResponse create_wm_trigger(1:WMCreateTriggerRequest request) + throws(1:AlreadyExistsException o1, 2:NoSuchObjectException o2, 3:InvalidObjectException o3, 4:MetaException o4) + + WMAlterTriggerResponse alter_wm_trigger(1:WMAlterTriggerRequest request) + throws(1:NoSuchObjectException o1, 2:InvalidObjectException o2, 3:MetaException o3) + + WMDropTriggerResponse drop_wm_trigger(1:WMDropTriggerRequest request) + throws(1:NoSuchObjectException o1, 2:InvalidOperationException o2, 3:MetaException o3) + + WMGetTriggersForResourePlanResponse get_triggers_for_resourceplan(1:WMGetTriggersForResourePlanRequest request) + throws(1:NoSuchObjectException o1, 2:MetaException o2) + + WMCreatePoolResponse create_wm_pool(1:WMCreatePoolRequest request) + throws(1:AlreadyExistsException o1, 2:NoSuchObjectException o2, 3:InvalidObjectException o3, 4:MetaException o4) + + WMAlterPoolResponse alter_wm_pool(1:WMAlterPoolRequest request) + throws(1:AlreadyExistsException o1, 2:NoSuchObjectException o2, 3:InvalidObjectException o3, 4:MetaException o4) + + WMDropPoolResponse drop_wm_pool(1:WMDropPoolRequest request) + throws(1:NoSuchObjectException o1, 2:InvalidOperationException o2, 3:MetaException o3) + + WMCreateOrUpdateMappingResponse create_or_update_wm_mapping(1:WMCreateOrUpdateMappingRequest request) + throws(1:AlreadyExistsException o1, 2:NoSuchObjectException o2, 3:InvalidObjectException o3, 4:MetaException o4) + + WMDropMappingResponse drop_wm_mapping(1:WMDropMappingRequest request) + throws(1:NoSuchObjectException o1, 2:InvalidOperationException o2, 3:MetaException o3) + + WMCreateOrDropTriggerToPoolMappingResponse create_or_drop_wm_trigger_to_pool_mapping(1:WMCreateOrDropTriggerToPoolMappingRequest request) + throws(1:AlreadyExistsException o1, 2:NoSuchObjectException o2, 3:InvalidObjectException o3, 4:MetaException o4) + + // Schema calls + void create_ischema(1:ISchema schema) throws(1:AlreadyExistsException o1, + NoSuchObjectException o2, 3:MetaException o3) + void alter_ischema(1:AlterISchemaRequest rqst) + throws(1:NoSuchObjectException o1, 2:MetaException o2) + ISchema get_ischema(1:ISchemaName name) throws (1:NoSuchObjectException o1, 2:MetaException o2) + void drop_ischema(1:ISchemaName name) + throws(1:NoSuchObjectException o1, 2:InvalidOperationException o2, 3:MetaException o3) + + void add_schema_version(1:SchemaVersion schemaVersion) + throws(1:AlreadyExistsException o1, 2:NoSuchObjectException o2, 3:MetaException o3) + SchemaVersion get_schema_version(1: SchemaVersionDescriptor schemaVersion) + throws (1:NoSuchObjectException o1, 2:MetaException o2) + SchemaVersion get_schema_latest_version(1: ISchemaName schemaName) + throws (1:NoSuchObjectException o1, 2:MetaException o2) + list get_schema_all_versions(1: ISchemaName schemaName) + throws (1:NoSuchObjectException o1, 2:MetaException o2) + void drop_schema_version(1: SchemaVersionDescriptor schemaVersion) + throws(1:NoSuchObjectException o1, 2:MetaException o2) + FindSchemasByColsResp get_schemas_by_cols(1: FindSchemasByColsRqst rqst) + throws(1:MetaException o1) + // There is no blanket update of SchemaVersion since it is (mostly) immutable. The only + // updates are the specific ones to associate a version with a serde and to change its state + void map_schema_version_to_serde(1: MapSchemaVersionToSerdeRequest rqst) + throws(1:NoSuchObjectException o1, 2:MetaException o2) + void set_schema_version_state(1: SetSchemaVersionStateRequest rqst) + throws(1:NoSuchObjectException o1, 2:InvalidOperationException o2, 3:MetaException o3) + + void add_serde(1: SerDeInfo serde) throws(1:AlreadyExistsException o1, 2:MetaException o2) + SerDeInfo get_serde(1: GetSerdeRequest rqst) throws(1:NoSuchObjectException o1, 2:MetaException o2) + + LockResponse get_lock_materialization_rebuild(1: string dbName, 2: string tableName, 3: i64 txnId) + bool heartbeat_lock_materialization_rebuild(1: string dbName, 2: string tableName, 3: i64 txnId) + + void add_runtime_stats(1: RuntimeStat stat) throws(1:MetaException o1) + list get_runtime_stats(1: GetRuntimeStatsRequest rqst) throws(1:MetaException o1) + + AddTableWriteSnapshotResponse add_table_write_snapshot(1:AddTableWriteSnapshotRequest request) + throws(1:NoSuchObjectException o1, 2:MetaException o2) + } + + // * Note about the DDL_TIME: When creating or altering a table or a partition, + // if the DDL_TIME is not set, the current time will be used. + + // For storing info about archived partitions in parameters + + // Whether the partition is archived + const string IS_ARCHIVED = "is_archived", + // The original location of the partition, before archiving. After archiving, + // this directory will contain the archive. When the partition + // is dropped, this directory will be deleted + const string ORIGINAL_LOCATION = "original_location", + + // Whether or not the table is considered immutable - immutable tables can only be + // overwritten or created if unpartitioned, or if partitioned, partitions inside them + // can only be overwritten or created. Immutability supports write-once and replace + // semantics, but not append. + const string IS_IMMUTABLE = "immutable", + + // these should be needed only for backward compatibility with filestore + const string META_TABLE_COLUMNS = "columns", + const string META_TABLE_COLUMN_TYPES = "columns.types", + const string BUCKET_FIELD_NAME = "bucket_field_name", + const string BUCKET_COUNT = "bucket_count", + const string FIELD_TO_DIMENSION = "field_to_dimension", + const string META_TABLE_NAME = "name", + const string META_TABLE_DB = "db", + const string META_TABLE_LOCATION = "location", + const string META_TABLE_SERDE = "serde", + const string META_TABLE_PARTITION_COLUMNS = "partition_columns", + const string META_TABLE_PARTITION_COLUMN_TYPES = "partition_columns.types", + const string FILE_INPUT_FORMAT = "file.inputformat", + const string FILE_OUTPUT_FORMAT = "file.outputformat", + const string META_TABLE_STORAGE = "storage_handler", + const string TABLE_IS_TRANSACTIONAL = "transactional", + const string TABLE_NO_AUTO_COMPACT = "no_auto_compaction", + const string TABLE_TRANSACTIONAL_PROPERTIES = "transactional_properties", + const string TABLE_BUCKETING_VERSION = "bucketing_version",