You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hive.apache.org by ga...@apache.org on 2016/01/15 02:18:11 UTC

[22/22] hive git commit: HIVE-12832 Thrift and RDBMS schema changes for ACID fixes, branch-1 version.

HIVE-12832 Thrift and RDBMS schema changes for ACID fixes, branch-1 version.


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

Branch: refs/heads/branch-1
Commit: 92072ad2412c97e8db97e55d448b4073ceb621be
Parents: 67be677
Author: Alan Gates <ga...@hortonworks.com>
Authored: Thu Jan 14 17:15:40 2016 -0800
Committer: Alan Gates <ga...@hortonworks.com>
Committed: Thu Jan 14 17:15:40 2016 -0800

----------------------------------------------------------------------
 .../org/apache/hive/beeline/HiveSchemaTool.java |    42 +-
 metastore/if/hive_metastore.thrift              |    20 +
 .../upgrade/derby/023-HIVE-12807.derby.sql      |     1 +
 .../upgrade/derby/024-HIVE-12814.derby.sql      |     1 +
 .../upgrade/derby/025-HIVE-12816.derby.sql      |     1 +
 .../upgrade/derby/026-HIVE-12818.derby.sql      |    15 +
 .../upgrade/derby/027-HIVE-12819.derby.sql      |     1 +
 .../upgrade/derby/028-HIVE-12821.derby.sql      |     2 +
 .../upgrade/derby/029-HIVE-12822.derby.sql      |     1 +
 .../upgrade/derby/030-HIVE-12823.derby.sql      |     1 +
 .../upgrade/derby/031-HIVE-12831.derby.sql      |     2 +
 .../upgrade/derby/032-HIVE-12832.derby.sql      |     7 +
 .../upgrade/derby/hive-schema-1.3.0.derby.sql   |     2 +-
 .../derby/hive-txn-schema-1.3.0.derby.sql       |   119 +
 .../derby/upgrade-1.2.0-to-1.3.0.derby.sql      |    10 +
 .../upgrade/mssql/008-HIVE-12807.mssql.sql      |     1 +
 .../upgrade/mssql/009-HIVE-12814.mssql.sql      |     1 +
 .../upgrade/mssql/010-HIVE-12816.mssql.sql      |     1 +
 .../upgrade/mssql/011-HIVE-12818.mssql.sql      |    21 +
 .../upgrade/mssql/012-HIVE-12819.mssql.sql      |     1 +
 .../upgrade/mssql/013-HIVE-12821.mssql.sql      |     2 +
 .../upgrade/mssql/014-HIVE-12822.mssql.sql      |     1 +
 .../upgrade/mssql/015-HIVE-12823.mssql.sql      |     1 +
 .../upgrade/mssql/016-HIVE-12831.mssql.sql      |     2 +
 .../upgrade/mssql/017-HIVE-12832.mssql.sql      |    10 +
 .../upgrade/mssql/hive-schema-1.3.0.mssql.sql   |    40 +
 .../mssql/upgrade-1.2.0-to-1.3.0.mssql.sql      |    10 +
 .../upgrade/mysql/023-HIVE-12807.mysql.sql      |     1 +
 .../upgrade/mysql/024-HIVE-12814.mysql.sql      |     1 +
 .../upgrade/mysql/025-HIVE-12816.mysql.sql      |     1 +
 .../upgrade/mysql/026-HIVE-12818.mysql.sql      |    17 +
 .../upgrade/mysql/027-HIVE-12819.mysql.sql      |     1 +
 .../upgrade/mysql/028-HIVE-12821.mysql.sql      |     2 +
 .../upgrade/mysql/029-HIVE-12822.mysql.sql      |     1 +
 .../upgrade/mysql/030-HIVE-12823.mysql.sql      |     1 +
 .../upgrade/mysql/031-HIVE-12831.mysql.sql      |     2 +
 .../upgrade/mysql/032-HIVE-12832.mysql.sql      |     7 +
 .../upgrade/mysql/hive-schema-1.3.0.mysql.sql   |     2 +-
 .../mysql/hive-txn-schema-1.3.0.mysql.sql       |   122 +
 .../mysql/upgrade-1.2.0-to-1.3.0.mysql.sql      |    12 +
 .../upgrade/oracle/023-HIVE-12807.oracle.sql    |     1 +
 .../upgrade/oracle/024-HIVE-12814.oracle.sql    |     1 +
 .../upgrade/oracle/025-HIVE-12816.oracle.sql    |     1 +
 .../upgrade/oracle/026-HIVE-12818.oracle.sql    |    17 +
 .../upgrade/oracle/027-HIVE-12819.oracle.sql    |     1 +
 .../upgrade/oracle/028-HIVE-12821.oracle.sql    |     2 +
 .../upgrade/oracle/029-HIVE-12822.oracle.sql    |     1 +
 .../upgrade/oracle/030-HIVE-12823.oracle.sql    |     1 +
 .../upgrade/oracle/031-HIVE-12381.oracle.sql    |     2 +
 .../upgrade/oracle/032-HIVE-12832.oracle.sql    |     7 +
 .../upgrade/oracle/hive-schema-1.3.0.oracle.sql |     2 +-
 .../oracle/hive-txn-schema-1.3.0.oracle.sql     |   120 +
 .../oracle/upgrade-1.2.0-to-1.3.0.oracle.sql    |    11 +
 .../postgres/022-HIVE-12807.postgres.sql        |     1 +
 .../postgres/023-HIVE-12814.postgres.sql        |     1 +
 .../postgres/024-HIVE-12816.postgres.sql        |     1 +
 .../postgres/025-HIVE-12818.postgres.sql        |    17 +
 .../postgres/026-HIVE-12819.postgres.sql        |     1 +
 .../postgres/027-HIVE-12821.postgres.sql        |     2 +
 .../postgres/028-HIVE-12822.postgres.sql        |     1 +
 .../postgres/029-HIVE-12823.postgres.sql        |     1 +
 .../postgres/030-HIVE-12831.postgres.sql        |     2 +
 .../postgres/031-HIVE-12832.postgres.sql        |     7 +
 .../postgres/hive-schema-1.3.0.postgres.sql     |     2 +-
 .../postgres/hive-txn-schema-1.3.0.postgres.sql |   121 +
 .../upgrade-1.2.0-to-1.3.0.postgres.sql         |    10 +
 .../gen/thrift/gen-cpp/ThriftHiveMetastore.cpp  | 12615 ++++++++++++++++-
 .../gen/thrift/gen-cpp/ThriftHiveMetastore.h    |  2403 +---
 .../thrift/gen-cpp/hive_metastore_constants.cpp |     2 +-
 .../thrift/gen-cpp/hive_metastore_constants.h   |     2 +-
 .../gen/thrift/gen-cpp/hive_metastore_types.cpp |  2580 ++--
 .../gen/thrift/gen-cpp/hive_metastore_types.h   |  1435 +-
 .../hive/metastore/api/AbortTxnRequest.java     |     6 +-
 .../metastore/api/AddDynamicPartitions.java     |     6 +-
 .../metastore/api/AddPartitionsRequest.java     |     8 +-
 .../hive/metastore/api/AddPartitionsResult.java |     4 +-
 .../hadoop/hive/metastore/api/AggrStats.java    |     6 +-
 .../metastore/api/AlreadyExistsException.java   |     4 +-
 .../metastore/api/BinaryColumnStatsData.java    |    10 +-
 .../metastore/api/BooleanColumnStatsData.java   |    10 +-
 .../hive/metastore/api/CheckLockRequest.java    |   210 +-
 .../hive/metastore/api/ColumnStatistics.java    |     4 +-
 .../metastore/api/ColumnStatisticsData.java     |     2 +-
 .../metastore/api/ColumnStatisticsDesc.java     |     8 +-
 .../hive/metastore/api/ColumnStatisticsObj.java |     4 +-
 .../hive/metastore/api/CommitTxnRequest.java    |     6 +-
 .../hive/metastore/api/CompactionRequest.java   |     4 +-
 .../hive/metastore/api/CompactionType.java      |     2 +-
 .../api/ConfigValSecurityException.java         |     4 +-
 .../api/CurrentNotificationEventId.java         |     6 +-
 .../hadoop/hive/metastore/api/Database.java     |     4 +-
 .../apache/hadoop/hive/metastore/api/Date.java  |     6 +-
 .../hive/metastore/api/DateColumnStatsData.java |     8 +-
 .../hadoop/hive/metastore/api/Decimal.java      |     6 +-
 .../metastore/api/DecimalColumnStatsData.java   |     8 +-
 .../metastore/api/DoubleColumnStatsData.java    |    12 +-
 .../hive/metastore/api/DropPartitionsExpr.java  |     6 +-
 .../metastore/api/DropPartitionsRequest.java    |    12 +-
 .../metastore/api/DropPartitionsResult.java     |     4 +-
 .../hive/metastore/api/EnvironmentContext.java  |     4 +-
 .../hive/metastore/api/EventRequestType.java    |     2 +-
 .../hadoop/hive/metastore/api/FieldSchema.java  |     4 +-
 .../hive/metastore/api/FireEventRequest.java    |     6 +-
 .../metastore/api/FireEventRequestData.java     |     2 +-
 .../hive/metastore/api/FireEventResponse.java   |     4 +-
 .../hadoop/hive/metastore/api/Function.java     |     6 +-
 .../hadoop/hive/metastore/api/FunctionType.java |     2 +-
 .../metastore/api/GetAllFunctionsResponse.java  |     4 +-
 .../metastore/api/GetOpenTxnsInfoResponse.java  |     6 +-
 .../hive/metastore/api/GetOpenTxnsResponse.java |     6 +-
 .../api/GetPrincipalsInRoleRequest.java         |     4 +-
 .../api/GetPrincipalsInRoleResponse.java        |     4 +-
 .../api/GetRoleGrantsForPrincipalRequest.java   |     4 +-
 .../api/GetRoleGrantsForPrincipalResponse.java  |     4 +-
 .../api/GrantRevokePrivilegeRequest.java        |     6 +-
 .../api/GrantRevokePrivilegeResponse.java       |     6 +-
 .../metastore/api/GrantRevokeRoleRequest.java   |     6 +-
 .../metastore/api/GrantRevokeRoleResponse.java  |     6 +-
 .../hive/metastore/api/GrantRevokeType.java     |     2 +-
 .../hive/metastore/api/HeartbeatRequest.java    |     8 +-
 .../metastore/api/HeartbeatTxnRangeRequest.java |     8 +-
 .../api/HeartbeatTxnRangeResponse.java          |     4 +-
 .../hive/metastore/api/HiveObjectPrivilege.java |     4 +-
 .../hive/metastore/api/HiveObjectRef.java       |     4 +-
 .../hive/metastore/api/HiveObjectType.java      |     2 +-
 .../apache/hadoop/hive/metastore/api/Index.java |    10 +-
 .../api/IndexAlreadyExistsException.java        |     4 +-
 .../metastore/api/InsertEventRequestData.java   |     4 +-
 .../metastore/api/InvalidInputException.java    |     4 +-
 .../metastore/api/InvalidObjectException.java   |     4 +-
 .../api/InvalidOperationException.java          |     4 +-
 .../api/InvalidPartitionException.java          |     4 +-
 .../hive/metastore/api/LockComponent.java       |     4 +-
 .../hadoop/hive/metastore/api/LockLevel.java    |     2 +-
 .../hadoop/hive/metastore/api/LockRequest.java  |   123 +-
 .../hadoop/hive/metastore/api/LockResponse.java |     6 +-
 .../hadoop/hive/metastore/api/LockState.java    |     2 +-
 .../hadoop/hive/metastore/api/LockType.java     |     2 +-
 .../hive/metastore/api/LongColumnStatsData.java |    12 +-
 .../hive/metastore/api/MetaException.java       |     4 +-
 .../hive/metastore/api/NoSuchLockException.java |     4 +-
 .../metastore/api/NoSuchObjectException.java    |     4 +-
 .../hive/metastore/api/NoSuchTxnException.java  |     4 +-
 .../hive/metastore/api/NotificationEvent.java   |     8 +-
 .../metastore/api/NotificationEventRequest.java |     8 +-
 .../api/NotificationEventResponse.java          |     4 +-
 .../hive/metastore/api/OpenTxnRequest.java      |   121 +-
 .../hive/metastore/api/OpenTxnsResponse.java    |     4 +-
 .../apache/hadoop/hive/metastore/api/Order.java |     6 +-
 .../hadoop/hive/metastore/api/Partition.java    |     8 +-
 .../hive/metastore/api/PartitionEventType.java  |     2 +-
 .../api/PartitionListComposingSpec.java         |     4 +-
 .../hive/metastore/api/PartitionSpec.java       |     4 +-
 .../api/PartitionSpecWithSharedSD.java          |     4 +-
 .../hive/metastore/api/PartitionWithoutSD.java  |     8 +-
 .../metastore/api/PartitionsByExprRequest.java  |     6 +-
 .../metastore/api/PartitionsByExprResult.java   |     6 +-
 .../metastore/api/PartitionsStatsRequest.java   |     4 +-
 .../metastore/api/PartitionsStatsResult.java    |     4 +-
 .../metastore/api/PrincipalPrivilegeSet.java    |     4 +-
 .../hive/metastore/api/PrincipalType.java       |     2 +-
 .../hadoop/hive/metastore/api/PrivilegeBag.java |     4 +-
 .../hive/metastore/api/PrivilegeGrantInfo.java  |     8 +-
 .../hive/metastore/api/RequestPartsSpec.java    |     2 +-
 .../hadoop/hive/metastore/api/ResourceType.java |     2 +-
 .../hadoop/hive/metastore/api/ResourceUri.java  |     4 +-
 .../apache/hadoop/hive/metastore/api/Role.java  |     6 +-
 .../hive/metastore/api/RolePrincipalGrant.java  |     8 +-
 .../hadoop/hive/metastore/api/Schema.java       |     4 +-
 .../hadoop/hive/metastore/api/SerDeInfo.java    |     4 +-
 .../api/SetPartitionsStatsRequest.java          |     4 +-
 .../hive/metastore/api/ShowCompactRequest.java  |     4 +-
 .../hive/metastore/api/ShowCompactResponse.java |     4 +-
 .../api/ShowCompactResponseElement.java         |   427 +-
 .../hive/metastore/api/ShowLocksRequest.java    |   433 +-
 .../hive/metastore/api/ShowLocksResponse.java   |     4 +-
 .../metastore/api/ShowLocksResponseElement.java |   524 +-
 .../hadoop/hive/metastore/api/SkewedInfo.java   |     4 +-
 .../hive/metastore/api/StorageDescriptor.java   |    10 +-
 .../metastore/api/StringColumnStatsData.java    |    12 +-
 .../apache/hadoop/hive/metastore/api/Table.java |    12 +-
 .../hive/metastore/api/TableStatsRequest.java   |     4 +-
 .../hive/metastore/api/TableStatsResult.java    |     4 +-
 .../hive/metastore/api/ThriftHiveMetastore.java |    98 +-
 .../hive/metastore/api/TxnAbortedException.java |     4 +-
 .../hadoop/hive/metastore/api/TxnInfo.java      |   328 +-
 .../hive/metastore/api/TxnOpenException.java    |     4 +-
 .../hadoop/hive/metastore/api/TxnState.java     |     2 +-
 .../apache/hadoop/hive/metastore/api/Type.java  |     4 +-
 .../hive/metastore/api/UnknownDBException.java  |     4 +-
 .../api/UnknownPartitionException.java          |     4 +-
 .../metastore/api/UnknownTableException.java    |     4 +-
 .../hive/metastore/api/UnlockRequest.java       |     6 +-
 .../hadoop/hive/metastore/api/Version.java      |     4 +-
 .../metastore/api/hive_metastoreConstants.java  |     2 +-
 .../gen-php/metastore/ThriftHiveMetastore.php   |     2 +-
 .../src/gen/thrift/gen-php/metastore/Types.php  |   466 +-
 .../hive_metastore/ThriftHiveMetastore-remote   |    16 +-
 .../hive_metastore/ThriftHiveMetastore.py       |  2619 +++-
 .../thrift/gen-py/hive_metastore/constants.py   |     2 +-
 .../gen/thrift/gen-py/hive_metastore/ttypes.py  |   826 +-
 .../thrift/gen-rb/hive_metastore_constants.rb   |     2 +-
 .../gen/thrift/gen-rb/hive_metastore_types.rb   |    55 +-
 .../gen/thrift/gen-rb/thrift_hive_metastore.rb  |     2 +-
 pom.xml                                         |     4 +-
 .../gen/thrift/gen-cpp/queryplan_constants.cpp  |     2 +-
 ql/src/gen/thrift/gen-cpp/queryplan_constants.h |     2 +-
 ql/src/gen/thrift/gen-cpp/queryplan_types.cpp   |   162 +-
 ql/src/gen/thrift/gen-cpp/queryplan_types.h     |    79 +-
 .../hadoop/hive/ql/plan/api/Adjacency.java      |     4 +-
 .../hadoop/hive/ql/plan/api/AdjacencyType.java  |     2 +-
 .../apache/hadoop/hive/ql/plan/api/Graph.java   |     4 +-
 .../hadoop/hive/ql/plan/api/NodeType.java       |     2 +-
 .../hadoop/hive/ql/plan/api/Operator.java       |     8 +-
 .../hadoop/hive/ql/plan/api/OperatorType.java   |     2 +-
 .../apache/hadoop/hive/ql/plan/api/Query.java   |     8 +-
 .../hadoop/hive/ql/plan/api/QueryPlan.java      |     8 +-
 .../apache/hadoop/hive/ql/plan/api/Stage.java   |     8 +-
 .../hadoop/hive/ql/plan/api/StageType.java      |     2 +-
 .../apache/hadoop/hive/ql/plan/api/Task.java    |     8 +-
 .../hadoop/hive/ql/plan/api/TaskType.java       |     2 +-
 ql/src/gen/thrift/gen-php/Types.php             |     4 +-
 ql/src/gen/thrift/gen-py/queryplan/constants.py |     2 +-
 ql/src/gen/thrift/gen-py/queryplan/ttypes.py    |    80 +-
 ql/src/gen/thrift/gen-rb/queryplan_constants.rb |     2 +-
 ql/src/gen/thrift/gen-rb/queryplan_types.rb     |     2 +-
 .../gen/thrift/gen-cpp/complex_constants.cpp    |     2 +-
 .../src/gen/thrift/gen-cpp/complex_constants.h  |     2 +-
 serde/src/gen/thrift/gen-cpp/complex_types.cpp  |    94 +-
 serde/src/gen/thrift/gen-cpp/complex_types.h    |    46 +-
 .../gen/thrift/gen-cpp/megastruct_constants.cpp |     2 +-
 .../gen/thrift/gen-cpp/megastruct_constants.h   |     2 +-
 .../src/gen/thrift/gen-cpp/megastruct_types.cpp |    70 +-
 serde/src/gen/thrift/gen-cpp/megastruct_types.h |    24 +-
 .../src/gen/thrift/gen-cpp/serde_constants.cpp  |     2 +-
 serde/src/gen/thrift/gen-cpp/serde_constants.h  |     2 +-
 serde/src/gen/thrift/gen-cpp/serde_types.cpp    |     2 +-
 serde/src/gen/thrift/gen-cpp/serde_types.h      |     2 +-
 .../gen/thrift/gen-cpp/testthrift_constants.cpp |     2 +-
 .../gen/thrift/gen-cpp/testthrift_constants.h   |     2 +-
 .../src/gen/thrift/gen-cpp/testthrift_types.cpp |    34 +-
 serde/src/gen/thrift/gen-cpp/testthrift_types.h |    24 +-
 .../hadoop/hive/serde/serdeConstants.java       |     2 +-
 .../hadoop/hive/serde/test/InnerStruct.java     |     6 +-
 .../hadoop/hive/serde/test/ThriftTestObj.java   |     6 +-
 .../hadoop/hive/serde2/thrift/test/Complex.java |     6 +-
 .../hive/serde2/thrift/test/IntString.java      |     8 +-
 .../hive/serde2/thrift/test/MegaStruct.java     |    16 +-
 .../hive/serde2/thrift/test/MiniStruct.java     |     4 +-
 .../hadoop/hive/serde2/thrift/test/MyEnum.java  |     2 +-
 .../hive/serde2/thrift/test/PropValueUnion.java |     2 +-
 .../hive/serde2/thrift/test/SetIntString.java   |     4 +-
 serde/src/gen/thrift/gen-php/Types.php          |     4 +-
 .../org/apache/hadoop/hive/serde/Types.php      |     2 +-
 .../src/gen/thrift/gen-py/complex/constants.py  |     2 +-
 serde/src/gen/thrift/gen-py/complex/ttypes.py   |    44 +-
 .../gen/thrift/gen-py/megastruct/constants.py   |     2 +-
 .../src/gen/thrift/gen-py/megastruct/ttypes.py  |    50 +-
 .../org_apache_hadoop_hive_serde/constants.py   |     2 +-
 .../org_apache_hadoop_hive_serde/ttypes.py      |     2 +-
 .../gen/thrift/gen-py/testthrift/constants.py   |     2 +-
 .../src/gen/thrift/gen-py/testthrift/ttypes.py  |     8 +-
 .../src/gen/thrift/gen-rb/complex_constants.rb  |     2 +-
 serde/src/gen/thrift/gen-rb/complex_types.rb    |     2 +-
 .../gen/thrift/gen-rb/megastruct_constants.rb   |     2 +-
 serde/src/gen/thrift/gen-rb/megastruct_types.rb |     2 +-
 serde/src/gen/thrift/gen-rb/serde_constants.rb  |     2 +-
 serde/src/gen/thrift/gen-rb/serde_types.rb      |     2 +-
 .../gen/thrift/gen-rb/testthrift_constants.rb   |     2 +-
 serde/src/gen/thrift/gen-rb/testthrift_types.rb |     2 +-
 service/src/gen/thrift/gen-cpp/TCLIService.cpp  |  1770 ++-
 service/src/gen/thrift/gen-cpp/TCLIService.h    |   409 +-
 .../thrift/gen-cpp/TCLIService_constants.cpp    |     2 +-
 .../gen/thrift/gen-cpp/TCLIService_constants.h  |     2 +-
 .../gen/thrift/gen-cpp/TCLIService_types.cpp    |  1226 +-
 .../src/gen/thrift/gen-cpp/TCLIService_types.h  |   816 +-
 service/src/gen/thrift/gen-cpp/ThriftHive.cpp   |   853 +-
 service/src/gen/thrift/gen-cpp/ThriftHive.h     |   199 +-
 .../thrift/gen-cpp/hive_service_constants.cpp   |     2 +-
 .../gen/thrift/gen-cpp/hive_service_constants.h |     2 +-
 .../gen/thrift/gen-cpp/hive_service_types.cpp   |    55 +-
 .../src/gen/thrift/gen-cpp/hive_service_types.h |    26 +-
 .../hadoop/hive/service/HiveClusterStatus.java  |    14 +-
 .../hive/service/HiveServerException.java       |     6 +-
 .../hadoop/hive/service/JobTrackerState.java    |     2 +-
 .../apache/hadoop/hive/service/ThriftHive.java  |     6 +-
 .../service/cli/thrift/TArrayTypeEntry.java     |     6 +-
 .../hive/service/cli/thrift/TBinaryColumn.java  |     6 +-
 .../hive/service/cli/thrift/TBoolColumn.java    |     4 +-
 .../hive/service/cli/thrift/TBoolValue.java     |     6 +-
 .../hive/service/cli/thrift/TByteColumn.java    |     4 +-
 .../hive/service/cli/thrift/TByteValue.java     |     6 +-
 .../hive/service/cli/thrift/TCLIService.java    |     4 +-
 .../cli/thrift/TCLIServiceConstants.java        |     2 +-
 .../cli/thrift/TCancelDelegationTokenReq.java   |     4 +-
 .../cli/thrift/TCancelDelegationTokenResp.java  |     4 +-
 .../service/cli/thrift/TCancelOperationReq.java |     4 +-
 .../cli/thrift/TCancelOperationResp.java        |     4 +-
 .../service/cli/thrift/TCloseOperationReq.java  |     4 +-
 .../service/cli/thrift/TCloseOperationResp.java |     4 +-
 .../service/cli/thrift/TCloseSessionReq.java    |     4 +-
 .../service/cli/thrift/TCloseSessionResp.java   |     4 +-
 .../apache/hive/service/cli/thrift/TColumn.java |     2 +-
 .../hive/service/cli/thrift/TColumnDesc.java    |     6 +-
 .../hive/service/cli/thrift/TColumnValue.java   |     2 +-
 .../hive/service/cli/thrift/TDoubleColumn.java  |     4 +-
 .../hive/service/cli/thrift/TDoubleValue.java   |     6 +-
 .../cli/thrift/TExecuteStatementReq.java        |     6 +-
 .../cli/thrift/TExecuteStatementResp.java       |     4 +-
 .../service/cli/thrift/TFetchOrientation.java   |     2 +-
 .../service/cli/thrift/TFetchResultsReq.java    |     8 +-
 .../service/cli/thrift/TFetchResultsResp.java   |     6 +-
 .../service/cli/thrift/TGetCatalogsReq.java     |     4 +-
 .../service/cli/thrift/TGetCatalogsResp.java    |     4 +-
 .../hive/service/cli/thrift/TGetColumnsReq.java |     4 +-
 .../service/cli/thrift/TGetColumnsResp.java     |     4 +-
 .../cli/thrift/TGetDelegationTokenReq.java      |     4 +-
 .../cli/thrift/TGetDelegationTokenResp.java     |     4 +-
 .../service/cli/thrift/TGetFunctionsReq.java    |     4 +-
 .../service/cli/thrift/TGetFunctionsResp.java   |     4 +-
 .../hive/service/cli/thrift/TGetInfoReq.java    |     4 +-
 .../hive/service/cli/thrift/TGetInfoResp.java   |     4 +-
 .../hive/service/cli/thrift/TGetInfoType.java   |     2 +-
 .../hive/service/cli/thrift/TGetInfoValue.java  |     2 +-
 .../cli/thrift/TGetOperationStatusReq.java      |     4 +-
 .../cli/thrift/TGetOperationStatusResp.java     |     6 +-
 .../cli/thrift/TGetResultSetMetadataReq.java    |     4 +-
 .../cli/thrift/TGetResultSetMetadataResp.java   |     4 +-
 .../hive/service/cli/thrift/TGetSchemasReq.java |     4 +-
 .../service/cli/thrift/TGetSchemasResp.java     |     4 +-
 .../service/cli/thrift/TGetTableTypesReq.java   |     4 +-
 .../service/cli/thrift/TGetTableTypesResp.java  |     4 +-
 .../hive/service/cli/thrift/TGetTablesReq.java  |     4 +-
 .../hive/service/cli/thrift/TGetTablesResp.java |     4 +-
 .../service/cli/thrift/TGetTypeInfoReq.java     |     4 +-
 .../service/cli/thrift/TGetTypeInfoResp.java    |     4 +-
 .../service/cli/thrift/THandleIdentifier.java   |     4 +-
 .../hive/service/cli/thrift/TI16Column.java     |     4 +-
 .../hive/service/cli/thrift/TI16Value.java      |     6 +-
 .../hive/service/cli/thrift/TI32Column.java     |     4 +-
 .../hive/service/cli/thrift/TI32Value.java      |     6 +-
 .../hive/service/cli/thrift/TI64Column.java     |     4 +-
 .../hive/service/cli/thrift/TI64Value.java      |     6 +-
 .../hive/service/cli/thrift/TMapTypeEntry.java  |     8 +-
 .../service/cli/thrift/TOpenSessionReq.java     |     4 +-
 .../service/cli/thrift/TOpenSessionResp.java    |     4 +-
 .../service/cli/thrift/TOperationHandle.java    |     8 +-
 .../service/cli/thrift/TOperationState.java     |     2 +-
 .../hive/service/cli/thrift/TOperationType.java |     2 +-
 .../service/cli/thrift/TPrimitiveTypeEntry.java |     4 +-
 .../service/cli/thrift/TProtocolVersion.java    |     2 +-
 .../cli/thrift/TRenewDelegationTokenReq.java    |     4 +-
 .../cli/thrift/TRenewDelegationTokenResp.java   |     4 +-
 .../apache/hive/service/cli/thrift/TRow.java    |     4 +-
 .../apache/hive/service/cli/thrift/TRowSet.java |     6 +-
 .../hive/service/cli/thrift/TSessionHandle.java |     4 +-
 .../apache/hive/service/cli/thrift/TStatus.java |     6 +-
 .../hive/service/cli/thrift/TStatusCode.java    |     2 +-
 .../hive/service/cli/thrift/TStringColumn.java  |     4 +-
 .../hive/service/cli/thrift/TStringValue.java   |     4 +-
 .../service/cli/thrift/TStructTypeEntry.java    |     4 +-
 .../hive/service/cli/thrift/TTableSchema.java   |     4 +-
 .../hive/service/cli/thrift/TTypeDesc.java      |     4 +-
 .../hive/service/cli/thrift/TTypeEntry.java     |     2 +-
 .../apache/hive/service/cli/thrift/TTypeId.java |     2 +-
 .../service/cli/thrift/TTypeQualifierValue.java |     2 +-
 .../service/cli/thrift/TTypeQualifiers.java     |     4 +-
 .../service/cli/thrift/TUnionTypeEntry.java     |     4 +-
 .../cli/thrift/TUserDefinedTypeEntry.java       |     4 +-
 service/src/gen/thrift/gen-php/TCLIService.php  |     3 +-
 service/src/gen/thrift/gen-php/ThriftHive.php   |     3 +-
 service/src/gen/thrift/gen-php/Types.php        |     4 +-
 .../gen-py/TCLIService/TCLIService-remote       |     2 +-
 .../thrift/gen-py/TCLIService/TCLIService.py    |   269 +-
 .../gen/thrift/gen-py/TCLIService/constants.py  |     2 +-
 .../src/gen/thrift/gen-py/TCLIService/ttypes.py |   190 +-
 .../gen-py/hive_service/ThriftHive-remote       |    23 +-
 .../thrift/gen-py/hive_service/ThriftHive.py    |   135 +-
 .../gen/thrift/gen-py/hive_service/constants.py |     2 +-
 .../gen/thrift/gen-py/hive_service/ttypes.py    |    20 +-
 .../gen/thrift/gen-rb/hive_service_constants.rb |     2 +-
 .../src/gen/thrift/gen-rb/hive_service_types.rb |     2 +-
 .../src/gen/thrift/gen-rb/t_c_l_i_service.rb    |     2 +-
 .../thrift/gen-rb/t_c_l_i_service_constants.rb  |     2 +-
 .../gen/thrift/gen-rb/t_c_l_i_service_types.rb  |     2 +-
 service/src/gen/thrift/gen-rb/thrift_hive.rb    |     2 +-
 386 files changed, 25883 insertions(+), 8112 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hive/blob/92072ad2/beeline/src/java/org/apache/hive/beeline/HiveSchemaTool.java
