deniskuzZ commented on a change in pull request #1688:
URL: https://github.com/apache/hive/pull/1688#discussion_r530253708
##########
File path:
standalone-metastore/metastore-server/src/main/java/org/apache/hadoop/hive/metastore/txn/TxnHandler.java
##########
@@ -5094,6 +5153,99 @@ public void countOpenTxns() throws MetaException {
}
}
+ /**
+ * Add min history level entry for each generated txn record
+ * @param dbConn Connection
+ * @param txnIds new transaction ids
+ * @deprecated Remove this method when min_history_level table is dropped
+ * @throws SQLException ex
+ */
+ @Deprecated
+ private void addTxnToMinHistoryLevel(Connection dbConn, List<Long> txnIds,
long minOpenTxnId) throws SQLException {
+ if (!useMinHistoryLevel) {
+ return;
+ }
+ // Need to register minimum open txnid for current transactions into
MIN_HISTORY table.
+ try (Statement stmt = dbConn.createStatement()) {
+
+ List<String> rows = txnIds.stream().map(txnId -> txnId + ", " +
minOpenTxnId).collect(Collectors.toList());
+
+ // Insert transaction entries into MIN_HISTORY_LEVEL.
+ List<String> inserts =
+ sqlGenerator.createInsertValuesStmt("\"MIN_HISTORY_LEVEL\"
(\"MHL_TXNID\", \"MHL_MIN_OPEN_TXNID\")", rows);
+ for (String insert : inserts) {
+ LOG.debug("Going to execute insert <" + insert + ">");
+ stmt.execute(insert);
+ }
+ LOG.info("Added entries to MIN_HISTORY_LEVEL for current txns: (" +
txnIds + ") with min_open_txn: " + minOpenTxnId);
+ } catch (SQLException e) {
+ if (dbProduct.isTableNotExists(e)) {
+ // If the table does not exists anymore, we disable the flag and start
to work the new way
+ // This enables to switch to the new functionality without a restart
+ useMinHistoryLevel = false;
Review comment:
Why is this needed? Are you covering the case that schema change is done
while old HMS is still running?
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]