commit 5cc58868a2d5cf6cdacdfdf541e45a243157f4cd Author: Alan Gates Date: Fri Jan 8 16:53:59 2016 -0800 HIVE-12821 Thrift and RDBMS schema changes for HIVE-11965 diff --git metastore/if/hive_metastore.thrift metastore/if/hive_metastore.thrift index 9aadc7e..cc93471 100755 --- metastore/if/hive_metastore.thrift +++ metastore/if/hive_metastore.thrift @@ -544,6 +544,7 @@ struct TxnInfo { 3: required string user, // used in 'show transactions' to help admins find who has open transactions 4: required string hostname, // used in 'show transactions' to help admins find who has open transactions 5: optional string agentInfo = "Unknown", + 6: optional i32 heartbeatCount=0, } struct GetOpenTxnsInfoResponse { @@ -618,6 +619,7 @@ struct ShowLocksResponseElement { 9: optional i64 acquiredat, 10: required string user, 11: required string hostname, + 12: optional i32 heartbeatCount = 0, } struct ShowLocksResponse { diff --git metastore/scripts/upgrade/derby/028-HIVE-12821.derby.sql metastore/scripts/upgrade/derby/028-HIVE-12821.derby.sql new file mode 100644 index 0000000..0c10245 --- /dev/null +++ metastore/scripts/upgrade/derby/028-HIVE-12821.derby.sql @@ -0,0 +1,2 @@ +ALTER TABLE "TXNS" ADD "TXN_HEARTBEAT_COUNT" INTEGER; +ALTER TABLE "HIVE_LOCKS" ADD "HL_HEARTBEAT_COUNT" INTEGER; diff --git metastore/scripts/upgrade/derby/hive-txn-schema-1.3.0.derby.sql metastore/scripts/upgrade/derby/hive-txn-schema-1.3.0.derby.sql index 5ad606e..addbf05 100644 --- metastore/scripts/upgrade/derby/hive-txn-schema-1.3.0.derby.sql +++ metastore/scripts/upgrade/derby/hive-txn-schema-1.3.0.derby.sql @@ -23,7 +23,8 @@ CREATE TABLE TXNS ( TXN_LAST_HEARTBEAT bigint NOT NULL, TXN_USER varchar(128) NOT NULL, TXN_HOST varchar(128) NOT NULL, - TXN_AGENT_INFO varchar(128) + TXN_AGENT_INFO varchar(128), + TXN_HEARTBEAT_COUNT integer ); CREATE TABLE TXN_COMPONENTS ( @@ -58,6 +59,7 @@ CREATE TABLE HIVE_LOCKS ( HL_ACQUIRED_AT bigint, HL_USER varchar(128) NOT NULL, HL_HOST varchar(128) NOT NULL, + HL_HEARTBEAT_COUNT integer, PRIMARY KEY(HL_LOCK_EXT_ID, HL_LOCK_INT_ID) ); diff --git metastore/scripts/upgrade/derby/hive-txn-schema-2.0.0.derby.sql metastore/scripts/upgrade/derby/hive-txn-schema-2.0.0.derby.sql index b2308a6..7d1ac0a 100644 --- metastore/scripts/upgrade/derby/hive-txn-schema-2.0.0.derby.sql +++ metastore/scripts/upgrade/derby/hive-txn-schema-2.0.0.derby.sql @@ -23,7 +23,8 @@ CREATE TABLE TXNS ( TXN_LAST_HEARTBEAT bigint NOT NULL, TXN_USER varchar(128) NOT NULL, TXN_HOST varchar(128) NOT NULL, - TXN_AGENT_INFO varchar(128) + TXN_AGENT_INFO varchar(128), + TXN_HEARTBEAT_COUNT integer ); CREATE TABLE TXN_COMPONENTS ( @@ -58,6 +59,7 @@ CREATE TABLE HIVE_LOCKS ( HL_ACQUIRED_AT bigint, HL_USER varchar(128) NOT NULL, HL_HOST varchar(128) NOT NULL, + HL_HEARTBEAT_COUNT integer, PRIMARY KEY(HL_LOCK_EXT_ID, HL_LOCK_INT_ID) ); diff --git metastore/scripts/upgrade/derby/upgrade-1.2.0-to-1.3.0.derby.sql metastore/scripts/upgrade/derby/upgrade-1.2.0-to-1.3.0.derby.sql index cd4901b..f1fe41f 100644 --- metastore/scripts/upgrade/derby/upgrade-1.2.0-to-1.3.0.derby.sql +++ metastore/scripts/upgrade/derby/upgrade-1.2.0-to-1.3.0.derby.sql @@ -5,5 +5,6 @@ RUN '024-HIVE-12814.derby.sql'; RUN '025-HIVE-12816.derby.sql'; RUN '026-HIVE-12818.derby.sql'; RUN '027-HIVE-12819.derby.sql'; +RUN '028-HIVE-12821.derby.sql'; UPDATE "APP".VERSION SET SCHEMA_VERSION='1.3.0', VERSION_COMMENT='Hive release version 1.3.0' where VER_ID=1; diff --git metastore/scripts/upgrade/derby/upgrade-1.2.0-to-2.0.0.derby.sql metastore/scripts/upgrade/derby/upgrade-1.2.0-to-2.0.0.derby.sql index 03be845..92a03df 100644 --- metastore/scripts/upgrade/derby/upgrade-1.2.0-to-2.0.0.derby.sql +++ metastore/scripts/upgrade/derby/upgrade-1.2.0-to-2.0.0.derby.sql @@ -5,5 +5,6 @@ RUN '024-HIVE-12814.derby.sql'; RUN '025-HIVE-12816.derby.sql'; RUN '026-HIVE-12818.derby.sql'; RUN '027-HIVE-12819.derby.sql'; +RUN '028-HIVE-12821.derby.sql'; UPDATE "APP".VERSION SET SCHEMA_VERSION='2.0.0', VERSION_COMMENT='Hive release version 2.0.0' where VER_ID=1; diff --git metastore/scripts/upgrade/mssql/013-HIVE-12821.mssql.sql metastore/scripts/upgrade/mssql/013-HIVE-12821.mssql.sql new file mode 100644 index 0000000..3b8a610 --- /dev/null +++ metastore/scripts/upgrade/mssql/013-HIVE-12821.mssql.sql @@ -0,0 +1,2 @@ +ALTER TABLE TXNS ADD TXN_HEARTBEAT_COUNT int NULL; +ALTER TABLE HIVE_LOCKS ADD HL_HEARTBEAT_COUNT int NULL; diff --git metastore/scripts/upgrade/mssql/hive-schema-1.3.0.mssql.sql metastore/scripts/upgrade/mssql/hive-schema-1.3.0.mssql.sql index 035cdcf..b63c8fb 100644 --- metastore/scripts/upgrade/mssql/hive-schema-1.3.0.mssql.sql +++ metastore/scripts/upgrade/mssql/hive-schema-1.3.0.mssql.sql @@ -915,6 +915,7 @@ CREATE TABLE HIVE_LOCKS( HL_ACQUIRED_AT bigint NULL, HL_USER nvarchar(128) NOT NULL, HL_HOST nvarchar(128) NOT NULL, + HL_HEARTBEAT_COUNT int NULL, PRIMARY KEY CLUSTERED ( HL_LOCK_EXT_ID ASC, @@ -948,6 +949,7 @@ CREATE TABLE TXNS( TXN_USER nvarchar(128) NOT NULL, TXN_HOST nvarchar(128) NOT NULL, TXN_AGENT_INFO nvarchar(128) NULL, + TXN_HEARTBEAT_COUNT int NULL, PRIMARY KEY CLUSTERED ( TXN_ID ASC diff --git metastore/scripts/upgrade/mssql/hive-schema-2.0.0.mssql.sql metastore/scripts/upgrade/mssql/hive-schema-2.0.0.mssql.sql index 431878a..8dd8081 100644 --- metastore/scripts/upgrade/mssql/hive-schema-2.0.0.mssql.sql +++ metastore/scripts/upgrade/mssql/hive-schema-2.0.0.mssql.sql @@ -915,6 +915,7 @@ CREATE TABLE HIVE_LOCKS( HL_ACQUIRED_AT bigint NULL, HL_USER nvarchar(128) NOT NULL, HL_HOST nvarchar(128) NOT NULL, + HL_HEARTBEAT_COUNT int NULL, PRIMARY KEY CLUSTERED ( HL_LOCK_EXT_ID ASC, @@ -948,6 +949,7 @@ CREATE TABLE TXNS( TXN_USER nvarchar(128) NOT NULL, TXN_HOST nvarchar(128) NOT NULL, TXN_AGENT_INFO nvarchar(128) NULL, + TXN_HEARTBEAT_COUNT int NULL, PRIMARY KEY CLUSTERED ( TXN_ID ASC diff --git metastore/scripts/upgrade/mssql/hive-schema-2.1.0.mssql.sql metastore/scripts/upgrade/mssql/hive-schema-2.1.0.mssql.sql index 8992dac..6b87952 100644 --- metastore/scripts/upgrade/mssql/hive-schema-2.1.0.mssql.sql +++ metastore/scripts/upgrade/mssql/hive-schema-2.1.0.mssql.sql @@ -915,6 +915,7 @@ CREATE TABLE HIVE_LOCKS( HL_ACQUIRED_AT bigint NULL, HL_USER nvarchar(128) NOT NULL, HL_HOST nvarchar(128) NOT NULL, + HL_HEARTBEAT_COUNT int NULL, PRIMARY KEY CLUSTERED ( HL_LOCK_EXT_ID ASC, @@ -948,6 +949,7 @@ CREATE TABLE TXNS( TXN_USER nvarchar(128) NOT NULL, TXN_HOST nvarchar(128) NOT NULL, TXN_AGENT_INFO nvarchar(128) NULL, + TXN_HEARTBEAT_COUNT int NULL, PRIMARY KEY CLUSTERED ( TXN_ID ASC diff --git metastore/scripts/upgrade/mssql/upgrade-1.2.0-to-1.3.0.mssql.sql metastore/scripts/upgrade/mssql/upgrade-1.2.0-to-1.3.0.mssql.sql index 40435e5..ea8b279 100644 --- metastore/scripts/upgrade/mssql/upgrade-1.2.0-to-1.3.0.mssql.sql +++ metastore/scripts/upgrade/mssql/upgrade-1.2.0-to-1.3.0.mssql.sql @@ -6,6 +6,7 @@ SELECT 'Upgrading MetaStore schema from 1.2.0 to 1.3.0' AS MESSAGE; :r 010-HIVE-12816.mssql.sql; :r 011-HIVE-12818.mssql.sql; :r 012-HIVE-12819.mssql.sql; +:r 013-HIVE-12821.mssql.sql; UPDATE VERSION SET SCHEMA_VERSION='1.3.0', VERSION_COMMENT='Hive release version 1.3.0' where VER_ID=1; SELECT 'Finished upgrading MetaStore schema from 1.2.0 to 1.3.0' AS MESSAGE; diff --git metastore/scripts/upgrade/mssql/upgrade-1.2.0-to-2.0.0.mssql.sql metastore/scripts/upgrade/mssql/upgrade-1.2.0-to-2.0.0.mssql.sql index e148a7c..7ef17a8 100644 --- metastore/scripts/upgrade/mssql/upgrade-1.2.0-to-2.0.0.mssql.sql +++ metastore/scripts/upgrade/mssql/upgrade-1.2.0-to-2.0.0.mssql.sql @@ -6,6 +6,7 @@ SELECT 'Upgrading MetaStore schema from 1.2.0 to 2.0.0' AS MESSAGE; :r 010-HIVE-12816.mssql.sql; :r 011-HIVE-12818.mssql.sql; :r 012-HIVE-12819.mssql.sql; +:r 013-HIVE-12821.mssql.sql; UPDATE VERSION SET SCHEMA_VERSION='2.0.0', VERSION_COMMENT='Hive release version 2.0.0' where VER_ID=1; SELECT 'Finished upgrading MetaStore schema from 1.2.0 to 2.0.0' AS MESSAGE; diff --git metastore/scripts/upgrade/mysql/028-HIVE-12821.mysql.sql metastore/scripts/upgrade/mysql/028-HIVE-12821.mysql.sql new file mode 100644 index 0000000..a951021 --- /dev/null +++ metastore/scripts/upgrade/mysql/028-HIVE-12821.mysql.sql @@ -0,0 +1,2 @@ +ALTER TABLE `TXNS` ADD `TXN_HEARTBEAT_COUNT` int; +ALTER TABLE `HIVE_LOCKS` ADD `HL_HEARTBEAT_COUNT` int; diff --git metastore/scripts/upgrade/mysql/hive-txn-schema-1.3.0.mysql.sql metastore/scripts/upgrade/mysql/hive-txn-schema-1.3.0.mysql.sql index 289cd37..99b3a66 100644 --- metastore/scripts/upgrade/mysql/hive-txn-schema-1.3.0.mysql.sql +++ metastore/scripts/upgrade/mysql/hive-txn-schema-1.3.0.mysql.sql @@ -24,7 +24,8 @@ CREATE TABLE TXNS ( TXN_LAST_HEARTBEAT bigint NOT NULL, TXN_USER varchar(128) NOT NULL, TXN_HOST varchar(128) NOT NULL, - TXN_AGENT_INFO varchar(128) + TXN_AGENT_INFO varchar(128), + TXN_HEARTBEAT_COUNT int ) ENGINE=InnoDB DEFAULT CHARSET=latin1; CREATE TABLE TXN_COMPONENTS ( @@ -60,6 +61,7 @@ CREATE TABLE HIVE_LOCKS ( HL_ACQUIRED_AT bigint, HL_USER varchar(128) NOT NULL, HL_HOST varchar(128) NOT NULL, + HL_HEARTBEAT_COUNT int, PRIMARY KEY(HL_LOCK_EXT_ID, HL_LOCK_INT_ID), KEY HIVE_LOCK_TXNID_INDEX (HL_TXNID) ) ENGINE=InnoDB DEFAULT CHARSET=latin1; diff --git metastore/scripts/upgrade/mysql/hive-txn-schema-2.0.0.mysql.sql metastore/scripts/upgrade/mysql/hive-txn-schema-2.0.0.mysql.sql index 289cd37..99b3a66 100644 --- metastore/scripts/upgrade/mysql/hive-txn-schema-2.0.0.mysql.sql +++ metastore/scripts/upgrade/mysql/hive-txn-schema-2.0.0.mysql.sql @@ -24,7 +24,8 @@ CREATE TABLE TXNS ( TXN_LAST_HEARTBEAT bigint NOT NULL, TXN_USER varchar(128) NOT NULL, TXN_HOST varchar(128) NOT NULL, - TXN_AGENT_INFO varchar(128) + TXN_AGENT_INFO varchar(128), + TXN_HEARTBEAT_COUNT int ) ENGINE=InnoDB DEFAULT CHARSET=latin1; CREATE TABLE TXN_COMPONENTS ( @@ -60,6 +61,7 @@ CREATE TABLE HIVE_LOCKS ( HL_ACQUIRED_AT bigint, HL_USER varchar(128) NOT NULL, HL_HOST varchar(128) NOT NULL, + HL_HEARTBEAT_COUNT int, PRIMARY KEY(HL_LOCK_EXT_ID, HL_LOCK_INT_ID), KEY HIVE_LOCK_TXNID_INDEX (HL_TXNID) ) ENGINE=InnoDB DEFAULT CHARSET=latin1; diff --git metastore/scripts/upgrade/mysql/upgrade-1.2.0-to-1.3.0.mysql.sql metastore/scripts/upgrade/mysql/upgrade-1.2.0-to-1.3.0.mysql.sql index 22a8489..7aeab34 100644 --- metastore/scripts/upgrade/mysql/upgrade-1.2.0-to-1.3.0.mysql.sql +++ metastore/scripts/upgrade/mysql/upgrade-1.2.0-to-1.3.0.mysql.sql @@ -6,6 +6,7 @@ SOURCE 024-HIVE-12814.mysql.sql; SOURCE 025-HIVE-12816.mysql.sql; SOURCE 026-HIVE-12818.mysql.sql; SOURCE 027-HIVE-12819.mysql.sql; +SOURCE 028-HIVE-12821.mysql.sql; UPDATE VERSION SET SCHEMA_VERSION='1.3.0', VERSION_COMMENT='Hive release version 1.3.0' where VER_ID=1; SELECT 'Finished upgrading MetaStore schema from 1.2.0 to 1.3.0' AS ' '; diff --git metastore/scripts/upgrade/mysql/upgrade-1.2.0-to-2.0.0.mysql.sql metastore/scripts/upgrade/mysql/upgrade-1.2.0-to-2.0.0.mysql.sql index b85041c..86c0d4e 100644 --- metastore/scripts/upgrade/mysql/upgrade-1.2.0-to-2.0.0.mysql.sql +++ metastore/scripts/upgrade/mysql/upgrade-1.2.0-to-2.0.0.mysql.sql @@ -6,6 +6,7 @@ SOURCE 024-HIVE-12814.mysql.sql; SOURCE 025-HIVE-12816.mysql.sql; SOURCE 026-HIVE-12818.mysql.sql; SOURCE 027-HIVE-12819.mysql.sql; +SOURCE 028-HIVE-12821.mysql.sql; UPDATE VERSION SET SCHEMA_VERSION='2.0.0', VERSION_COMMENT='Hive release version 2.0.0' where VER_ID=1; SELECT 'Finished upgrading MetaStore schema from 1.2.0 to 2.0.0' AS ' '; diff --git metastore/scripts/upgrade/oracle/028-HIVE-12821.oracle.sql metastore/scripts/upgrade/oracle/028-HIVE-12821.oracle.sql new file mode 100644 index 0000000..152d2ab --- /dev/null +++ metastore/scripts/upgrade/oracle/028-HIVE-12821.oracle.sql @@ -0,0 +1,2 @@ +ALTER TABLE TXNS ADD TXN_HEARTBEAT_COUNT number(10); +ALTER TABLE HIVE_LOCKS ADD HL_HEARTBEAT_COUNT number(10); diff --git metastore/scripts/upgrade/oracle/hive-txn-schema-1.3.0.oracle.sql metastore/scripts/upgrade/oracle/hive-txn-schema-1.3.0.oracle.sql index b7ebc6e..76ffc9e 100644 --- metastore/scripts/upgrade/oracle/hive-txn-schema-1.3.0.oracle.sql +++ metastore/scripts/upgrade/oracle/hive-txn-schema-1.3.0.oracle.sql @@ -24,7 +24,8 @@ CREATE TABLE TXNS ( TXN_LAST_HEARTBEAT NUMBER(19) NOT NULL, TXN_USER varchar(128) NOT NULL, TXN_HOST varchar(128) NOT NULL, - TXN_AGENT_INFO varchar2(128) + TXN_AGENT_INFO varchar2(128), + TXN_HEARTBEAT_COUNT number(10) ) ROWDEPENDENCIES; CREATE TABLE TXN_COMPONENTS ( @@ -59,6 +60,7 @@ CREATE TABLE HIVE_LOCKS ( HL_ACQUIRED_AT NUMBER(19), HL_USER varchar(128) NOT NULL, HL_HOST varchar(128) NOT NULL, + HL_HEARTBEAT_COUNT number(10), PRIMARY KEY(HL_LOCK_EXT_ID, HL_LOCK_INT_ID) ) ROWDEPENDENCIES; diff --git metastore/scripts/upgrade/oracle/hive-txn-schema-2.0.0.oracle.sql metastore/scripts/upgrade/oracle/hive-txn-schema-2.0.0.oracle.sql index b7ebc6e..76ffc9e 100644 --- metastore/scripts/upgrade/oracle/hive-txn-schema-2.0.0.oracle.sql +++ metastore/scripts/upgrade/oracle/hive-txn-schema-2.0.0.oracle.sql @@ -24,7 +24,8 @@ CREATE TABLE TXNS ( TXN_LAST_HEARTBEAT NUMBER(19) NOT NULL, TXN_USER varchar(128) NOT NULL, TXN_HOST varchar(128) NOT NULL, - TXN_AGENT_INFO varchar2(128) + TXN_AGENT_INFO varchar2(128), + TXN_HEARTBEAT_COUNT number(10) ) ROWDEPENDENCIES; CREATE TABLE TXN_COMPONENTS ( @@ -59,6 +60,7 @@ CREATE TABLE HIVE_LOCKS ( HL_ACQUIRED_AT NUMBER(19), HL_USER varchar(128) NOT NULL, HL_HOST varchar(128) NOT NULL, + HL_HEARTBEAT_COUNT number(10), PRIMARY KEY(HL_LOCK_EXT_ID, HL_LOCK_INT_ID) ) ROWDEPENDENCIES; diff --git metastore/scripts/upgrade/oracle/upgrade-1.2.0-to-1.3.0.oracle.sql metastore/scripts/upgrade/oracle/upgrade-1.2.0-to-1.3.0.oracle.sql index f7e84ec..b35145c 100644 --- metastore/scripts/upgrade/oracle/upgrade-1.2.0-to-1.3.0.oracle.sql +++ metastore/scripts/upgrade/oracle/upgrade-1.2.0-to-1.3.0.oracle.sql @@ -6,6 +6,7 @@ SELECT 'Upgrading MetaStore schema from 1.2.0 to 1.3.0' AS Status from dual; @025-HIVE-12816.oracle.sql; @026-HIVE-12818.oracle.sql; @027-HIVE-12819.oracle.sql; +@028-HIVE-12821.oracle.sql; UPDATE VERSION SET SCHEMA_VERSION='1.3.0', VERSION_COMMENT='Hive release version 1.3.0' where VER_ID=1; SELECT 'Finished upgrading MetaStore schema from 1.2.0 to 1.3.0' AS Status from dual; diff --git metastore/scripts/upgrade/oracle/upgrade-1.2.0-to-2.0.0.oracle.sql metastore/scripts/upgrade/oracle/upgrade-1.2.0-to-2.0.0.oracle.sql index 7ecf8ac..02b8d75 100644 --- metastore/scripts/upgrade/oracle/upgrade-1.2.0-to-2.0.0.oracle.sql +++ metastore/scripts/upgrade/oracle/upgrade-1.2.0-to-2.0.0.oracle.sql @@ -6,6 +6,7 @@ SELECT 'Upgrading MetaStore schema from 1.2.0 to 2.0.0' AS Status from dual; @025-HIVE-12816.oracle.sql; @026-HIVE-12818.oracle.sql; @027-HIVE-12819.oracle.sql; +@028-HIVE-12821.oracle.sql; UPDATE VERSION SET SCHEMA_VERSION='2.0.0', VERSION_COMMENT='Hive release version 2.0.0' where VER_ID=1; SELECT 'Finished upgrading MetaStore schema from 1.2.0 to 2.0.0' AS Status from dual; diff --git metastore/scripts/upgrade/postgres/027-HIVE-12821.postgres.sql metastore/scripts/upgrade/postgres/027-HIVE-12821.postgres.sql new file mode 100644 index 0000000..312fadf --- /dev/null +++ metastore/scripts/upgrade/postgres/027-HIVE-12821.postgres.sql @@ -0,0 +1,2 @@ +ALTER TABLE "TXNS" ADD COLUMN "TXN_HEARTBEAT_COUNT" integer; +ALTER TABLE "HIVE_LOCKS" ADD COLUMN "HL_HEARTBEAT_COUNT" integer; diff --git metastore/scripts/upgrade/postgres/hive-txn-schema-1.3.0.postgres.sql metastore/scripts/upgrade/postgres/hive-txn-schema-1.3.0.postgres.sql index 221e6c8..2dfd49a 100644 --- metastore/scripts/upgrade/postgres/hive-txn-schema-1.3.0.postgres.sql +++ metastore/scripts/upgrade/postgres/hive-txn-schema-1.3.0.postgres.sql @@ -24,7 +24,8 @@ CREATE TABLE TXNS ( TXN_LAST_HEARTBEAT bigint NOT NULL, TXN_USER varchar(128) NOT NULL, TXN_HOST varchar(128) NOT NULL, - TXN_AGENT_INFO varchar(128) + TXN_AGENT_INFO varchar(128), + TXN_HEARTBEAT_COUNT integer ); CREATE TABLE TXN_COMPONENTS ( @@ -59,6 +60,7 @@ CREATE TABLE HIVE_LOCKS ( HL_ACQUIRED_AT bigint, HL_USER varchar(128) NOT NULL, HL_HOST varchar(128) NOT NULL, + HL_HEARTBEAT_COUNT integer, PRIMARY KEY(HL_LOCK_EXT_ID, HL_LOCK_INT_ID) ); diff --git metastore/scripts/upgrade/postgres/hive-txn-schema-2.0.0.postgres.sql metastore/scripts/upgrade/postgres/hive-txn-schema-2.0.0.postgres.sql index 221e6c8..2dfd49a 100644 --- metastore/scripts/upgrade/postgres/hive-txn-schema-2.0.0.postgres.sql +++ metastore/scripts/upgrade/postgres/hive-txn-schema-2.0.0.postgres.sql @@ -24,7 +24,8 @@ CREATE TABLE TXNS ( TXN_LAST_HEARTBEAT bigint NOT NULL, TXN_USER varchar(128) NOT NULL, TXN_HOST varchar(128) NOT NULL, - TXN_AGENT_INFO varchar(128) + TXN_AGENT_INFO varchar(128), + TXN_HEARTBEAT_COUNT integer ); CREATE TABLE TXN_COMPONENTS ( @@ -59,6 +60,7 @@ CREATE TABLE HIVE_LOCKS ( HL_ACQUIRED_AT bigint, HL_USER varchar(128) NOT NULL, HL_HOST varchar(128) NOT NULL, + HL_HEARTBEAT_COUNT integer, PRIMARY KEY(HL_LOCK_EXT_ID, HL_LOCK_INT_ID) ); diff --git metastore/scripts/upgrade/postgres/upgrade-1.2.0-to-1.3.0.postgres.sql metastore/scripts/upgrade/postgres/upgrade-1.2.0-to-1.3.0.postgres.sql index ad7871c..032c3bd 100644 --- metastore/scripts/upgrade/postgres/upgrade-1.2.0-to-1.3.0.postgres.sql +++ metastore/scripts/upgrade/postgres/upgrade-1.2.0-to-1.3.0.postgres.sql @@ -6,6 +6,7 @@ SELECT 'Upgrading MetaStore schema from 1.2.0 to 1.3.0'; \i 024-HIVE-12816.postgres.sql; \i 025-HIVE-12818.postgres.sql; \i 026-HIVE-12819.postgres.sql; +\i 027-HIVE-12821.postgres.sql; UPDATE "VERSION" SET "SCHEMA_VERSION"='1.3.0', "VERSION_COMMENT"='Hive release version 1.3.0' where "VER_ID"=1; SELECT 'Finished upgrading MetaStore schema from 1.2.0 to 1.3.0'; diff --git metastore/scripts/upgrade/postgres/upgrade-1.2.0-to-2.0.0.postgres.sql metastore/scripts/upgrade/postgres/upgrade-1.2.0-to-2.0.0.postgres.sql index 7ee5745..9d7f3cf 100644 --- metastore/scripts/upgrade/postgres/upgrade-1.2.0-to-2.0.0.postgres.sql +++ metastore/scripts/upgrade/postgres/upgrade-1.2.0-to-2.0.0.postgres.sql @@ -6,6 +6,7 @@ SELECT 'Upgrading MetaStore schema from 1.2.0 to 2.0.0'; \i 024-HIVE-12816.postgres.sql; \i 025-HIVE-12818.postgres.sql; \i 026-HIVE-12819.postgres.sql; +\i 027-HIVE-12821.postgres.sql; UPDATE "VERSION" SET "SCHEMA_VERSION"='2.0.0', "VERSION_COMMENT"='Hive release version 2.0.0' where "VER_ID"=1; SELECT 'Finished upgrading MetaStore schema from 1.2.0 to 2.0.0'; diff --git metastore/src/gen/thrift/gen-cpp/hive_metastore_types.cpp metastore/src/gen/thrift/gen-cpp/hive_metastore_types.cpp index 0f0d1dc..8a01a18 100644 --- metastore/src/gen/thrift/gen-cpp/hive_metastore_types.cpp +++ metastore/src/gen/thrift/gen-cpp/hive_metastore_types.cpp @@ -9980,6 +9980,11 @@ void TxnInfo::__set_agentInfo(const std::string& val) { __isset.agentInfo = true; } +void TxnInfo::__set_heartbeatCount(const int32_t val) { + this->heartbeatCount = val; +__isset.heartbeatCount = true; +} + uint32_t TxnInfo::read(::apache::thrift::protocol::TProtocol* iprot) { apache::thrift::protocol::TInputRecursionTracker tracker(*iprot); @@ -10047,6 +10052,14 @@ uint32_t TxnInfo::read(::apache::thrift::protocol::TProtocol* iprot) { xfer += iprot->skip(ftype); } break; + case 6: + if (ftype == ::apache::thrift::protocol::T_I32) { + xfer += iprot->readI32(this->heartbeatCount); + this->__isset.heartbeatCount = true; + } else { + xfer += iprot->skip(ftype); + } + break; default: xfer += iprot->skip(ftype); break; @@ -10093,6 +10106,11 @@ uint32_t TxnInfo::write(::apache::thrift::protocol::TProtocol* oprot) const { xfer += oprot->writeString(this->agentInfo); xfer += oprot->writeFieldEnd(); } + if (this->__isset.heartbeatCount) { + xfer += oprot->writeFieldBegin("heartbeatCount", ::apache::thrift::protocol::T_I32, 6); + xfer += oprot->writeI32(this->heartbeatCount); + xfer += oprot->writeFieldEnd(); + } xfer += oprot->writeFieldStop(); xfer += oprot->writeStructEnd(); return xfer; @@ -10105,6 +10123,7 @@ void swap(TxnInfo &a, TxnInfo &b) { swap(a.user, b.user); swap(a.hostname, b.hostname); swap(a.agentInfo, b.agentInfo); + swap(a.heartbeatCount, b.heartbeatCount); swap(a.__isset, b.__isset); } @@ -10114,6 +10133,7 @@ TxnInfo::TxnInfo(const TxnInfo& other465) { user = other465.user; hostname = other465.hostname; agentInfo = other465.agentInfo; + heartbeatCount = other465.heartbeatCount; __isset = other465.__isset; } TxnInfo& TxnInfo::operator=(const TxnInfo& other466) { @@ -10122,6 +10142,7 @@ TxnInfo& TxnInfo::operator=(const TxnInfo& other466) { user = other466.user; hostname = other466.hostname; agentInfo = other466.agentInfo; + heartbeatCount = other466.heartbeatCount; __isset = other466.__isset; return *this; } @@ -10133,6 +10154,7 @@ void TxnInfo::printTo(std::ostream& out) const { out << ", " << "user=" << to_string(user); out << ", " << "hostname=" << to_string(hostname); out << ", " << "agentInfo="; (__isset.agentInfo ? (out << to_string(agentInfo)) : (out << "")); + out << ", " << "heartbeatCount="; (__isset.heartbeatCount ? (out << to_string(heartbeatCount)) : (out << "")); out << ")"; } @@ -11588,6 +11610,11 @@ void ShowLocksResponseElement::__set_hostname(const std::string& val) { this->hostname = val; } +void ShowLocksResponseElement::__set_heartbeatCount(const int32_t val) { + this->heartbeatCount = val; +__isset.heartbeatCount = true; +} + uint32_t ShowLocksResponseElement::read(::apache::thrift::protocol::TProtocol* iprot) { apache::thrift::protocol::TInputRecursionTracker tracker(*iprot); @@ -11708,6 +11735,14 @@ uint32_t ShowLocksResponseElement::read(::apache::thrift::protocol::TProtocol* i xfer += iprot->skip(ftype); } break; + case 12: + if (ftype == ::apache::thrift::protocol::T_I32) { + xfer += iprot->readI32(this->heartbeatCount); + this->__isset.heartbeatCount = true; + } else { + xfer += iprot->skip(ftype); + } + break; default: xfer += iprot->skip(ftype); break; @@ -11787,6 +11822,11 @@ uint32_t ShowLocksResponseElement::write(::apache::thrift::protocol::TProtocol* xfer += oprot->writeString(this->hostname); xfer += oprot->writeFieldEnd(); + if (this->__isset.heartbeatCount) { + xfer += oprot->writeFieldBegin("heartbeatCount", ::apache::thrift::protocol::T_I32, 12); + xfer += oprot->writeI32(this->heartbeatCount); + xfer += oprot->writeFieldEnd(); + } xfer += oprot->writeFieldStop(); xfer += oprot->writeStructEnd(); return xfer; @@ -11805,6 +11845,7 @@ void swap(ShowLocksResponseElement &a, ShowLocksResponseElement &b) { swap(a.acquiredat, b.acquiredat); swap(a.user, b.user); swap(a.hostname, b.hostname); + swap(a.heartbeatCount, b.heartbeatCount); swap(a.__isset, b.__isset); } @@ -11820,6 +11861,7 @@ ShowLocksResponseElement::ShowLocksResponseElement(const ShowLocksResponseElemen acquiredat = other521.acquiredat; user = other521.user; hostname = other521.hostname; + heartbeatCount = other521.heartbeatCount; __isset = other521.__isset; } ShowLocksResponseElement& ShowLocksResponseElement::operator=(const ShowLocksResponseElement& other522) { @@ -11834,6 +11876,7 @@ ShowLocksResponseElement& ShowLocksResponseElement::operator=(const ShowLocksRes acquiredat = other522.acquiredat; user = other522.user; hostname = other522.hostname; + heartbeatCount = other522.heartbeatCount; __isset = other522.__isset; return *this; } @@ -11851,6 +11894,7 @@ void ShowLocksResponseElement::printTo(std::ostream& out) const { out << ", " << "acquiredat="; (__isset.acquiredat ? (out << to_string(acquiredat)) : (out << "")); out << ", " << "user=" << to_string(user); out << ", " << "hostname=" << to_string(hostname); + out << ", " << "heartbeatCount="; (__isset.heartbeatCount ? (out << to_string(heartbeatCount)) : (out << "")); out << ")"; } diff --git metastore/src/gen/thrift/gen-cpp/hive_metastore_types.h metastore/src/gen/thrift/gen-cpp/hive_metastore_types.h index 5897b95..85178c7 100644 --- metastore/src/gen/thrift/gen-cpp/hive_metastore_types.h +++ metastore/src/gen/thrift/gen-cpp/hive_metastore_types.h @@ -4105,8 +4105,9 @@ inline std::ostream& operator<<(std::ostream& out, const Function& obj) } typedef struct _TxnInfo__isset { - _TxnInfo__isset() : agentInfo(true) {} + _TxnInfo__isset() : agentInfo(true), heartbeatCount(true) {} bool agentInfo :1; + bool heartbeatCount :1; } _TxnInfo__isset; class TxnInfo { @@ -4114,7 +4115,7 @@ class TxnInfo { TxnInfo(const TxnInfo&); TxnInfo& operator=(const TxnInfo&); - TxnInfo() : id(0), state((TxnState::type)0), user(), hostname(), agentInfo("Unknown") { + TxnInfo() : id(0), state((TxnState::type)0), user(), hostname(), agentInfo("Unknown"), heartbeatCount(0) { } virtual ~TxnInfo() throw(); @@ -4123,6 +4124,7 @@ class TxnInfo { std::string user; std::string hostname; std::string agentInfo; + int32_t heartbeatCount; _TxnInfo__isset __isset; @@ -4136,6 +4138,8 @@ class TxnInfo { void __set_agentInfo(const std::string& val); + void __set_heartbeatCount(const int32_t val); + bool operator == (const TxnInfo & rhs) const { if (!(id == rhs.id)) @@ -4150,6 +4154,10 @@ class TxnInfo { return false; else if (__isset.agentInfo && !(agentInfo == rhs.agentInfo)) return false; + if (__isset.heartbeatCount != rhs.__isset.heartbeatCount) + return false; + else if (__isset.heartbeatCount && !(heartbeatCount == rhs.heartbeatCount)) + return false; return true; } bool operator != (const TxnInfo &rhs) const { @@ -4740,11 +4748,12 @@ inline std::ostream& operator<<(std::ostream& out, const ShowLocksRequest& obj) } typedef struct _ShowLocksResponseElement__isset { - _ShowLocksResponseElement__isset() : tablename(false), partname(false), txnid(false), acquiredat(false) {} + _ShowLocksResponseElement__isset() : tablename(false), partname(false), txnid(false), acquiredat(false), heartbeatCount(true) {} bool tablename :1; bool partname :1; bool txnid :1; bool acquiredat :1; + bool heartbeatCount :1; } _ShowLocksResponseElement__isset; class ShowLocksResponseElement { @@ -4752,7 +4761,7 @@ class ShowLocksResponseElement { ShowLocksResponseElement(const ShowLocksResponseElement&); ShowLocksResponseElement& operator=(const ShowLocksResponseElement&); - ShowLocksResponseElement() : lockid(0), dbname(), tablename(), partname(), state((LockState::type)0), type((LockType::type)0), txnid(0), lastheartbeat(0), acquiredat(0), user(), hostname() { + ShowLocksResponseElement() : lockid(0), dbname(), tablename(), partname(), state((LockState::type)0), type((LockType::type)0), txnid(0), lastheartbeat(0), acquiredat(0), user(), hostname(), heartbeatCount(0) { } virtual ~ShowLocksResponseElement() throw(); @@ -4767,6 +4776,7 @@ class ShowLocksResponseElement { int64_t acquiredat; std::string user; std::string hostname; + int32_t heartbeatCount; _ShowLocksResponseElement__isset __isset; @@ -4792,6 +4802,8 @@ class ShowLocksResponseElement { void __set_hostname(const std::string& val); + void __set_heartbeatCount(const int32_t val); + bool operator == (const ShowLocksResponseElement & rhs) const { if (!(lockid == rhs.lockid)) @@ -4824,6 +4836,10 @@ class ShowLocksResponseElement { return false; if (!(hostname == rhs.hostname)) return false; + if (__isset.heartbeatCount != rhs.__isset.heartbeatCount) + return false; + else if (__isset.heartbeatCount && !(heartbeatCount == rhs.heartbeatCount)) + return false; return true; } bool operator != (const ShowLocksResponseElement &rhs) const { diff --git metastore/src/gen/thrift/gen-javabean/org/apache/hadoop/hive/metastore/api/ShowLocksResponseElement.java metastore/src/gen/thrift/gen-javabean/org/apache/hadoop/hive/metastore/api/ShowLocksResponseElement.java index 037a383..4d49061 100644 --- metastore/src/gen/thrift/gen-javabean/org/apache/hadoop/hive/metastore/api/ShowLocksResponseElement.java +++ metastore/src/gen/thrift/gen-javabean/org/apache/hadoop/hive/metastore/api/ShowLocksResponseElement.java @@ -49,6 +49,7 @@ private static final org.apache.thrift.protocol.TField ACQUIREDAT_FIELD_DESC = new org.apache.thrift.protocol.TField("acquiredat", org.apache.thrift.protocol.TType.I64, (short)9); private static final org.apache.thrift.protocol.TField USER_FIELD_DESC = new org.apache.thrift.protocol.TField("user", org.apache.thrift.protocol.TType.STRING, (short)10); private static final org.apache.thrift.protocol.TField HOSTNAME_FIELD_DESC = new org.apache.thrift.protocol.TField("hostname", org.apache.thrift.protocol.TType.STRING, (short)11); + private static final org.apache.thrift.protocol.TField HEARTBEAT_COUNT_FIELD_DESC = new org.apache.thrift.protocol.TField("heartbeatCount", org.apache.thrift.protocol.TType.I32, (short)12); private static final Map, SchemeFactory> schemes = new HashMap, SchemeFactory>(); static { @@ -67,6 +68,7 @@ private long acquiredat; // optional private String user; // required private String hostname; // required + private int heartbeatCount; // optional /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */ public enum _Fields implements org.apache.thrift.TFieldIdEnum { @@ -88,7 +90,8 @@ LASTHEARTBEAT((short)8, "lastheartbeat"), ACQUIREDAT((short)9, "acquiredat"), USER((short)10, "user"), - HOSTNAME((short)11, "hostname"); + HOSTNAME((short)11, "hostname"), + HEARTBEAT_COUNT((short)12, "heartbeatCount"); private static final Map byName = new HashMap(); @@ -125,6 +128,8 @@ public static _Fields findByThriftId(int fieldId) { return USER; case 11: // HOSTNAME return HOSTNAME; + case 12: // HEARTBEAT_COUNT + return HEARTBEAT_COUNT; default: return null; } @@ -169,8 +174,9 @@ public String getFieldName() { private static final int __TXNID_ISSET_ID = 1; private static final int __LASTHEARTBEAT_ISSET_ID = 2; private static final int __ACQUIREDAT_ISSET_ID = 3; + private static final int __HEARTBEATCOUNT_ISSET_ID = 4; private byte __isset_bitfield = 0; - private static final _Fields optionals[] = {_Fields.TABLENAME,_Fields.PARTNAME,_Fields.TXNID,_Fields.ACQUIREDAT}; + private static final _Fields optionals[] = {_Fields.TABLENAME,_Fields.PARTNAME,_Fields.TXNID,_Fields.ACQUIREDAT,_Fields.HEARTBEAT_COUNT}; public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap; static { Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); @@ -196,11 +202,15 @@ public String getFieldName() { new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING))); tmpMap.put(_Fields.HOSTNAME, new org.apache.thrift.meta_data.FieldMetaData("hostname", org.apache.thrift.TFieldRequirementType.REQUIRED, new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING))); + tmpMap.put(_Fields.HEARTBEAT_COUNT, new org.apache.thrift.meta_data.FieldMetaData("heartbeatCount", org.apache.thrift.TFieldRequirementType.OPTIONAL, + new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I32))); metaDataMap = Collections.unmodifiableMap(tmpMap); org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(ShowLocksResponseElement.class, metaDataMap); } public ShowLocksResponseElement() { + this.heartbeatCount = 0; + } public ShowLocksResponseElement( @@ -254,6 +264,7 @@ public ShowLocksResponseElement(ShowLocksResponseElement other) { if (other.isSetHostname()) { this.hostname = other.hostname; } + this.heartbeatCount = other.heartbeatCount; } public ShowLocksResponseElement deepCopy() { @@ -277,6 +288,8 @@ public void clear() { this.acquiredat = 0; this.user = null; this.hostname = null; + this.heartbeatCount = 0; + } public long getLockid() { @@ -544,6 +557,28 @@ public void setHostnameIsSet(boolean value) { } } + public int getHeartbeatCount() { + return this.heartbeatCount; + } + + public void setHeartbeatCount(int heartbeatCount) { + this.heartbeatCount = heartbeatCount; + setHeartbeatCountIsSet(true); + } + + public void unsetHeartbeatCount() { + __isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __HEARTBEATCOUNT_ISSET_ID); + } + + /** Returns true if field heartbeatCount is set (has been assigned a value) and false otherwise */ + public boolean isSetHeartbeatCount() { + return EncodingUtils.testBit(__isset_bitfield, __HEARTBEATCOUNT_ISSET_ID); + } + + public void setHeartbeatCountIsSet(boolean value) { + __isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __HEARTBEATCOUNT_ISSET_ID, value); + } + public void setFieldValue(_Fields field, Object value) { switch (field) { case LOCKID: @@ -634,6 +669,14 @@ public void setFieldValue(_Fields field, Object value) { } break; + case HEARTBEAT_COUNT: + if (value == null) { + unsetHeartbeatCount(); + } else { + setHeartbeatCount((Integer)value); + } + break; + } } @@ -672,6 +715,9 @@ public Object getFieldValue(_Fields field) { case HOSTNAME: return getHostname(); + case HEARTBEAT_COUNT: + return getHeartbeatCount(); + } throw new IllegalStateException(); } @@ -705,6 +751,8 @@ public boolean isSet(_Fields field) { return isSetUser(); case HOSTNAME: return isSetHostname(); + case HEARTBEAT_COUNT: + return isSetHeartbeatCount(); } throw new IllegalStateException(); } @@ -821,6 +869,15 @@ public boolean equals(ShowLocksResponseElement that) { return false; } + boolean this_present_heartbeatCount = true && this.isSetHeartbeatCount(); + boolean that_present_heartbeatCount = true && that.isSetHeartbeatCount(); + if (this_present_heartbeatCount || that_present_heartbeatCount) { + if (!(this_present_heartbeatCount && that_present_heartbeatCount)) + return false; + if (this.heartbeatCount != that.heartbeatCount) + return false; + } + return true; } @@ -883,6 +940,11 @@ public int hashCode() { if (present_hostname) list.add(hostname); + boolean present_heartbeatCount = true && (isSetHeartbeatCount()); + list.add(present_heartbeatCount); + if (present_heartbeatCount) + list.add(heartbeatCount); + return list.hashCode(); } @@ -1004,6 +1066,16 @@ public int compareTo(ShowLocksResponseElement other) { return lastComparison; } } + lastComparison = Boolean.valueOf(isSetHeartbeatCount()).compareTo(other.isSetHeartbeatCount()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetHeartbeatCount()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.heartbeatCount, other.heartbeatCount); + if (lastComparison != 0) { + return lastComparison; + } + } return 0; } @@ -1103,6 +1175,12 @@ public String toString() { sb.append(this.hostname); } first = false; + if (isSetHeartbeatCount()) { + if (!first) sb.append(", "); + sb.append("heartbeatCount:"); + sb.append(this.heartbeatCount); + first = false; + } sb.append(")"); return sb.toString(); } @@ -1264,6 +1342,14 @@ public void read(org.apache.thrift.protocol.TProtocol iprot, ShowLocksResponseEl org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); } break; + case 12: // HEARTBEAT_COUNT + if (schemeField.type == org.apache.thrift.protocol.TType.I32) { + struct.heartbeatCount = iprot.readI32(); + struct.setHeartbeatCountIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; default: org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); } @@ -1332,6 +1418,11 @@ public void write(org.apache.thrift.protocol.TProtocol oprot, ShowLocksResponseE oprot.writeString(struct.hostname); oprot.writeFieldEnd(); } + if (struct.isSetHeartbeatCount()) { + oprot.writeFieldBegin(HEARTBEAT_COUNT_FIELD_DESC); + oprot.writeI32(struct.heartbeatCount); + oprot.writeFieldEnd(); + } oprot.writeFieldStop(); oprot.writeStructEnd(); } @@ -1369,7 +1460,10 @@ public void write(org.apache.thrift.protocol.TProtocol prot, ShowLocksResponseEl if (struct.isSetAcquiredat()) { optionals.set(3); } - oprot.writeBitSet(optionals, 4); + if (struct.isSetHeartbeatCount()) { + optionals.set(4); + } + oprot.writeBitSet(optionals, 5); if (struct.isSetTablename()) { oprot.writeString(struct.tablename); } @@ -1382,6 +1476,9 @@ public void write(org.apache.thrift.protocol.TProtocol prot, ShowLocksResponseEl if (struct.isSetAcquiredat()) { oprot.writeI64(struct.acquiredat); } + if (struct.isSetHeartbeatCount()) { + oprot.writeI32(struct.heartbeatCount); + } } @Override @@ -1401,7 +1498,7 @@ public void read(org.apache.thrift.protocol.TProtocol prot, ShowLocksResponseEle struct.setUserIsSet(true); struct.hostname = iprot.readString(); struct.setHostnameIsSet(true); - BitSet incoming = iprot.readBitSet(4); + BitSet incoming = iprot.readBitSet(5); if (incoming.get(0)) { struct.tablename = iprot.readString(); struct.setTablenameIsSet(true); @@ -1418,6 +1515,10 @@ public void read(org.apache.thrift.protocol.TProtocol prot, ShowLocksResponseEle struct.acquiredat = iprot.readI64(); struct.setAcquiredatIsSet(true); } + if (incoming.get(4)) { + struct.heartbeatCount = iprot.readI32(); + struct.setHeartbeatCountIsSet(true); + } } } diff --git metastore/src/gen/thrift/gen-javabean/org/apache/hadoop/hive/metastore/api/TxnInfo.java metastore/src/gen/thrift/gen-javabean/org/apache/hadoop/hive/metastore/api/TxnInfo.java index 3d46c38..ca1ef86 100644 --- metastore/src/gen/thrift/gen-javabean/org/apache/hadoop/hive/metastore/api/TxnInfo.java +++ metastore/src/gen/thrift/gen-javabean/org/apache/hadoop/hive/metastore/api/TxnInfo.java @@ -43,6 +43,7 @@ private static final org.apache.thrift.protocol.TField USER_FIELD_DESC = new org.apache.thrift.protocol.TField("user", org.apache.thrift.protocol.TType.STRING, (short)3); private static final org.apache.thrift.protocol.TField HOSTNAME_FIELD_DESC = new org.apache.thrift.protocol.TField("hostname", org.apache.thrift.protocol.TType.STRING, (short)4); private static final org.apache.thrift.protocol.TField AGENT_INFO_FIELD_DESC = new org.apache.thrift.protocol.TField("agentInfo", org.apache.thrift.protocol.TType.STRING, (short)5); + private static final org.apache.thrift.protocol.TField HEARTBEAT_COUNT_FIELD_DESC = new org.apache.thrift.protocol.TField("heartbeatCount", org.apache.thrift.protocol.TType.I32, (short)6); private static final Map, SchemeFactory> schemes = new HashMap, SchemeFactory>(); static { @@ -55,6 +56,7 @@ private String user; // required private String hostname; // required private String agentInfo; // optional + private int heartbeatCount; // optional /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */ public enum _Fields implements org.apache.thrift.TFieldIdEnum { @@ -66,7 +68,8 @@ STATE((short)2, "state"), USER((short)3, "user"), HOSTNAME((short)4, "hostname"), - AGENT_INFO((short)5, "agentInfo"); + AGENT_INFO((short)5, "agentInfo"), + HEARTBEAT_COUNT((short)6, "heartbeatCount"); private static final Map byName = new HashMap(); @@ -91,6 +94,8 @@ public static _Fields findByThriftId(int fieldId) { return HOSTNAME; case 5: // AGENT_INFO return AGENT_INFO; + case 6: // HEARTBEAT_COUNT + return HEARTBEAT_COUNT; default: return null; } @@ -132,8 +137,9 @@ public String getFieldName() { // isset id assignments private static final int __ID_ISSET_ID = 0; + private static final int __HEARTBEATCOUNT_ISSET_ID = 1; private byte __isset_bitfield = 0; - private static final _Fields optionals[] = {_Fields.AGENT_INFO}; + private static final _Fields optionals[] = {_Fields.AGENT_INFO,_Fields.HEARTBEAT_COUNT}; public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap; static { Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); @@ -147,6 +153,8 @@ public String getFieldName() { new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING))); tmpMap.put(_Fields.AGENT_INFO, new org.apache.thrift.meta_data.FieldMetaData("agentInfo", org.apache.thrift.TFieldRequirementType.OPTIONAL, new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING))); + tmpMap.put(_Fields.HEARTBEAT_COUNT, new org.apache.thrift.meta_data.FieldMetaData("heartbeatCount", org.apache.thrift.TFieldRequirementType.OPTIONAL, + new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I32))); metaDataMap = Collections.unmodifiableMap(tmpMap); org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(TxnInfo.class, metaDataMap); } @@ -154,6 +162,8 @@ public String getFieldName() { public TxnInfo() { this.agentInfo = "Unknown"; + this.heartbeatCount = 0; + } public TxnInfo( @@ -188,6 +198,7 @@ public TxnInfo(TxnInfo other) { if (other.isSetAgentInfo()) { this.agentInfo = other.agentInfo; } + this.heartbeatCount = other.heartbeatCount; } public TxnInfo deepCopy() { @@ -203,6 +214,8 @@ public void clear() { this.hostname = null; this.agentInfo = "Unknown"; + this.heartbeatCount = 0; + } public long getId() { @@ -327,6 +340,28 @@ public void setAgentInfoIsSet(boolean value) { } } + public int getHeartbeatCount() { + return this.heartbeatCount; + } + + public void setHeartbeatCount(int heartbeatCount) { + this.heartbeatCount = heartbeatCount; + setHeartbeatCountIsSet(true); + } + + public void unsetHeartbeatCount() { + __isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __HEARTBEATCOUNT_ISSET_ID); + } + + /** Returns true if field heartbeatCount is set (has been assigned a value) and false otherwise */ + public boolean isSetHeartbeatCount() { + return EncodingUtils.testBit(__isset_bitfield, __HEARTBEATCOUNT_ISSET_ID); + } + + public void setHeartbeatCountIsSet(boolean value) { + __isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __HEARTBEATCOUNT_ISSET_ID, value); + } + public void setFieldValue(_Fields field, Object value) { switch (field) { case ID: @@ -369,6 +404,14 @@ public void setFieldValue(_Fields field, Object value) { } break; + case HEARTBEAT_COUNT: + if (value == null) { + unsetHeartbeatCount(); + } else { + setHeartbeatCount((Integer)value); + } + break; + } } @@ -389,6 +432,9 @@ public Object getFieldValue(_Fields field) { case AGENT_INFO: return getAgentInfo(); + case HEARTBEAT_COUNT: + return getHeartbeatCount(); + } throw new IllegalStateException(); } @@ -410,6 +456,8 @@ public boolean isSet(_Fields field) { return isSetHostname(); case AGENT_INFO: return isSetAgentInfo(); + case HEARTBEAT_COUNT: + return isSetHeartbeatCount(); } throw new IllegalStateException(); } @@ -472,6 +520,15 @@ public boolean equals(TxnInfo that) { return false; } + boolean this_present_heartbeatCount = true && this.isSetHeartbeatCount(); + boolean that_present_heartbeatCount = true && that.isSetHeartbeatCount(); + if (this_present_heartbeatCount || that_present_heartbeatCount) { + if (!(this_present_heartbeatCount && that_present_heartbeatCount)) + return false; + if (this.heartbeatCount != that.heartbeatCount) + return false; + } + return true; } @@ -504,6 +561,11 @@ public int hashCode() { if (present_agentInfo) list.add(agentInfo); + boolean present_heartbeatCount = true && (isSetHeartbeatCount()); + list.add(present_heartbeatCount); + if (present_heartbeatCount) + list.add(heartbeatCount); + return list.hashCode(); } @@ -565,6 +627,16 @@ public int compareTo(TxnInfo other) { return lastComparison; } } + lastComparison = Boolean.valueOf(isSetHeartbeatCount()).compareTo(other.isSetHeartbeatCount()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetHeartbeatCount()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.heartbeatCount, other.heartbeatCount); + if (lastComparison != 0) { + return lastComparison; + } + } return 0; } @@ -622,6 +694,12 @@ public String toString() { } first = false; } + if (isSetHeartbeatCount()) { + if (!first) sb.append(", "); + sb.append("heartbeatCount:"); + sb.append(this.heartbeatCount); + first = false; + } sb.append(")"); return sb.toString(); } @@ -723,6 +801,14 @@ public void read(org.apache.thrift.protocol.TProtocol iprot, TxnInfo struct) thr org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); } break; + case 6: // HEARTBEAT_COUNT + if (schemeField.type == org.apache.thrift.protocol.TType.I32) { + struct.heartbeatCount = iprot.readI32(); + struct.setHeartbeatCountIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; default: org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); } @@ -761,6 +847,11 @@ public void write(org.apache.thrift.protocol.TProtocol oprot, TxnInfo struct) th oprot.writeFieldEnd(); } } + if (struct.isSetHeartbeatCount()) { + oprot.writeFieldBegin(HEARTBEAT_COUNT_FIELD_DESC); + oprot.writeI32(struct.heartbeatCount); + oprot.writeFieldEnd(); + } oprot.writeFieldStop(); oprot.writeStructEnd(); } @@ -786,10 +877,16 @@ public void write(org.apache.thrift.protocol.TProtocol prot, TxnInfo struct) thr if (struct.isSetAgentInfo()) { optionals.set(0); } - oprot.writeBitSet(optionals, 1); + if (struct.isSetHeartbeatCount()) { + optionals.set(1); + } + oprot.writeBitSet(optionals, 2); if (struct.isSetAgentInfo()) { oprot.writeString(struct.agentInfo); } + if (struct.isSetHeartbeatCount()) { + oprot.writeI32(struct.heartbeatCount); + } } @Override @@ -803,11 +900,15 @@ public void read(org.apache.thrift.protocol.TProtocol prot, TxnInfo struct) thro struct.setUserIsSet(true); struct.hostname = iprot.readString(); struct.setHostnameIsSet(true); - BitSet incoming = iprot.readBitSet(1); + BitSet incoming = iprot.readBitSet(2); if (incoming.get(0)) { struct.agentInfo = iprot.readString(); struct.setAgentInfoIsSet(true); } + if (incoming.get(1)) { + struct.heartbeatCount = iprot.readI32(); + struct.setHeartbeatCountIsSet(true); + } } } diff --git metastore/src/gen/thrift/gen-php/metastore/Types.php metastore/src/gen/thrift/gen-php/metastore/Types.php index 545900a..2a109ed 100644 --- metastore/src/gen/thrift/gen-php/metastore/Types.php +++ metastore/src/gen/thrift/gen-php/metastore/Types.php @@ -10089,6 +10089,10 @@ class TxnInfo { * @var string */ public $agentInfo = "Unknown"; + /** + * @var int + */ + public $heartbeatCount = 0; public function __construct($vals=null) { if (!isset(self::$_TSPEC)) { @@ -10113,6 +10117,10 @@ class TxnInfo { 'var' => 'agentInfo', 'type' => TType::STRING, ), + 6 => array( + 'var' => 'heartbeatCount', + 'type' => TType::I32, + ), ); } if (is_array($vals)) { @@ -10131,6 +10139,9 @@ class TxnInfo { if (isset($vals['agentInfo'])) { $this->agentInfo = $vals['agentInfo']; } + if (isset($vals['heartbeatCount'])) { + $this->heartbeatCount = $vals['heartbeatCount']; + } } } @@ -10188,6 +10199,13 @@ class TxnInfo { $xfer += $input->skip($ftype); } break; + case 6: + if ($ftype == TType::I32) { + $xfer += $input->readI32($this->heartbeatCount); + } else { + $xfer += $input->skip($ftype); + } + break; default: $xfer += $input->skip($ftype); break; @@ -10226,6 +10244,11 @@ class TxnInfo { $xfer += $output->writeString($this->agentInfo); $xfer += $output->writeFieldEnd(); } + if ($this->heartbeatCount !== null) { + $xfer += $output->writeFieldBegin('heartbeatCount', TType::I32, 6); + $xfer += $output->writeI32($this->heartbeatCount); + $xfer += $output->writeFieldEnd(); + } $xfer += $output->writeFieldStop(); $xfer += $output->writeStructEnd(); return $xfer; @@ -11570,6 +11593,10 @@ class ShowLocksResponseElement { * @var string */ public $hostname = null; + /** + * @var int + */ + public $heartbeatCount = 0; public function __construct($vals=null) { if (!isset(self::$_TSPEC)) { @@ -11618,6 +11645,10 @@ class ShowLocksResponseElement { 'var' => 'hostname', 'type' => TType::STRING, ), + 12 => array( + 'var' => 'heartbeatCount', + 'type' => TType::I32, + ), ); } if (is_array($vals)) { @@ -11654,6 +11685,9 @@ class ShowLocksResponseElement { if (isset($vals['hostname'])) { $this->hostname = $vals['hostname']; } + if (isset($vals['heartbeatCount'])) { + $this->heartbeatCount = $vals['heartbeatCount']; + } } } @@ -11753,6 +11787,13 @@ class ShowLocksResponseElement { $xfer += $input->skip($ftype); } break; + case 12: + if ($ftype == TType::I32) { + $xfer += $input->readI32($this->heartbeatCount); + } else { + $xfer += $input->skip($ftype); + } + break; default: $xfer += $input->skip($ftype); break; @@ -11821,6 +11862,11 @@ class ShowLocksResponseElement { $xfer += $output->writeString($this->hostname); $xfer += $output->writeFieldEnd(); } + if ($this->heartbeatCount !== null) { + $xfer += $output->writeFieldBegin('heartbeatCount', TType::I32, 12); + $xfer += $output->writeI32($this->heartbeatCount); + $xfer += $output->writeFieldEnd(); + } $xfer += $output->writeFieldStop(); $xfer += $output->writeStructEnd(); return $xfer; diff --git metastore/src/gen/thrift/gen-py/hive_metastore/ttypes.py metastore/src/gen/thrift/gen-py/hive_metastore/ttypes.py index 4d33939..cc7c675 100644 --- metastore/src/gen/thrift/gen-py/hive_metastore/ttypes.py +++ metastore/src/gen/thrift/gen-py/hive_metastore/ttypes.py @@ -6918,6 +6918,7 @@ class TxnInfo: - user - hostname - agentInfo + - heartbeatCount """ thrift_spec = ( @@ -6927,14 +6928,16 @@ class TxnInfo: (3, TType.STRING, 'user', None, None, ), # 3 (4, TType.STRING, 'hostname', None, None, ), # 4 (5, TType.STRING, 'agentInfo', None, "Unknown", ), # 5 + (6, TType.I32, 'heartbeatCount', None, 0, ), # 6 ) - def __init__(self, id=None, state=None, user=None, hostname=None, agentInfo=thrift_spec[5][4],): + def __init__(self, id=None, state=None, user=None, hostname=None, agentInfo=thrift_spec[5][4], heartbeatCount=thrift_spec[6][4],): self.id = id self.state = state self.user = user self.hostname = hostname self.agentInfo = agentInfo + self.heartbeatCount = heartbeatCount def read(self, iprot): if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None: @@ -6970,6 +6973,11 @@ def read(self, iprot): self.agentInfo = iprot.readString() else: iprot.skip(ftype) + elif fid == 6: + if ftype == TType.I32: + self.heartbeatCount = iprot.readI32() + else: + iprot.skip(ftype) else: iprot.skip(ftype) iprot.readFieldEnd() @@ -7000,6 +7008,10 @@ def write(self, oprot): oprot.writeFieldBegin('agentInfo', TType.STRING, 5) oprot.writeString(self.agentInfo) oprot.writeFieldEnd() + if self.heartbeatCount is not None: + oprot.writeFieldBegin('heartbeatCount', TType.I32, 6) + oprot.writeI32(self.heartbeatCount) + oprot.writeFieldEnd() oprot.writeFieldStop() oprot.writeStructEnd() @@ -7022,6 +7034,7 @@ def __hash__(self): value = (value * 31) ^ hash(self.user) value = (value * 31) ^ hash(self.hostname) value = (value * 31) ^ hash(self.agentInfo) + value = (value * 31) ^ hash(self.heartbeatCount) return value def __repr__(self): @@ -8053,6 +8066,7 @@ class ShowLocksResponseElement: - acquiredat - user - hostname + - heartbeatCount """ thrift_spec = ( @@ -8068,9 +8082,10 @@ class ShowLocksResponseElement: (9, TType.I64, 'acquiredat', None, None, ), # 9 (10, TType.STRING, 'user', None, None, ), # 10 (11, TType.STRING, 'hostname', None, None, ), # 11 + (12, TType.I32, 'heartbeatCount', None, 0, ), # 12 ) - def __init__(self, lockid=None, dbname=None, tablename=None, partname=None, state=None, type=None, txnid=None, lastheartbeat=None, acquiredat=None, user=None, hostname=None,): + def __init__(self, lockid=None, dbname=None, tablename=None, partname=None, state=None, type=None, txnid=None, lastheartbeat=None, acquiredat=None, user=None, hostname=None, heartbeatCount=thrift_spec[12][4],): self.lockid = lockid self.dbname = dbname self.tablename = tablename @@ -8082,6 +8097,7 @@ def __init__(self, lockid=None, dbname=None, tablename=None, partname=None, stat self.acquiredat = acquiredat self.user = user self.hostname = hostname + self.heartbeatCount = heartbeatCount def read(self, iprot): if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None: @@ -8147,6 +8163,11 @@ def read(self, iprot): self.hostname = iprot.readString() else: iprot.skip(ftype) + elif fid == 12: + if ftype == TType.I32: + self.heartbeatCount = iprot.readI32() + else: + iprot.skip(ftype) else: iprot.skip(ftype) iprot.readFieldEnd() @@ -8201,6 +8222,10 @@ def write(self, oprot): oprot.writeFieldBegin('hostname', TType.STRING, 11) oprot.writeString(self.hostname) oprot.writeFieldEnd() + if self.heartbeatCount is not None: + oprot.writeFieldBegin('heartbeatCount', TType.I32, 12) + oprot.writeI32(self.heartbeatCount) + oprot.writeFieldEnd() oprot.writeFieldStop() oprot.writeStructEnd() @@ -8235,6 +8260,7 @@ def __hash__(self): value = (value * 31) ^ hash(self.acquiredat) value = (value * 31) ^ hash(self.user) value = (value * 31) ^ hash(self.hostname) + value = (value * 31) ^ hash(self.heartbeatCount) return value def __repr__(self): diff --git metastore/src/gen/thrift/gen-rb/hive_metastore_types.rb metastore/src/gen/thrift/gen-rb/hive_metastore_types.rb index 8b02e78..d55d77c 100644 --- metastore/src/gen/thrift/gen-rb/hive_metastore_types.rb +++ metastore/src/gen/thrift/gen-rb/hive_metastore_types.rb @@ -1559,13 +1559,15 @@ class TxnInfo USER = 3 HOSTNAME = 4 AGENTINFO = 5 + HEARTBEATCOUNT = 6 FIELDS = { ID => {:type => ::Thrift::Types::I64, :name => 'id'}, STATE => {:type => ::Thrift::Types::I32, :name => 'state', :enum_class => ::TxnState}, USER => {:type => ::Thrift::Types::STRING, :name => 'user'}, HOSTNAME => {:type => ::Thrift::Types::STRING, :name => 'hostname'}, - AGENTINFO => {:type => ::Thrift::Types::STRING, :name => 'agentInfo', :default => %q"Unknown", :optional => true} + AGENTINFO => {:type => ::Thrift::Types::STRING, :name => 'agentInfo', :default => %q"Unknown", :optional => true}, + HEARTBEATCOUNT => {:type => ::Thrift::Types::I32, :name => 'heartbeatCount', :default => 0, :optional => true} } def struct_fields; FIELDS; end @@ -1842,6 +1844,7 @@ class ShowLocksResponseElement ACQUIREDAT = 9 USER = 10 HOSTNAME = 11 + HEARTBEATCOUNT = 12 FIELDS = { LOCKID => {:type => ::Thrift::Types::I64, :name => 'lockid'}, @@ -1854,7 +1857,8 @@ class ShowLocksResponseElement LASTHEARTBEAT => {:type => ::Thrift::Types::I64, :name => 'lastheartbeat'}, ACQUIREDAT => {:type => ::Thrift::Types::I64, :name => 'acquiredat', :optional => true}, USER => {:type => ::Thrift::Types::STRING, :name => 'user'}, - HOSTNAME => {:type => ::Thrift::Types::STRING, :name => 'hostname'} + HOSTNAME => {:type => ::Thrift::Types::STRING, :name => 'hostname'}, + HEARTBEATCOUNT => {:type => ::Thrift::Types::I32, :name => 'heartbeatCount', :default => 0, :optional => true} } def struct_fields; FIELDS; end