----------------------------------------------------------------------
diff --git a/beeline/src/java/org/apache/hive/beeline/HiveSchemaTool.java b/beeline/src/java/org/apache/hive/beeline/HiveSchemaTool.java
index 79ecad3..7bdb9b7 100644
--- a/beeline/src/java/org/apache/hive/beeline/HiveSchemaTool.java
+++ b/beeline/src/java/org/apache/hive/beeline/HiveSchemaTool.java
@@ -17,18 +17,6 @@
  */
 package org.apache.hive.beeline;
 
-import java.io.BufferedWriter;
-import java.io.File;
-import java.io.FileWriter;
-import java.io.IOException;
-import java.io.PrintStream;
-import java.sql.Connection;
-import java.sql.ResultSet;
-import java.sql.SQLException;
-import java.sql.Statement;
-import java.util.ArrayList;
-import java.util.List;
-
 import org.apache.commons.cli.CommandLine;
 import org.apache.commons.cli.CommandLineParser;
 import org.apache.commons.cli.GnuParser;
@@ -39,6 +27,7 @@ import org.apache.commons.cli.OptionGroup;
 import org.apache.commons.cli.Options;
 import org.apache.commons.cli.ParseException;
 import org.apache.commons.io.output.NullOutputStream;
+import org.apache.commons.lang.StringUtils;
 import org.apache.hadoop.hive.conf.HiveConf;
 import org.apache.hadoop.hive.conf.HiveConf.ConfVars;
 import org.apache.hadoop.hive.metastore.HiveMetaException;
@@ -46,6 +35,22 @@ import org.apache.hadoop.hive.metastore.MetaStoreSchemaInfo;
 import org.apache.hadoop.hive.metastore.api.MetaException;
 import org.apache.hadoop.hive.shims.ShimLoader;
 import org.apache.hive.beeline.HiveSchemaHelper.NestedScriptParser;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.io.BufferedReader;
+import java.io.BufferedWriter;
+import java.io.File;
+import java.io.FileReader;
+import java.io.FileWriter;
+import java.io.IOException;
+import java.io.PrintStream;
+import java.sql.Connection;
+import java.sql.ResultSet;
+import java.sql.SQLException;
+import java.sql.Statement;
+import java.util.ArrayList;
+import java.util.List;
 
 public class HiveSchemaTool {
   private String userName = null;
@@ -57,6 +62,8 @@ public class HiveSchemaTool {
   private final String dbType;
   private final MetaStoreSchemaInfo metaStoreSchemaInfo;
 
+  static final private Logger LOG = LoggerFactory.getLogger(HiveSchemaTool.class.getName());
+
   public HiveSchemaTool(String dbType) throws HiveMetaException {
     this(System.getenv("HIVE_HOME"), new HiveConf(HiveSchemaTool.class), dbType);
   }
@@ -349,6 +356,16 @@ public class HiveSchemaTool {
     argList.add("-f");
     argList.add(sqlScriptFile);
 
+    if (LOG.isDebugEnabled()) {
+      LOG.debug("Going to invoke file that contains:");
+      FileReader fr = new FileReader(sqlScriptFile);
+      BufferedReader reader = new BufferedReader(fr);
+      String line;
+      while ((line = reader.readLine()) != null) {
+        LOG.debug("script: " + line);
+      }
+    }
+
     // run the script using Beeline
     BeeLine beeLine = new BeeLine();
     if (!verbose) {
@@ -360,6 +377,7 @@ public class HiveSchemaTool {
     // We can be pretty sure that an entire line can be processed as a single command since
     // we always add a line separator at the end while calling dbCommandParser.buildCommand.
     beeLine.getOpts().setEntireLineAsCommand(true);
+    LOG.debug("Going to run command <" + StringUtils.join(argList, " ") + ">");
     int status = beeLine.begin(argList.toArray(new String[0]), null);
     if (status != 0) {
       throw new IOException("Schema script failed, errorcode " + status);

http://git-wip-us.apache.org/repos/asf/hive/blob/92072ad2/metastore/if/hive_metastore.thrift
----------------------------------------------------------------------
diff --git a/metastore/if/hive_metastore.thrift b/metastore/if/hive_metastore.thrift
index c58c3a8..f84b2a9 100755
--- a/metastore/if/hive_metastore.thrift
+++ b/metastore/if/hive_metastore.thrift
@@ -543,6 +543,9 @@ struct TxnInfo {
     2: required TxnState state,
     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,
+    7: optional string metaInfo,
 }
 
 struct GetOpenTxnsInfoResponse {
@@ -559,6 +562,7 @@ struct OpenTxnRequest {
     1: required i32 num_txns,
     2: required string user,
     3: required string hostname,
+    4: optional string agentInfo = "Unknown",
 }
 
 struct OpenTxnsResponse {
@@ -586,6 +590,7 @@ struct LockRequest {
     2: optional i64 txnid,
     3: required string user,     // used in 'show locks' to help admins find who has open locks
     4: required string hostname, // used in 'show locks' to help admins find who has open locks
+    5: optional string agentInfo = "Unknown",
 }
 
 struct LockResponse {
@@ -595,6 +600,8 @@ struct LockResponse {
 
 struct CheckLockRequest {
     1: required i64 lockid,
+    2: optional i64 txnid,
+    3: optional i64 elapsed_ms,
 }
 
 struct UnlockRequest {
@@ -602,6 +609,10 @@ struct UnlockRequest {
 }
 
 struct ShowLocksRequest {
+    1: optional string dbname,
+    2: optional string tablename,
+    3: optional string partname,
+    4: optional bool isExtended=false,
 }
 
 struct ShowLocksResponseElement {
@@ -616,6 +627,11 @@ struct ShowLocksResponseElement {
     9: optional i64 acquiredat,
     10: required string user,
     11: required string hostname,
+    12: optional i32 heartbeatCount = 0,
+    13: optional string agentInfo,
+    14: optional i64 blockedByExtId,
+    15: optional i64 blockedByIntId,
+    16: optional i64 lockIdInternal,
 }
 
 struct ShowLocksResponse {
@@ -657,6 +673,10 @@ struct ShowCompactResponseElement {
     6: optional string workerid,
     7: optional i64 start,
     8: optional string runAs,
+    9: optional i64 hightestTxnId, // Highest Txn ID handled by this compaction
+    10: optional string metaInfo,
+    11: optional i64 endTime,
+    12: optional string hadoopJobId = "None",
 }
 
 struct ShowCompactResponse {

http://git-wip-us.apache.org/repos/asf/hive/blob/92072ad2/metastore/scripts/upgrade/derby/023-HIVE-12807.derby.sql
----------------------------------------------------------------------
diff --git a/metastore/scripts/upgrade/derby/023-HIVE-12807.derby.sql b/metastore/scripts/upgrade/derby/023-HIVE-12807.derby.sql
new file mode 100644
index 0000000..3dfc6fe
--- /dev/null
+++ b/metastore/scripts/upgrade/derby/023-HIVE-12807.derby.sql
@@ -0,0 +1 @@
+ALTER TABLE "COMPACTION_QUEUE" ADD "CQ_HIGHEST_TXN_ID" bigint;

http://git-wip-us.apache.org/repos/asf/hive/blob/92072ad2/metastore/scripts/upgrade/derby/024-HIVE-12814.derby.sql
----------------------------------------------------------------------
diff --git a/metastore/scripts/upgrade/derby/024-HIVE-12814.derby.sql b/metastore/scripts/upgrade/derby/024-HIVE-12814.derby.sql
new file mode 100644
index 0000000..a451846
--- /dev/null
+++ b/metastore/scripts/upgrade/derby/024-HIVE-12814.derby.sql
@@ -0,0 +1 @@
+ALTER TABLE "COMPACTION_QUEUE" ADD "CQ_META_INFO" varchar(2048) for bit data;

http://git-wip-us.apache.org/repos/asf/hive/blob/92072ad2/metastore/scripts/upgrade/derby/025-HIVE-12816.derby.sql
----------------------------------------------------------------------
diff --git a/metastore/scripts/upgrade/derby/025-HIVE-12816.derby.sql b/metastore/scripts/upgrade/derby/025-HIVE-12816.derby.sql
new file mode 100644
index 0000000..2a78bf1
--- /dev/null
+++ b/metastore/scripts/upgrade/derby/025-HIVE-12816.derby.sql
@@ -0,0 +1 @@
+ALTER TABLE "COMPACTION_QUEUE" ADD "CQ_HADOOP_JOB_ID" VARCHAR(32);

http://git-wip-us.apache.org/repos/asf/hive/blob/92072ad2/metastore/scripts/upgrade/derby/026-HIVE-12818.derby.sql
----------------------------------------------------------------------
diff --git a/metastore/scripts/upgrade/derby/026-HIVE-12818.derby.sql b/metastore/scripts/upgrade/derby/026-HIVE-12818.derby.sql
new file mode 100644
index 0000000..4e3c82b
--- /dev/null
+++ b/metastore/scripts/upgrade/derby/026-HIVE-12818.derby.sql
@@ -0,0 +1,15 @@
+CREATE TABLE COMPLETED_COMPACTIONS (
+  CC_ID bigint PRIMARY KEY,
+  CC_DATABASE varchar(128) NOT NULL,
+  CC_TABLE varchar(128) NOT NULL,
+  CC_PARTITION varchar(767),
+  CC_STATE char(1) NOT NULL,
+  CC_TYPE char(1) NOT NULL,
+  CC_WORKER_ID varchar(128),
+  CC_START bigint,
+  CC_END bigint,
+  CC_RUN_AS varchar(128),
+  CC_HIGHEST_TXN_ID bigint,
+  CC_META_INFO varchar(2048) for bit data,
+  CC_HADOOP_JOB_ID varchar(32)
+);

http://git-wip-us.apache.org/repos/asf/hive/blob/92072ad2/metastore/scripts/upgrade/derby/027-HIVE-12819.derby.sql
----------------------------------------------------------------------
diff --git a/metastore/scripts/upgrade/derby/027-HIVE-12819.derby.sql b/metastore/scripts/upgrade/derby/027-HIVE-12819.derby.sql
new file mode 100644
index 0000000..69b8a3a
--- /dev/null
+++ b/metastore/scripts/upgrade/derby/027-HIVE-12819.derby.sql
@@ -0,0 +1 @@
+ALTER TABLE "TXNS" ADD "TXN_AGENT_INFO" varchar(128);

http://git-wip-us.apache.org/repos/asf/hive/blob/92072ad2/metastore/scripts/upgrade/derby/028-HIVE-12821.derby.sql
----------------------------------------------------------------------
diff --git a/metastore/scripts/upgrade/derby/028-HIVE-12821.derby.sql b/metastore/scripts/upgrade/derby/028-HIVE-12821.derby.sql
new file mode 100644
index 0000000..0c10245
--- /dev/null
+++ b/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;

http://git-wip-us.apache.org/repos/asf/hive/blob/92072ad2/metastore/scripts/upgrade/derby/029-HIVE-12822.derby.sql
----------------------------------------------------------------------
diff --git a/metastore/scripts/upgrade/derby/029-HIVE-12822.derby.sql b/metastore/scripts/upgrade/derby/029-HIVE-12822.derby.sql
new file mode 100644
index 0000000..9f9423e
--- /dev/null
+++ b/metastore/scripts/upgrade/derby/029-HIVE-12822.derby.sql
@@ -0,0 +1 @@
+ALTER TABLE "TXNS" ADD "TXN_META_INFO" varchar(128);

http://git-wip-us.apache.org/repos/asf/hive/blob/92072ad2/metastore/scripts/upgrade/derby/030-HIVE-12823.derby.sql
----------------------------------------------------------------------
diff --git a/metastore/scripts/upgrade/derby/030-HIVE-12823.derby.sql b/metastore/scripts/upgrade/derby/030-HIVE-12823.derby.sql
new file mode 100644
index 0000000..b7fbc71
--- /dev/null
+++ b/metastore/scripts/upgrade/derby/030-HIVE-12823.derby.sql
@@ -0,0 +1 @@
+ALTER TABLE "HIVE_LOCKS" ADD "HL_AGENT_INFO" varchar(128);

http://git-wip-us.apache.org/repos/asf/hive/blob/92072ad2/metastore/scripts/upgrade/derby/031-HIVE-12831.derby.sql
----------------------------------------------------------------------
diff --git a/metastore/scripts/upgrade/derby/031-HIVE-12831.derby.sql b/metastore/scripts/upgrade/derby/031-HIVE-12831.derby.sql
new file mode 100644
index 0000000..890fa1a
--- /dev/null
+++ b/metastore/scripts/upgrade/derby/031-HIVE-12831.derby.sql
@@ -0,0 +1,2 @@
+ALTER TABLE "HIVE_LOCKS" ADD "HL_BLOCKEDBY_EXT_ID" bigint;
+ALTER TABLE "HIVE_LOCKS" ADD "HL_BLOCKEDBY_INT_ID" bigint;

http://git-wip-us.apache.org/repos/asf/hive/blob/92072ad2/metastore/scripts/upgrade/derby/032-HIVE-12832.derby.sql
----------------------------------------------------------------------
diff --git a/metastore/scripts/upgrade/derby/032-HIVE-12832.derby.sql b/metastore/scripts/upgrade/derby/032-HIVE-12832.derby.sql
new file mode 100644
index 0000000..0e5515c
--- /dev/null
+++ b/metastore/scripts/upgrade/derby/032-HIVE-12832.derby.sql
@@ -0,0 +1,7 @@
+CREATE TABLE AUX_TABLE (
+  MT_KEY1 varchar(128) NOT NULL,
+  MT_KEY2 bigint NOT NULL,
+  MT_COMMENT varchar(255),
+  PRIMARY KEY(MT_KEY1, MT_KEY2)
+);
+

http://git-wip-us.apache.org/repos/asf/hive/blob/92072ad2/metastore/scripts/upgrade/derby/hive-schema-1.3.0.derby.sql
----------------------------------------------------------------------
diff --git a/metastore/scripts/upgrade/derby/hive-schema-1.3.0.derby.sql b/metastore/scripts/upgrade/derby/hive-schema-1.3.0.derby.sql
index c50375f..3235489 100644
--- a/metastore/scripts/upgrade/derby/hive-schema-1.3.0.derby.sql
+++ b/metastore/scripts/upgrade/derby/hive-schema-1.3.0.derby.sql
@@ -327,7 +327,7 @@ ALTER TABLE "APP"."SDS" ADD CONSTRAINT "SQL110318025505550" CHECK (IS_COMPRESSED
 -- ----------------------------
 -- Transaction and Lock Tables
 -- ----------------------------
-RUN 'hive-txn-schema-0.13.0.derby.sql';
+RUN 'hive-txn-schema-1.3.0.derby.sql';
 
 -- -----------------------------------------------------------------
 -- Record schema version. Should be the last step in the init script

http://git-wip-us.apache.org/repos/asf/hive/blob/92072ad2/metastore/scripts/upgrade/derby/hive-txn-schema-1.3.0.derby.sql
----------------------------------------------------------------------
diff --git a/metastore/scripts/upgrade/derby/hive-txn-schema-1.3.0.derby.sql b/metastore/scripts/upgrade/derby/hive-txn-schema-1.3.0.derby.sql
new file mode 100644
index 0000000..13f3340
--- /dev/null
+++ b/metastore/scripts/upgrade/derby/hive-txn-schema-1.3.0.derby.sql
@@ -0,0 +1,119 @@
+-- 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.
+
+--
+-- Tables for transaction management
+-- 
+CREATE TABLE TXNS (
+  TXN_ID bigint PRIMARY KEY,
+  TXN_STATE char(1) NOT NULL,
+  TXN_STARTED bigint NOT NULL,
+  TXN_LAST_HEARTBEAT bigint NOT NULL,
+  TXN_USER varchar(128) NOT NULL,
+  TXN_HOST varchar(128) NOT NULL,
+  TXN_AGENT_INFO varchar(128),
+  TXN_META_INFO varchar(128),
+  TXN_HEARTBEAT_COUNT integer
+);
+
+CREATE TABLE TXN_COMPONENTS (
+  TC_TXNID bigint REFERENCES TXNS (TXN_ID),
+  TC_DATABASE varchar(128) NOT NULL,
+  TC_TABLE varchar(128),
+  TC_PARTITION varchar(767)
+);
+
+CREATE TABLE COMPLETED_TXN_COMPONENTS (
+  CTC_TXNID bigint,
+  CTC_DATABASE varchar(128) NOT NULL,
+  CTC_TABLE varchar(128),
+  CTC_PARTITION varchar(767)
+);
+
+CREATE TABLE NEXT_TXN_ID (
+  NTXN_NEXT bigint NOT NULL
+);
+INSERT INTO NEXT_TXN_ID VALUES(1);
+
+CREATE TABLE HIVE_LOCKS (
+  HL_LOCK_EXT_ID bigint NOT NULL,
+  HL_LOCK_INT_ID bigint NOT NULL,
+  HL_TXNID bigint,
+  HL_DB varchar(128) NOT NULL,
+  HL_TABLE varchar(128),
+  HL_PARTITION varchar(767),
+  HL_LOCK_STATE char(1) NOT NULL,
+  HL_LOCK_TYPE char(1) NOT NULL,
+  HL_LAST_HEARTBEAT bigint NOT NULL,
+  HL_ACQUIRED_AT bigint,
+  HL_USER varchar(128) NOT NULL,
+  HL_HOST varchar(128) NOT NULL,
+  HL_HEARTBEAT_COUNT integer,
+  HL_AGENT_INFO varchar(128),
+  HL_BLOCKEDBY_EXT_ID bigint,
+  HL_BLOCKEDBY_INT_ID bigint,
+  PRIMARY KEY(HL_LOCK_EXT_ID, HL_LOCK_INT_ID)
+); 
+
+CREATE INDEX HL_TXNID_INDEX ON HIVE_LOCKS (HL_TXNID);
+
+CREATE TABLE NEXT_LOCK_ID (
+  NL_NEXT bigint NOT NULL
+);
+INSERT INTO NEXT_LOCK_ID VALUES(1);
+
+CREATE TABLE COMPACTION_QUEUE (
+  CQ_ID bigint PRIMARY KEY,
+  CQ_DATABASE varchar(128) NOT NULL,
+  CQ_TABLE varchar(128) NOT NULL,
+  CQ_PARTITION varchar(767),
+  CQ_STATE char(1) NOT NULL,
+  CQ_TYPE char(1) NOT NULL,
+  CQ_WORKER_ID varchar(128),
+  CQ_START bigint,
+  CQ_RUN_AS varchar(128),
+  CQ_HIGHEST_TXN_ID bigint,
+  CQ_META_INFO varchar(2048) for bit data,
+  CQ_HADOOP_JOB_ID varchar(32)
+);
+
+CREATE TABLE NEXT_COMPACTION_QUEUE_ID (
+  NCQ_NEXT bigint NOT NULL
+);
+INSERT INTO NEXT_COMPACTION_QUEUE_ID VALUES(1);
+
+CREATE TABLE COMPLETED_COMPACTIONS (
+  CC_ID bigint PRIMARY KEY,
+  CC_DATABASE varchar(128) NOT NULL,
+  CC_TABLE varchar(128) NOT NULL,
+  CC_PARTITION varchar(767),
+  CC_STATE char(1) NOT NULL,
+  CC_TYPE char(1) NOT NULL,
+  CC_WORKER_ID varchar(128),
+  CC_START bigint,
+  CC_END bigint,
+  CC_RUN_AS varchar(128),
+  CC_HIGHEST_TXN_ID bigint,
+  CC_META_INFO varchar(2048) for bit data,
+  CC_HADOOP_JOB_ID varchar(32)
+);
+
+CREATE TABLE AUX_TABLE (
+  MT_KEY1 varchar(128) NOT NULL,
+  MT_KEY2 bigint NOT NULL,
+  MT_COMMENT varchar(255),
+  PRIMARY KEY(MT_KEY1, MT_KEY2)
+);
+

http://git-wip-us.apache.org/repos/asf/hive/blob/92072ad2/metastore/scripts/upgrade/derby/upgrade-1.2.0-to-1.3.0.derby.sql
----------------------------------------------------------------------
diff --git a/metastore/scripts/upgrade/derby/upgrade-1.2.0-to-1.3.0.derby.sql b/metastore/scripts/upgrade/derby/upgrade-1.2.0-to-1.3.0.derby.sql
index dee744b..6d4e591 100644
--- a/metastore/scripts/upgrade/derby/upgrade-1.2.0-to-1.3.0.derby.sql
+++ b/metastore/scripts/upgrade/derby/upgrade-1.2.0-to-1.3.0.derby.sql
@@ -1,3 +1,13 @@
 -- Upgrade MetaStore schema from 1.2.0 to 1.3.0
 
+RUN '023-HIVE-12807.derby.sql';
+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';
+RUN '029-HIVE-12822.derby.sql';
+RUN '030-HIVE-12823.derby.sql';
+RUN '031-HIVE-12831.derby.sql';
+RUN '032-HIVE-12832.derby.sql';
 UPDATE "APP".VERSION SET SCHEMA_VERSION='1.3.0', VERSION_COMMENT='Hive release version 1.3.0' where VER_ID=1;

http://git-wip-us.apache.org/repos/asf/hive/blob/92072ad2/metastore/scripts/upgrade/mssql/008-HIVE-12807.mssql.sql
----------------------------------------------------------------------
diff --git a/metastore/scripts/upgrade/mssql/008-HIVE-12807.mssql.sql b/metastore/scripts/upgrade/mssql/008-HIVE-12807.mssql.sql
new file mode 100644
index 0000000..e2d7615
--- /dev/null
+++ b/metastore/scripts/upgrade/mssql/008-HIVE-12807.mssql.sql
@@ -0,0 +1 @@
+ALTER TABLE COMPACTION_QUEUE ADD CQ_HIGHEST_TXN_ID bigint NULL;

http://git-wip-us.apache.org/repos/asf/hive/blob/92072ad2/metastore/scripts/upgrade/mssql/009-HIVE-12814.mssql.sql
----------------------------------------------------------------------
diff --git a/metastore/scripts/upgrade/mssql/009-HIVE-12814.mssql.sql b/metastore/scripts/upgrade/mssql/009-HIVE-12814.mssql.sql
new file mode 100644
index 0000000..0088290
--- /dev/null
+++ b/metastore/scripts/upgrade/mssql/009-HIVE-12814.mssql.sql
@@ -0,0 +1 @@
+ALTER TABLE COMPACTION_QUEUE ADD CQ_META_INFO varbinary(2048) NULL;

http://git-wip-us.apache.org/repos/asf/hive/blob/92072ad2/metastore/scripts/upgrade/mssql/010-HIVE-12816.mssql.sql
----------------------------------------------------------------------
diff --git a/metastore/scripts/upgrade/mssql/010-HIVE-12816.mssql.sql b/metastore/scripts/upgrade/mssql/010-HIVE-12816.mssql.sql
new file mode 100644
index 0000000..0c0342f
--- /dev/null
+++ b/metastore/scripts/upgrade/mssql/010-HIVE-12816.mssql.sql
@@ -0,0 +1 @@
+ALTER TABLE COMPACTION_QUEUE ADD CQ_HADOOP_JOB_ID nvarchar(32) NULL;

http://git-wip-us.apache.org/repos/asf/hive/blob/92072ad2/metastore/scripts/upgrade/mssql/011-HIVE-12818.mssql.sql
----------------------------------------------------------------------
diff --git a/metastore/scripts/upgrade/mssql/011-HIVE-12818.mssql.sql b/metastore/scripts/upgrade/mssql/011-HIVE-12818.mssql.sql
new file mode 100644
index 0000000..74ac5bf
--- /dev/null
+++ b/metastore/scripts/upgrade/mssql/011-HIVE-12818.mssql.sql
@@ -0,0 +1,21 @@
+CREATE TABLE COMPLETED_COMPACTIONS (
+	CC_ID bigint NOT NULL,
+	CC_DATABASE nvarchar(128) NOT NULL,
+	CC_TABLE nvarchar(128) NOT NULL,
+	CC_PARTITION nvarchar(767) NULL,
+	CC_STATE char(1) NOT NULL,
+	CC_TYPE char(1) NOT NULL,
+	CC_WORKER_ID nvarchar(128) NULL,
+	CC_START bigint NULL,
+	CC_END bigint NULL,
+	CC_RUN_AS nvarchar(128) NULL,
+	CC_HIGHEST_TXN_ID bigint NULL,
+    CC_META_INFO varbinary(2048) NULL,
+	CC_HADOOP_JOB_ID nvarchar(128) NULL,
+PRIMARY KEY CLUSTERED 
+(
+	CC_ID ASC
+)
+);
+
+

http://git-wip-us.apache.org/repos/asf/hive/blob/92072ad2/metastore/scripts/upgrade/mssql/012-HIVE-12819.mssql.sql
----------------------------------------------------------------------
diff --git a/metastore/scripts/upgrade/mssql/012-HIVE-12819.mssql.sql b/metastore/scripts/upgrade/mssql/012-HIVE-12819.mssql.sql
new file mode 100644
index 0000000..778cbd5
--- /dev/null
+++ b/metastore/scripts/upgrade/mssql/012-HIVE-12819.mssql.sql
@@ -0,0 +1 @@
+ALTER TABLE TXNS ADD TXN_AGENT_INFO nvarchar(128) NULL;

http://git-wip-us.apache.org/repos/asf/hive/blob/92072ad2/metastore/scripts/upgrade/mssql/013-HIVE-12821.mssql.sql
----------------------------------------------------------------------
diff --git a/metastore/scripts/upgrade/mssql/013-HIVE-12821.mssql.sql b/metastore/scripts/upgrade/mssql/013-HIVE-12821.mssql.sql
new file mode 100644
index 0000000..3b8a610
--- /dev/null
+++ b/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;

http://git-wip-us.apache.org/repos/asf/hive/blob/92072ad2/metastore/scripts/upgrade/mssql/014-HIVE-12822.mssql.sql
----------------------------------------------------------------------
diff --git a/metastore/scripts/upgrade/mssql/014-HIVE-12822.mssql.sql b/metastore/scripts/upgrade/mssql/014-HIVE-12822.mssql.sql
new file mode 100644
index 0000000..b82d0ec
--- /dev/null
+++ b/metastore/scripts/upgrade/mssql/014-HIVE-12822.mssql.sql
@@ -0,0 +1 @@
+ALTER TABLE TXNS ADD TXN_META_INFO nvarchar(128) NULL;

http://git-wip-us.apache.org/repos/asf/hive/blob/92072ad2/metastore/scripts/upgrade/mssql/015-HIVE-12823.mssql.sql
----------------------------------------------------------------------
diff --git a/metastore/scripts/upgrade/mssql/015-HIVE-12823.mssql.sql b/metastore/scripts/upgrade/mssql/015-HIVE-12823.mssql.sql
new file mode 100644
index 0000000..d125b24
--- /dev/null
+++ b/metastore/scripts/upgrade/mssql/015-HIVE-12823.mssql.sql
@@ -0,0 +1 @@
+ALTER TABLE HIVE_LOCKS ADD HL_AGENT_INFO nvarchar(128) NULL;

http://git-wip-us.apache.org/repos/asf/hive/blob/92072ad2/metastore/scripts/upgrade/mssql/016-HIVE-12831.mssql.sql
----------------------------------------------------------------------
diff --git a/metastore/scripts/upgrade/mssql/016-HIVE-12831.mssql.sql b/metastore/scripts/upgrade/mssql/016-HIVE-12831.mssql.sql
new file mode 100644
index 0000000..9f37461
--- /dev/null
+++ b/metastore/scripts/upgrade/mssql/016-HIVE-12831.mssql.sql
@@ -0,0 +1,2 @@
+ALTER TABLE HIVE_LOCKS ADD HL_BLOCKEDBY_EXT_ID bigint NULL;
+ALTER TABLE HIVE_LOCKS ADD HL_BLOCKEDBY_INT_ID bigint NULL;

http://git-wip-us.apache.org/repos/asf/hive/blob/92072ad2/metastore/scripts/upgrade/mssql/017-HIVE-12832.mssql.sql
----------------------------------------------------------------------
diff --git a/metastore/scripts/upgrade/mssql/017-HIVE-12832.mssql.sql b/metastore/scripts/upgrade/mssql/017-HIVE-12832.mssql.sql
new file mode 100644
index 0000000..7adfe2e
--- /dev/null
+++ b/metastore/scripts/upgrade/mssql/017-HIVE-12832.mssql.sql
@@ -0,0 +1,10 @@
+CREATE TABLE AUX_TABLE (
+  MT_KEY1 nvarchar(128) NOT NULL,
+  MT_KEY2 bigint NOT NULL,
+  MT_COMMENT nvarchar(255) NULL,
+  PRIMARY KEY CLUSTERED
+(
+    MT_KEY1 ASC,
+    MT_KEY2 ASC
+)
+);

http://git-wip-us.apache.org/repos/asf/hive/blob/92072ad2/metastore/scripts/upgrade/mssql/hive-schema-1.3.0.mssql.sql
----------------------------------------------------------------------
diff --git a/metastore/scripts/upgrade/mssql/hive-schema-1.3.0.mssql.sql b/metastore/scripts/upgrade/mssql/hive-schema-1.3.0.mssql.sql
index 7165edd..33c5ff6 100644
--- a/metastore/scripts/upgrade/mssql/hive-schema-1.3.0.mssql.sql
+++ b/metastore/scripts/upgrade/mssql/hive-schema-1.3.0.mssql.sql
@@ -866,12 +866,35 @@ CREATE TABLE COMPACTION_QUEUE(
 	CQ_WORKER_ID nvarchar(128) NULL,
 	CQ_START bigint NULL,
 	CQ_RUN_AS nvarchar(128) NULL,
+	CQ_HIGHEST_TXN_ID bigint NULL,
+    CQ_META_INFO varbinary(2048) NULL,
+	CQ_HADOOP_JOB_ID nvarchar(128) NULL,
 PRIMARY KEY CLUSTERED 
 (
 	CQ_ID ASC
 )
 );
 
+CREATE TABLE COMPLETED_COMPACTIONS (
+	CC_ID bigint NOT NULL,
+	CC_DATABASE nvarchar(128) NOT NULL,
+	CC_TABLE nvarchar(128) NOT NULL,
+	CC_PARTITION nvarchar(767) NULL,
+	CC_STATE char(1) NOT NULL,
+	CC_TYPE char(1) NOT NULL,
+	CC_WORKER_ID nvarchar(128) NULL,
+	CC_START bigint NULL,
+	CC_END bigint NULL,
+	CC_RUN_AS nvarchar(128) NULL,
+	CC_HIGHEST_TXN_ID bigint NULL,
+    CC_META_INFO varbinary(2048) NULL,
+	CC_HADOOP_JOB_ID nvarchar(128) NULL,
+PRIMARY KEY CLUSTERED 
+(
+	CC_ID ASC
+)
+);
+
 CREATE TABLE COMPLETED_TXN_COMPONENTS(
 	CTC_TXNID bigint NULL,
 	CTC_DATABASE nvarchar(128) NOT NULL,
@@ -892,6 +915,10 @@ 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,
+    HL_AGENT_INFO nvarchar(128) NULL,
+    HL_BLOCKEDBY_EXT_ID bigint NULL,
+    HL_BLOCKEDBY_INT_ID bigint NULL,
 PRIMARY KEY CLUSTERED 
 (
 	HL_LOCK_EXT_ID ASC,
@@ -924,6 +951,9 @@ CREATE TABLE TXNS(
 	TXN_LAST_HEARTBEAT bigint NOT NULL,
 	TXN_USER nvarchar(128) NOT NULL,
 	TXN_HOST nvarchar(128) NOT NULL,
+    TXN_AGENT_INFO nvarchar(128) NULL,
+    TXN_META_INFO nvarchar(128) NULL,
+    TXN_HEARTBEAT_COUNT int NULL,
 PRIMARY KEY CLUSTERED 
 (
 	TXN_ID ASC
@@ -939,6 +969,16 @@ CREATE TABLE TXN_COMPONENTS(
 
 ALTER TABLE TXN_COMPONENTS  WITH CHECK ADD FOREIGN KEY(TC_TXNID) REFERENCES TXNS (TXN_ID);
 
+CREATE TABLE AUX_TABLE (
+  MT_KEY1 nvarchar(128) NOT NULL,
+  MT_KEY2 bigint NOT NULL,
+  MT_COMMENT nvarchar(255) NULL,
+  PRIMARY KEY CLUSTERED
+(
+    MT_KEY1 ASC,
+    MT_KEY2 ASC
+)
+);
 
 
 -- -----------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/hive/blob/92072ad2/metastore/scripts/upgrade/mssql/upgrade-1.2.0-to-1.3.0.mssql.sql
----------------------------------------------------------------------
diff --git a/metastore/scripts/upgrade/mssql/upgrade-1.2.0-to-1.3.0.mssql.sql b/metastore/scripts/upgrade/mssql/upgrade-1.2.0-to-1.3.0.mssql.sql
index fd12a92..b4de8ce 100644
--- a/metastore/scripts/upgrade/mssql/upgrade-1.2.0-to-1.3.0.mssql.sql
+++ b/metastore/scripts/upgrade/mssql/upgrade-1.2.0-to-1.3.0.mssql.sql
@@ -1,5 +1,15 @@
 SELECT 'Upgrading MetaStore schema from 1.2.0 to 1.3.0' AS MESSAGE;
 
+:r 008-HIVE-12807.mssql.sql;
+:r 009-HIVE-12814.mssql.sql;
+:r 010-HIVE-12816.mssql.sql;
+:r 011-HIVE-12818.mssql.sql;
+:r 012-HIVE-12819.mssql.sql;
+:r 013-HIVE-12821.mssql.sql;
+:r 014-HIVE-12822.mssql.sql;
+:r 015-HIVE-12823.mssql.sql;
+:r 016-HIVE-12831.mssql.sql;
+:r 017-HIVE-12832.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;

http://git-wip-us.apache.org/repos/asf/hive/blob/92072ad2/metastore/scripts/upgrade/mysql/023-HIVE-12807.mysql.sql
----------------------------------------------------------------------
diff --git a/metastore/scripts/upgrade/mysql/023-HIVE-12807.mysql.sql b/metastore/scripts/upgrade/mysql/023-HIVE-12807.mysql.sql
new file mode 100644
index 0000000..31a2dd1
--- /dev/null
+++ b/metastore/scripts/upgrade/mysql/023-HIVE-12807.mysql.sql
@@ -0,0 +1 @@
+ALTER TABLE `COMPACTION_QUEUE` ADD `CQ_HIGHEST_TXN_ID` bigint;

http://git-wip-us.apache.org/repos/asf/hive/blob/92072ad2/metastore/scripts/upgrade/mysql/024-HIVE-12814.mysql.sql
----------------------------------------------------------------------
diff --git a/metastore/scripts/upgrade/mysql/024-HIVE-12814.mysql.sql b/metastore/scripts/upgrade/mysql/024-HIVE-12814.mysql.sql
new file mode 100644
index 0000000..5d5f3ca
--- /dev/null
+++ b/metastore/scripts/upgrade/mysql/024-HIVE-12814.mysql.sql
@@ -0,0 +1 @@
+ALTER TABLE `COMPACTION_QUEUE` ADD `CQ_META_INFO` varbinary(2048);

http://git-wip-us.apache.org/repos/asf/hive/blob/92072ad2/metastore/scripts/upgrade/mysql/025-HIVE-12816.mysql.sql
----------------------------------------------------------------------
diff --git a/metastore/scripts/upgrade/mysql/025-HIVE-12816.mysql.sql b/metastore/scripts/upgrade/mysql/025-HIVE-12816.mysql.sql
new file mode 100644
index 0000000..87e48b4
--- /dev/null
+++ b/metastore/scripts/upgrade/mysql/025-HIVE-12816.mysql.sql
@@ -0,0 +1 @@
+ALTER TABLE `COMPACTION_QUEUE` ADD `CQ_HADOOP_JOB_ID` varchar(32);

http://git-wip-us.apache.org/repos/asf/hive/blob/92072ad2/metastore/scripts/upgrade/mysql/026-HIVE-12818.mysql.sql
----------------------------------------------------------------------
diff --git a/metastore/scripts/upgrade/mysql/026-HIVE-12818.mysql.sql b/metastore/scripts/upgrade/mysql/026-HIVE-12818.mysql.sql
new file mode 100644
index 0000000..e241eee
--- /dev/null
+++ b/metastore/scripts/upgrade/mysql/026-HIVE-12818.mysql.sql
@@ -0,0 +1,17 @@
+CREATE TABLE COMPLETED_COMPACTIONS (
+  CC_ID bigint PRIMARY KEY,
+  CC_DATABASE varchar(128) NOT NULL,
+  CC_TABLE varchar(128) NOT NULL,
+  CC_PARTITION varchar(767),
+  CC_STATE char(1) NOT NULL,
+  CC_TYPE char(1) NOT NULL,
+  CC_WORKER_ID varchar(128),
+  CC_START bigint,
+  CC_END bigint,
+  CC_RUN_AS varchar(128),
+  CC_HIGHEST_TXN_ID bigint,
+  CC_META_INFO varbinary(2048),
+  CC_HADOOP_JOB_ID varchar(32)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1;
+
+

http://git-wip-us.apache.org/repos/asf/hive/blob/92072ad2/metastore/scripts/upgrade/mysql/027-HIVE-12819.mysql.sql
----------------------------------------------------------------------
diff --git a/metastore/scripts/upgrade/mysql/027-HIVE-12819.mysql.sql b/metastore/scripts/upgrade/mysql/027-HIVE-12819.mysql.sql
new file mode 100644
index 0000000..f1e25d5
--- /dev/null
+++ b/metastore/scripts/upgrade/mysql/027-HIVE-12819.mysql.sql
@@ -0,0 +1 @@
+ALTER TABLE `TXNS` ADD `TXN_AGENT_INFO` varchar(128);

http://git-wip-us.apache.org/repos/asf/hive/blob/92072ad2/metastore/scripts/upgrade/mysql/028-HIVE-12821.mysql.sql
----------------------------------------------------------------------
diff --git a/metastore/scripts/upgrade/mysql/028-HIVE-12821.mysql.sql b/metastore/scripts/upgrade/mysql/028-HIVE-12821.mysql.sql
new file mode 100644
index 0000000..a951021
--- /dev/null
+++ b/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;

http://git-wip-us.apache.org/repos/asf/hive/blob/92072ad2/metastore/scripts/upgrade/mysql/029-HIVE-12822.mysql.sql
----------------------------------------------------------------------
diff --git a/metastore/scripts/upgrade/mysql/029-HIVE-12822.mysql.sql b/metastore/scripts/upgrade/mysql/029-HIVE-12822.mysql.sql
new file mode 100644
index 0000000..ffd0bab
--- /dev/null
+++ b/metastore/scripts/upgrade/mysql/029-HIVE-12822.mysql.sql
@@ -0,0 +1 @@
+ALTER TABLE `TXNS` ADD `TXN_META_INFO` varchar(128);

http://git-wip-us.apache.org/repos/asf/hive/blob/92072ad2/metastore/scripts/upgrade/mysql/030-HIVE-12823.mysql.sql
----------------------------------------------------------------------
diff --git a/metastore/scripts/upgrade/mysql/030-HIVE-12823.mysql.sql b/metastore/scripts/upgrade/mysql/030-HIVE-12823.mysql.sql
new file mode 100644
index 0000000..42c9b17
--- /dev/null
+++ b/metastore/scripts/upgrade/mysql/030-HIVE-12823.mysql.sql
@@ -0,0 +1 @@
+ALTER TABLE `HIVE_LOCKS` ADD `HL_AGENT_INFO` varchar(128);

http://git-wip-us.apache.org/repos/asf/hive/blob/92072ad2/metastore/scripts/upgrade/mysql/031-HIVE-12831.mysql.sql
----------------------------------------------------------------------
diff --git a/metastore/scripts/upgrade/mysql/031-HIVE-12831.mysql.sql b/metastore/scripts/upgrade/mysql/031-HIVE-12831.mysql.sql
new file mode 100644
index 0000000..0b19bba
--- /dev/null
+++ b/metastore/scripts/upgrade/mysql/031-HIVE-12831.mysql.sql
@@ -0,0 +1,2 @@
+ALTER TABLE `HIVE_LOCKS` ADD `HL_BLOCKEDBY_EXT_ID` bigint;
+ALTER TABLE `HIVE_LOCKS` ADD `HL_BLOCKEDBY_INT_ID` bigint;

http://git-wip-us.apache.org/repos/asf/hive/blob/92072ad2/metastore/scripts/upgrade/mysql/032-HIVE-12832.mysql.sql
----------------------------------------------------------------------
diff --git a/metastore/scripts/upgrade/mysql/032-HIVE-12832.mysql.sql b/metastore/scripts/upgrade/mysql/032-HIVE-12832.mysql.sql
new file mode 100644
index 0000000..98c7706
--- /dev/null
+++ b/metastore/scripts/upgrade/mysql/032-HIVE-12832.mysql.sql
@@ -0,0 +1,7 @@
+CREATE TABLE AUX_TABLE (
+  MT_KEY1 varchar(128) NOT NULL,
+  MT_KEY2 bigint NOT NULL,
+  MT_COMMENT varchar(255),
+  PRIMARY KEY(MT_KEY1, MT_KEY2)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1;
+

http://git-wip-us.apache.org/repos/asf/hive/blob/92072ad2/metastore/scripts/upgrade/mysql/hive-schema-1.3.0.mysql.sql
----------------------------------------------------------------------
diff --git a/metastore/scripts/upgrade/mysql/hive-schema-1.3.0.mysql.sql b/metastore/scripts/upgrade/mysql/hive-schema-1.3.0.mysql.sql
index 71de138..25723e2 100644
--- a/metastore/scripts/upgrade/mysql/hive-schema-1.3.0.mysql.sql
+++ b/metastore/scripts/upgrade/mysql/hive-schema-1.3.0.mysql.sql
@@ -813,7 +813,7 @@ CREATE TABLE IF NOT EXISTS `NOTIFICATION_SEQUENCE`
 -- ----------------------------
 -- Transaction and Lock Tables
 -- ----------------------------
-SOURCE hive-txn-schema-0.13.0.mysql.sql;
+SOURCE hive-txn-schema-1.3.0.mysql.sql;
 
 -- -----------------------------------------------------------------
 -- Record schema version. Should be the last step in the init script

http://git-wip-us.apache.org/repos/asf/hive/blob/92072ad2/metastore/scripts/upgrade/mysql/hive-txn-schema-1.3.0.mysql.sql
----------------------------------------------------------------------
diff --git a/metastore/scripts/upgrade/mysql/hive-txn-schema-1.3.0.mysql.sql b/metastore/scripts/upgrade/mysql/hive-txn-schema-1.3.0.mysql.sql
new file mode 100644
index 0000000..ea42757
--- /dev/null
+++ b/metastore/scripts/upgrade/mysql/hive-txn-schema-1.3.0.mysql.sql
@@ -0,0 +1,122 @@
+-- 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.
+
+--
+-- Tables for transaction management
+-- 
+
+CREATE TABLE TXNS (
+  TXN_ID bigint PRIMARY KEY,
+  TXN_STATE char(1) NOT NULL,
+  TXN_STARTED bigint NOT NULL,
+  TXN_LAST_HEARTBEAT bigint NOT NULL,
+  TXN_USER varchar(128) NOT NULL,
+  TXN_HOST varchar(128) NOT NULL,
+  TXN_AGENT_INFO varchar(128),
+  TXN_META_INFO varchar(128),
+  TXN_HEARTBEAT_COUNT int
+) ENGINE=InnoDB DEFAULT CHARSET=latin1;
+
+CREATE TABLE TXN_COMPONENTS (
+  TC_TXNID bigint,
+  TC_DATABASE varchar(128) NOT NULL,
+  TC_TABLE varchar(128),
+  TC_PARTITION varchar(767),
+  FOREIGN KEY (TC_TXNID) REFERENCES TXNS (TXN_ID)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1;
+
+CREATE TABLE COMPLETED_TXN_COMPONENTS (
+  CTC_TXNID bigint,
+  CTC_DATABASE varchar(128) NOT NULL,
+  CTC_TABLE varchar(128),
+  CTC_PARTITION varchar(767)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1;
+
+CREATE TABLE NEXT_TXN_ID (
+  NTXN_NEXT bigint NOT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=latin1;
+INSERT INTO NEXT_TXN_ID VALUES(1);
+
+CREATE TABLE HIVE_LOCKS (
+  HL_LOCK_EXT_ID bigint NOT NULL,
+  HL_LOCK_INT_ID bigint NOT NULL,
+  HL_TXNID bigint,
+  HL_DB varchar(128) NOT NULL,
+  HL_TABLE varchar(128),
+  HL_PARTITION varchar(767),
+  HL_LOCK_STATE char(1) not null,
+  HL_LOCK_TYPE char(1) not null,
+  HL_LAST_HEARTBEAT bigint NOT NULL,
+  HL_ACQUIRED_AT bigint,
+  HL_USER varchar(128) NOT NULL,
+  HL_HOST varchar(128) NOT NULL,
+  HL_HEARTBEAT_COUNT int,
+  HL_AGENT_INFO varchar(128),
+  HL_BLOCKEDBY_EXT_ID bigint,
+  HL_BLOCKEDBY_INT_ID bigint,
+  PRIMARY KEY(HL_LOCK_EXT_ID, HL_LOCK_INT_ID),
+  KEY HIVE_LOCK_TXNID_INDEX (HL_TXNID)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1;
+
+CREATE INDEX HL_TXNID_IDX ON HIVE_LOCKS (HL_TXNID);
+
+CREATE TABLE NEXT_LOCK_ID (
+  NL_NEXT bigint NOT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=latin1;
+INSERT INTO NEXT_LOCK_ID VALUES(1);
+
+CREATE TABLE COMPACTION_QUEUE (
+  CQ_ID bigint PRIMARY KEY,
+  CQ_DATABASE varchar(128) NOT NULL,
+  CQ_TABLE varchar(128) NOT NULL,
+  CQ_PARTITION varchar(767),
+  CQ_STATE char(1) NOT NULL,
+  CQ_TYPE char(1) NOT NULL,
+  CQ_WORKER_ID varchar(128),
+  CQ_START bigint,
+  CQ_RUN_AS varchar(128),
+  CQ_HIGHEST_TXN_ID bigint,
+  CQ_META_INFO varbinary(2048),
+  CQ_HADOOP_JOB_ID varchar(32)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1;
+
+CREATE TABLE COMPLETED_COMPACTIONS (
+  CC_ID bigint PRIMARY KEY,
+  CC_DATABASE varchar(128) NOT NULL,
+  CC_TABLE varchar(128) NOT NULL,
+  CC_PARTITION varchar(767),
+  CC_STATE char(1) NOT NULL,
+  CC_TYPE char(1) NOT NULL,
+  CC_WORKER_ID varchar(128),
+  CC_START bigint,
+  CC_END bigint,
+  CC_RUN_AS varchar(128),
+  CC_HIGHEST_TXN_ID bigint,
+  CC_META_INFO varbinary(2048),
+  CC_HADOOP_JOB_ID varchar(32)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1;
+
+CREATE TABLE NEXT_COMPACTION_QUEUE_ID (
+  NCQ_NEXT bigint NOT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=latin1;
+INSERT INTO NEXT_COMPACTION_QUEUE_ID VALUES(1);
+
+CREATE TABLE AUX_TABLE (
+  MT_KEY1 varchar(128) NOT NULL,
+  MT_KEY2 bigint NOT NULL,
+  MT_COMMENT varchar(255),
+  PRIMARY KEY(MT_KEY1, MT_KEY2)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1;
+

http://git-wip-us.apache.org/repos/asf/hive/blob/92072ad2/metastore/scripts/upgrade/mysql/upgrade-1.2.0-to-1.3.0.mysql.sql
----------------------------------------------------------------------
diff --git a/metastore/scripts/upgrade/mysql/upgrade-1.2.0-to-1.3.0.mysql.sql b/metastore/scripts/upgrade/mysql/upgrade-1.2.0-to-1.3.0.mysql.sql
index 44a9946..f385549 100644
--- a/metastore/scripts/upgrade/mysql/upgrade-1.2.0-to-1.3.0.mysql.sql
+++ b/metastore/scripts/upgrade/mysql/upgrade-1.2.0-to-1.3.0.mysql.sql
@@ -1,4 +1,16 @@
 SELECT 'Upgrading MetaStore schema from 1.2.0 to 1.3.0' AS ' ';
+
 SOURCE 021-HIVE-7018.mysql.sql;
+SOURCE 023-HIVE-12807.mysql.sql;
+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;
+SOURCE 029-HIVE-12822.mysql.sql;
+SOURCE 030-HIVE-12823.mysql.sql;
+SOURCE 031-HIVE-12831.mysql.sql;
+SOURCE 032-HIVE-12832.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 ' ';

http://git-wip-us.apache.org/repos/asf/hive/blob/92072ad2/metastore/scripts/upgrade/oracle/023-HIVE-12807.oracle.sql
----------------------------------------------------------------------
diff --git a/metastore/scripts/upgrade/oracle/023-HIVE-12807.oracle.sql b/metastore/scripts/upgrade/oracle/023-HIVE-12807.oracle.sql
new file mode 100644
index 0000000..0313e96
--- /dev/null
+++ b/metastore/scripts/upgrade/oracle/023-HIVE-12807.oracle.sql
@@ -0,0 +1 @@
+ALTER TABLE COMPACTION_QUEUE ADD CQ_HIGHEST_TXN_ID NUMBER(19);

http://git-wip-us.apache.org/repos/asf/hive/blob/92072ad2/metastore/scripts/upgrade/oracle/024-HIVE-12814.oracle.sql
----------------------------------------------------------------------
diff --git a/metastore/scripts/upgrade/oracle/024-HIVE-12814.oracle.sql b/metastore/scripts/upgrade/oracle/024-HIVE-12814.oracle.sql
new file mode 100644
index 0000000..d9a5575
--- /dev/null
+++ b/metastore/scripts/upgrade/oracle/024-HIVE-12814.oracle.sql
@@ -0,0 +1 @@
+ALTER TABLE COMPACTION_QUEUE ADD CQ_META_INFO BLOB;

http://git-wip-us.apache.org/repos/asf/hive/blob/92072ad2/metastore/scripts/upgrade/oracle/025-HIVE-12816.oracle.sql
----------------------------------------------------------------------
diff --git a/metastore/scripts/upgrade/oracle/025-HIVE-12816.oracle.sql b/metastore/scripts/upgrade/oracle/025-HIVE-12816.oracle.sql
new file mode 100644
index 0000000..9a96d8c
--- /dev/null
+++ b/metastore/scripts/upgrade/oracle/025-HIVE-12816.oracle.sql
@@ -0,0 +1 @@
+ALTER TABLE COMPACTION_QUEUE ADD CQ_HADOOP_JOB_ID varchar2(32);

http://git-wip-us.apache.org/repos/asf/hive/blob/92072ad2/metastore/scripts/upgrade/oracle/026-HIVE-12818.oracle.sql
----------------------------------------------------------------------
diff --git a/metastore/scripts/upgrade/oracle/026-HIVE-12818.oracle.sql b/metastore/scripts/upgrade/oracle/026-HIVE-12818.oracle.sql
new file mode 100644
index 0000000..9ecb43e
--- /dev/null
+++ b/metastore/scripts/upgrade/oracle/026-HIVE-12818.oracle.sql
@@ -0,0 +1,17 @@
+CREATE TABLE COMPLETED_COMPACTIONS (
+  CC_ID NUMBER(19) PRIMARY KEY,
+  CC_DATABASE varchar(128) NOT NULL,
+  CC_TABLE varchar(128) NOT NULL,
+  CC_PARTITION varchar(767),
+  CC_STATE char(1) NOT NULL,
+  CC_TYPE char(1) NOT NULL,
+  CC_WORKER_ID varchar(128),
+  CC_START NUMBER(19),
+  CC_END NUMBER(19),
+  CC_RUN_AS varchar(128),
+  CC_HIGHEST_TXN_ID NUMBER(19),
+  CC_META_INFO BLOB,
+  CC_HADOOP_JOB_ID varchar2(32)
+) ROWDEPENDENCIES;
+
+

http://git-wip-us.apache.org/repos/asf/hive/blob/92072ad2/metastore/scripts/upgrade/oracle/027-HIVE-12819.oracle.sql
----------------------------------------------------------------------
diff --git a/metastore/scripts/upgrade/oracle/027-HIVE-12819.oracle.sql b/metastore/scripts/upgrade/oracle/027-HIVE-12819.oracle.sql
new file mode 100644
index 0000000..0d74a98
--- /dev/null
+++ b/metastore/scripts/upgrade/oracle/027-HIVE-12819.oracle.sql
@@ -0,0 +1 @@
+ALTER TABLE TXNS ADD TXN_AGENT_INFO varchar2(128);

http://git-wip-us.apache.org/repos/asf/hive/blob/92072ad2/metastore/scripts/upgrade/oracle/028-HIVE-12821.oracle.sql
----------------------------------------------------------------------
diff --git a/metastore/scripts/upgrade/oracle/028-HIVE-12821.oracle.sql b/metastore/scripts/upgrade/oracle/028-HIVE-12821.oracle.sql
new file mode 100644
index 0000000..152d2ab
--- /dev/null
+++ b/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);

http://git-wip-us.apache.org/repos/asf/hive/blob/92072ad2/metastore/scripts/upgrade/oracle/029-HIVE-12822.oracle.sql
----------------------------------------------------------------------
diff --git a/metastore/scripts/upgrade/oracle/029-HIVE-12822.oracle.sql b/metastore/scripts/upgrade/oracle/029-HIVE-12822.oracle.sql
new file mode 100644
index 0000000..63c0d77
--- /dev/null
+++ b/metastore/scripts/upgrade/oracle/029-HIVE-12822.oracle.sql
@@ -0,0 +1 @@
+ALTER TABLE TXNS ADD TXN_META_INFO varchar2(128);

http://git-wip-us.apache.org/repos/asf/hive/blob/92072ad2/metastore/scripts/upgrade/oracle/030-HIVE-12823.oracle.sql
----------------------------------------------------------------------
diff --git a/metastore/scripts/upgrade/oracle/030-HIVE-12823.oracle.sql b/metastore/scripts/upgrade/oracle/030-HIVE-12823.oracle.sql
new file mode 100644
index 0000000..f938603
--- /dev/null
+++ b/metastore/scripts/upgrade/oracle/030-HIVE-12823.oracle.sql
@@ -0,0 +1 @@
+ALTER TABLE HIVE_LOCKS ADD HL_AGENT_INFO varchar2(128);

http://git-wip-us.apache.org/repos/asf/hive/blob/92072ad2/metastore/scripts/upgrade/oracle/031-HIVE-12381.oracle.sql
----------------------------------------------------------------------
diff --git a/metastore/scripts/upgrade/oracle/031-HIVE-12381.oracle.sql b/metastore/scripts/upgrade/oracle/031-HIVE-12381.oracle.sql
new file mode 100644
index 0000000..35a9b9d
--- /dev/null
+++ b/metastore/scripts/upgrade/oracle/031-HIVE-12381.oracle.sql
@@ -0,0 +1,2 @@
+ALTER TABLE HIVE_LOCKS ADD HL_BLOCKEDBY_EXT_ID number(19);
+ALTER TABLE HIVE_LOCKS ADD HL_BLOCKEDBY_INT_ID number(19);

http://git-wip-us.apache.org/repos/asf/hive/blob/92072ad2/metastore/scripts/upgrade/oracle/032-HIVE-12832.oracle.sql
----------------------------------------------------------------------
diff --git a/metastore/scripts/upgrade/oracle/032-HIVE-12832.oracle.sql b/metastore/scripts/upgrade/oracle/032-HIVE-12832.oracle.sql
new file mode 100644
index 0000000..2b58d2e
--- /dev/null
+++ b/metastore/scripts/upgrade/oracle/032-HIVE-12832.oracle.sql
@@ -0,0 +1,7 @@
+CREATE TABLE AUX_TABLE (
+  MT_KEY1 varchar2(128) NOT NULL,
+  MT_KEY2 number(19) NOT NULL,
+  MT_COMMENT varchar2(255),
+  PRIMARY KEY(MT_KEY1, MT_KEY2)
+);
+

http://git-wip-us.apache.org/repos/asf/hive/blob/92072ad2/metastore/scripts/upgrade/oracle/hive-schema-1.3.0.oracle.sql
----------------------------------------------------------------------
diff --git a/metastore/scripts/upgrade/oracle/hive-schema-1.3.0.oracle.sql b/metastore/scripts/upgrade/oracle/hive-schema-1.3.0.oracle.sql
index 7605bc7..b42a291 100644
--- a/metastore/scripts/upgrade/oracle/hive-schema-1.3.0.oracle.sql
+++ b/metastore/scripts/upgrade/oracle/hive-schema-1.3.0.oracle.sql
@@ -780,7 +780,7 @@ CREATE INDEX FUNC_RU_N49 ON FUNC_RU (FUNC_ID);
 ------------------------------
 -- Transaction and lock tables
 ------------------------------
-@hive-txn-schema-0.13.0.oracle.sql;
+@hive-txn-schema-1.3.0.oracle.sql;
 
 -- -----------------------------------------------------------------
 -- Record schema version. Should be the last step in the init script

http://git-wip-us.apache.org/repos/asf/hive/blob/92072ad2/metastore/scripts/upgrade/oracle/hive-txn-schema-1.3.0.oracle.sql
----------------------------------------------------------------------
diff --git a/metastore/scripts/upgrade/oracle/hive-txn-schema-1.3.0.oracle.sql b/metastore/scripts/upgrade/oracle/hive-txn-schema-1.3.0.oracle.sql
new file mode 100644
index 0000000..788741a
--- /dev/null
+++ b/metastore/scripts/upgrade/oracle/hive-txn-schema-1.3.0.oracle.sql
@@ -0,0 +1,120 @@
+-- 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.
+
+--
+-- Tables for transaction management
+-- 
+
+CREATE TABLE TXNS (
+  TXN_ID NUMBER(19) PRIMARY KEY,
+  TXN_STATE char(1) NOT NULL,
+  TXN_STARTED NUMBER(19) NOT NULL,
+  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_META_INFO varchar2(128),
+  TXN_HEARTBEAT_COUNT number(10)
+) ROWDEPENDENCIES;
+
+CREATE TABLE TXN_COMPONENTS (
+  TC_TXNID NUMBER(19) REFERENCES TXNS (TXN_ID),
+  TC_DATABASE VARCHAR2(128) NOT NULL,
+  TC_TABLE VARCHAR2(128),
+  TC_PARTITION VARCHAR2(767) NULL
+) ROWDEPENDENCIES;
+
+CREATE TABLE COMPLETED_TXN_COMPONENTS (
+  CTC_TXNID NUMBER(19),
+  CTC_DATABASE varchar(128) NOT NULL,
+  CTC_TABLE varchar(128),
+  CTC_PARTITION varchar(767)
+) ROWDEPENDENCIES;
+
+CREATE TABLE NEXT_TXN_ID (
+  NTXN_NEXT NUMBER(19) NOT NULL
+);
+INSERT INTO NEXT_TXN_ID VALUES(1);
+
+CREATE TABLE HIVE_LOCKS (
+  HL_LOCK_EXT_ID NUMBER(19) NOT NULL,
+  HL_LOCK_INT_ID NUMBER(19) NOT NULL,
+  HL_TXNID NUMBER(19),
+  HL_DB VARCHAR2(128) NOT NULL,
+  HL_TABLE VARCHAR2(128),
+  HL_PARTITION VARCHAR2(767),
+  HL_LOCK_STATE CHAR(1) NOT NULL,
+  HL_LOCK_TYPE CHAR(1) NOT NULL,
+  HL_LAST_HEARTBEAT NUMBER(19) NOT NULL,
+  HL_ACQUIRED_AT NUMBER(19),
+  HL_USER varchar(128) NOT NULL,
+  HL_HOST varchar(128) NOT NULL,
+  HL_HEARTBEAT_COUNT number(10),
+  HL_AGENT_INFO varchar2(128),
+  HL_BLOCKEDBY_EXT_ID number(19),
+  HL_BLOCKEDBY_INT_ID number(19),
+  PRIMARY KEY(HL_LOCK_EXT_ID, HL_LOCK_INT_ID)
+) ROWDEPENDENCIES;
+
+CREATE INDEX HL_TXNID_INDEX ON HIVE_LOCKS (HL_TXNID);
+
+CREATE TABLE NEXT_LOCK_ID (
+  NL_NEXT NUMBER(19) NOT NULL
+);
+INSERT INTO NEXT_LOCK_ID VALUES(1);
+
+CREATE TABLE COMPACTION_QUEUE (
+  CQ_ID NUMBER(19) PRIMARY KEY,
+  CQ_DATABASE varchar(128) NOT NULL,
+  CQ_TABLE varchar(128) NOT NULL,
+  CQ_PARTITION varchar(767),
+  CQ_STATE char(1) NOT NULL,
+  CQ_TYPE char(1) NOT NULL,
+  CQ_WORKER_ID varchar(128),
+  CQ_START NUMBER(19),
+  CQ_RUN_AS varchar(128),
+  CQ_HIGHEST_TXN_ID NUMBER(19),
+  CQ_META_INFO BLOB,
+  CQ_HADOOP_JOB_ID varchar2(32)
+) ROWDEPENDENCIES;
+
+CREATE TABLE NEXT_COMPACTION_QUEUE_ID (
+  NCQ_NEXT NUMBER(19) NOT NULL
+);
+INSERT INTO NEXT_COMPACTION_QUEUE_ID VALUES(1);
+
+CREATE TABLE COMPLETED_COMPACTIONS (
+  CC_ID NUMBER(19) PRIMARY KEY,
+  CC_DATABASE varchar(128) NOT NULL,
+  CC_TABLE varchar(128) NOT NULL,
+  CC_PARTITION varchar(767),
+  CC_STATE char(1) NOT NULL,
+  CC_TYPE char(1) NOT NULL,
+  CC_WORKER_ID varchar(128),
+  CC_START NUMBER(19),
+  CC_END NUMBER(19),
+  CC_RUN_AS varchar(128),
+  CC_HIGHEST_TXN_ID NUMBER(19),
+  CC_META_INFO BLOB,
+  CC_HADOOP_JOB_ID varchar2(32)
+) ROWDEPENDENCIES;
+
+CREATE TABLE AUX_TABLE (
+  MT_KEY1 varchar2(128) NOT NULL,
+  MT_KEY2 number(19) NOT NULL,
+  MT_COMMENT varchar2(255),
+  PRIMARY KEY(MT_KEY1, MT_KEY2)
+);
+

http://git-wip-us.apache.org/repos/asf/hive/blob/92072ad2/metastore/scripts/upgrade/oracle/upgrade-1.2.0-to-1.3.0.oracle.sql
----------------------------------------------------------------------
diff --git a/metastore/scripts/upgrade/oracle/upgrade-1.2.0-to-1.3.0.oracle.sql b/metastore/scripts/upgrade/oracle/upgrade-1.2.0-to-1.3.0.oracle.sql
index f072a1c..55e272a 100644
--- a/metastore/scripts/upgrade/oracle/upgrade-1.2.0-to-1.3.0.oracle.sql
+++ b/metastore/scripts/upgrade/oracle/upgrade-1.2.0-to-1.3.0.oracle.sql
@@ -1,4 +1,15 @@
 SELECT 'Upgrading MetaStore schema from 1.2.0 to 1.3.0' AS Status from dual;
 
+@023-HIVE-12807.oracle.sql;
+@024-HIVE-12814.oracle.sql;
+@025-HIVE-12816.oracle.sql;
+@026-HIVE-12818.oracle.sql;
+@027-HIVE-12819.oracle.sql;
+@028-HIVE-12821.oracle.sql;
+@029-HIVE-12822.oracle.sql;
+@030-HIVE-12823.oracle.sql;
+@031-HIVE-12381.oracle.sql;
+@032-HIVE-12832.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;

http://git-wip-us.apache.org/repos/asf/hive/blob/92072ad2/metastore/scripts/upgrade/postgres/022-HIVE-12807.postgres.sql
----------------------------------------------------------------------
diff --git a/metastore/scripts/upgrade/postgres/022-HIVE-12807.postgres.sql b/metastore/scripts/upgrade/postgres/022-HIVE-12807.postgres.sql
new file mode 100644
index 0000000..d4c7a18
--- /dev/null
+++ b/metastore/scripts/upgrade/postgres/022-HIVE-12807.postgres.sql
@@ -0,0 +1 @@
+ALTER TABLE COMPACTION_QUEUE ADD COLUMN CQ_HIGHEST_TXN_ID bigint;

http://git-wip-us.apache.org/repos/asf/hive/blob/92072ad2/metastore/scripts/upgrade/postgres/023-HIVE-12814.postgres.sql
----------------------------------------------------------------------
diff --git a/metastore/scripts/upgrade/postgres/023-HIVE-12814.postgres.sql b/metastore/scripts/upgrade/postgres/023-HIVE-12814.postgres.sql
new file mode 100644
index 0000000..37ef99e
--- /dev/null
+++ b/metastore/scripts/upgrade/postgres/023-HIVE-12814.postgres.sql
@@ -0,0 +1 @@
+ALTER TABLE COMPACTION_QUEUE ADD COLUMN CQ_META_INFO bytea;

http://git-wip-us.apache.org/repos/asf/hive/blob/92072ad2/metastore/scripts/upgrade/postgres/024-HIVE-12816.postgres.sql
----------------------------------------------------------------------
diff --git a/metastore/scripts/upgrade/postgres/024-HIVE-12816.postgres.sql b/metastore/scripts/upgrade/postgres/024-HIVE-12816.postgres.sql
new file mode 100644
index 0000000..fa987d9
--- /dev/null
+++ b/metastore/scripts/upgrade/postgres/024-HIVE-12816.postgres.sql
@@ -0,0 +1 @@
+ALTER TABLE COMPACTION_QUEUE ADD COLUMN CQ_HADOOP_JOB_ID varchar(32);

http://git-wip-us.apache.org/repos/asf/hive/blob/92072ad2/metastore/scripts/upgrade/postgres/025-HIVE-12818.postgres.sql
----------------------------------------------------------------------
diff --git a/metastore/scripts/upgrade/postgres/025-HIVE-12818.postgres.sql b/metastore/scripts/upgrade/postgres/025-HIVE-12818.postgres.sql
new file mode 100644
index 0000000..5eb2f26
--- /dev/null
+++ b/metastore/scripts/upgrade/postgres/025-HIVE-12818.postgres.sql
@@ -0,0 +1,17 @@
+CREATE TABLE COMPLETED_COMPACTIONS (
+  CC_ID bigint PRIMARY KEY,
+  CC_DATABASE varchar(128) NOT NULL,
+  CC_TABLE varchar(128) NOT NULL,
+  CC_PARTITION varchar(767),
+  CC_STATE char(1) NOT NULL,
+  CC_TYPE char(1) NOT NULL,
+  CC_WORKER_ID varchar(128),
+  CC_START bigint,
+  CC_END bigint,
+  CC_RUN_AS varchar(128),
+  CC_HIGHEST_TXN_ID bigint,
+  CC_META_INFO bytea,
+  CC_HADOOP_JOB_ID varchar(32)
+);
+
+

http://git-wip-us.apache.org/repos/asf/hive/blob/92072ad2/metastore/scripts/upgrade/postgres/026-HIVE-12819.postgres.sql
----------------------------------------------------------------------
diff --git a/metastore/scripts/upgrade/postgres/026-HIVE-12819.postgres.sql b/metastore/scripts/upgrade/postgres/026-HIVE-12819.postgres.sql
new file mode 100644
index 0000000..eceb910
--- /dev/null
+++ b/metastore/scripts/upgrade/postgres/026-HIVE-12819.postgres.sql
@@ -0,0 +1 @@
+ALTER TABLE TXNS ADD COLUMN TXN_AGENT_INFO varchar(128);

http://git-wip-us.apache.org/repos/asf/hive/blob/92072ad2/metastore/scripts/upgrade/postgres/027-HIVE-12821.postgres.sql
----------------------------------------------------------------------
diff --git a/metastore/scripts/upgrade/postgres/027-HIVE-12821.postgres.sql b/metastore/scripts/upgrade/postgres/027-HIVE-12821.postgres.sql
new file mode 100644
index 0000000..ba5a51a
--- /dev/null
+++ b/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;

http://git-wip-us.apache.org/repos/asf/hive/blob/92072ad2/metastore/scripts/upgrade/postgres/028-HIVE-12822.postgres.sql
----------------------------------------------------------------------
diff --git a/metastore/scripts/upgrade/postgres/028-HIVE-12822.postgres.sql b/metastore/scripts/upgrade/postgres/028-HIVE-12822.postgres.sql
new file mode 100644
index 0000000..f4e9742
--- /dev/null
+++ b/metastore/scripts/upgrade/postgres/028-HIVE-12822.postgres.sql
@@ -0,0 +1 @@
+ALTER TABLE TXNS ADD COLUMN TXN_META_INFO varchar(128);

http://git-wip-us.apache.org/repos/asf/hive/blob/92072ad2/metastore/scripts/upgrade/postgres/029-HIVE-12823.postgres.sql
----------------------------------------------------------------------
diff --git a/metastore/scripts/upgrade/postgres/029-HIVE-12823.postgres.sql b/metastore/scripts/upgrade/postgres/029-HIVE-12823.postgres.sql
new file mode 100644
index 0000000..f7a980b
--- /dev/null
+++ b/metastore/scripts/upgrade/postgres/029-HIVE-12823.postgres.sql
@@ -0,0 +1 @@
+ALTER TABLE HIVE_LOCKS ADD COLUMN HL_AGENT_INFO varchar(128);

http://git-wip-us.apache.org/repos/asf/hive/blob/92072ad2/metastore/scripts/upgrade/postgres/030-HIVE-12831.postgres.sql
----------------------------------------------------------------------
diff --git a/metastore/scripts/upgrade/postgres/030-HIVE-12831.postgres.sql b/metastore/scripts/upgrade/postgres/030-HIVE-12831.postgres.sql
new file mode 100644
index 0000000..3f314e8
--- /dev/null
+++ b/metastore/scripts/upgrade/postgres/030-HIVE-12831.postgres.sql
@@ -0,0 +1,2 @@
+ALTER TABLE HIVE_LOCKS ADD COLUMN HL_BLOCKEDBY_EXT_ID bigint;
+ALTER TABLE HIVE_LOCKS ADD COLUMN HL_BLOCKEDBY_INT_ID bigint;

http://git-wip-us.apache.org/repos/asf/hive/blob/92072ad2/metastore/scripts/upgrade/postgres/031-HIVE-12832.postgres.sql
----------------------------------------------------------------------
diff --git a/metastore/scripts/upgrade/postgres/031-HIVE-12832.postgres.sql b/metastore/scripts/upgrade/postgres/031-HIVE-12832.postgres.sql
new file mode 100644
index 0000000..0e5515c
--- /dev/null
+++ b/metastore/scripts/upgrade/postgres/031-HIVE-12832.postgres.sql
@@ -0,0 +1,7 @@
+CREATE TABLE AUX_TABLE (
+  MT_KEY1 varchar(128) NOT NULL,
+  MT_KEY2 bigint NOT NULL,
+  MT_COMMENT varchar(255),
+  PRIMARY KEY(MT_KEY1, MT_KEY2)
+);
+

http://git-wip-us.apache.org/repos/asf/hive/blob/92072ad2/metastore/scripts/upgrade/postgres/hive-schema-1.3.0.postgres.sql
----------------------------------------------------------------------
diff --git a/metastore/scripts/upgrade/postgres/hive-schema-1.3.0.postgres.sql b/metastore/scripts/upgrade/postgres/hive-schema-1.3.0.postgres.sql
index 3ab5b3e..06fac4a 100644
--- a/metastore/scripts/upgrade/postgres/hive-schema-1.3.0.postgres.sql
+++ b/metastore/scripts/upgrade/postgres/hive-schema-1.3.0.postgres.sql
@@ -1449,7 +1449,7 @@ GRANT ALL ON SCHEMA public TO PUBLIC;
 ------------------------------
 -- Transaction and lock tables
 ------------------------------
-\i hive-txn-schema-0.13.0.postgres.sql;
+\i hive-txn-schema-1.3.0.postgres.sql;
 
 -- -----------------------------------------------------------------
 -- Record schema version. Should be the last step in the init script

http://git-wip-us.apache.org/repos/asf/hive/blob/92072ad2/metastore/scripts/upgrade/postgres/hive-txn-schema-1.3.0.postgres.sql
----------------------------------------------------------------------
diff --git a/metastore/scripts/upgrade/postgres/hive-txn-schema-1.3.0.postgres.sql b/metastore/scripts/upgrade/postgres/hive-txn-schema-1.3.0.postgres.sql
new file mode 100644
index 0000000..b2fc1a8
--- /dev/null
+++ b/metastore/scripts/upgrade/postgres/hive-txn-schema-1.3.0.postgres.sql
@@ -0,0 +1,121 @@
+-- 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.
+
+--
+-- Tables for transaction management
+-- 
+
+CREATE TABLE TXNS (
+  TXN_ID bigint PRIMARY KEY,
+  TXN_STATE char(1) NOT NULL,
+  TXN_STARTED bigint NOT NULL,
+  TXN_LAST_HEARTBEAT bigint NOT NULL,
+  TXN_USER varchar(128) NOT NULL,
+  TXN_HOST varchar(128) NOT NULL,
+  TXN_AGENT_INFO varchar(128),
+  TXN_META_INFO varchar(128),
+  TXN_HEARTBEAT_COUNT integer
+);
+
+CREATE TABLE TXN_COMPONENTS (
+  TC_TXNID bigint REFERENCES TXNS (TXN_ID),
+  TC_DATABASE varchar(128) NOT NULL,
+  TC_TABLE varchar(128),
+  TC_PARTITION varchar(767) DEFAULT NULL
+);
+
+CREATE TABLE COMPLETED_TXN_COMPONENTS (
+  CTC_TXNID bigint,
+  CTC_DATABASE varchar(128) NOT NULL,
+  CTC_TABLE varchar(128),
+  CTC_PARTITION varchar(767)
+);
+
+CREATE TABLE NEXT_TXN_ID (
+  NTXN_NEXT bigint NOT NULL
+);
+INSERT INTO NEXT_TXN_ID VALUES(1);
+
+CREATE TABLE HIVE_LOCKS (
+  HL_LOCK_EXT_ID bigint NOT NULL,
+  HL_LOCK_INT_ID bigint NOT NULL,
+  HL_TXNID bigint,
+  HL_DB varchar(128) NOT NULL,
+  HL_TABLE varchar(128),
+  HL_PARTITION varchar(767) DEFAULT NULL,
+  HL_LOCK_STATE char(1) NOT NULL,
+  HL_LOCK_TYPE char(1) NOT NULL,
+  HL_LAST_HEARTBEAT bigint NOT NULL,
+  HL_ACQUIRED_AT bigint,
+  HL_USER varchar(128) NOT NULL,
+  HL_HOST varchar(128) NOT NULL,
+  HL_HEARTBEAT_COUNT integer,
+  HL_AGENT_INFO varchar(128),
+  HL_BLOCKEDBY_EXT_ID bigint,
+  HL_BLOCKEDBY_INT_ID bigint,
+  PRIMARY KEY(HL_LOCK_EXT_ID, HL_LOCK_INT_ID)
+); 
+
+CREATE INDEX HL_TXNID_INDEX ON HIVE_LOCKS USING hash (HL_TXNID);
+
+CREATE TABLE NEXT_LOCK_ID (
+  NL_NEXT bigint NOT NULL
+);
+INSERT INTO NEXT_LOCK_ID VALUES(1);
+
+CREATE TABLE COMPACTION_QUEUE (
+  CQ_ID bigint PRIMARY KEY,
+  CQ_DATABASE varchar(128) NOT NULL,
+  CQ_TABLE varchar(128) NOT NULL,
+  CQ_PARTITION varchar(767),
+  CQ_STATE char(1) NOT NULL,
+  CQ_TYPE char(1) NOT NULL,
+  CQ_WORKER_ID varchar(128),
+  CQ_START bigint,
+  CQ_RUN_AS varchar(128),
+  CQ_HIGHEST_TXN_ID bigint,
+  CQ_META_INFO bytea,
+  CQ_HADOOP_JOB_ID varchar(32)
+);
+
+CREATE TABLE NEXT_COMPACTION_QUEUE_ID (
+  NCQ_NEXT bigint NOT NULL
+);
+INSERT INTO NEXT_COMPACTION_QUEUE_ID VALUES(1);
+
+CREATE TABLE COMPLETED_COMPACTIONS (
+  CC_ID bigint PRIMARY KEY,
+  CC_DATABASE varchar(128) NOT NULL,
+  CC_TABLE varchar(128) NOT NULL,
+  CC_PARTITION varchar(767),
+  CC_STATE char(1) NOT NULL,
+  CC_TYPE char(1) NOT NULL,
+  CC_WORKER_ID varchar(128),
+  CC_START bigint,
+  CC_END bigint,
+  CC_RUN_AS varchar(128),
+  CC_HIGHEST_TXN_ID bigint,
+  CC_META_INFO bytea,
+  CC_HADOOP_JOB_ID varchar(32)
+);
+
+CREATE TABLE AUX_TABLE (
+  MT_KEY1 varchar(128) NOT NULL,
+  MT_KEY2 bigint NOT NULL,
+  MT_COMMENT varchar(255),
+  PRIMARY KEY(MT_KEY1, MT_KEY2)
+);
+
+

http://git-wip-us.apache.org/repos/asf/hive/blob/92072ad2/metastore/scripts/upgrade/postgres/upgrade-1.2.0-to-1.3.0.postgres.sql
----------------------------------------------------------------------
diff --git a/metastore/scripts/upgrade/postgres/upgrade-1.2.0-to-1.3.0.postgres.sql b/metastore/scripts/upgrade/postgres/upgrade-1.2.0-to-1.3.0.postgres.sql
index cdd3792..6b4123b 100644
--- a/metastore/scripts/upgrade/postgres/upgrade-1.2.0-to-1.3.0.postgres.sql
+++ b/metastore/scripts/upgrade/postgres/upgrade-1.2.0-to-1.3.0.postgres.sql
@@ -1,5 +1,15 @@
 SELECT 'Upgrading MetaStore schema from 1.2.0 to 1.3.0';
 
+\i 022-HIVE-12807.postgres.sql;
+\i 023-HIVE-12814.postgres.sql;
+\i 024-HIVE-12816.postgres.sql;
+\i 025-HIVE-12818.postgres.sql;
+\i 026-HIVE-12819.postgres.sql;
+\i 027-HIVE-12821.postgres.sql;
+\i 028-HIVE-12822.postgres.sql;
+\i 029-HIVE-12823.postgres.sql;
+\i 030-HIVE-12831.postgres.sql;
+\i 031-HIVE-12832.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';