You are viewing a plain text version of this content. The canonical link for it is here.
Posted to gitbox@hive.apache.org by "deniskuzZ (via GitHub)" <gi...@apache.org> on 2023/05/03 09:13:41 UTC

[GitHub] [hive] deniskuzZ commented on a diff in pull request #1834: HIVE-24515 : Analyze table job can be skipped when stats populated are already accurate.

deniskuzZ commented on code in PR #1834:
URL: https://github.com/apache/hive/pull/1834#discussion_r570556176


##########
standalone-metastore/metastore-server/src/main/java/org/apache/hadoop/hive/metastore/txn/TxnHandler.java:
##########
@@ -4797,6 +4800,84 @@ private void heartbeatTxn(Connection dbConn, long txnid)
     }
   }
 
+  private boolean foundCommittedTransaction(Connection dbConn, long txnId, FindStatStatusByWriteIdRequest rqst,
+                                           String condition) throws SQLException, MetaException {
+    String s = sqlGenerator.addLimitClause(1,
+            "1 FROM \"COMPLETED_TXN_COMPONENTS\" WHERE \"CTC_TXNID\" " + condition + " " + txnId +
+                    " AND \"CTC_DATABASE\" = ? AND \"CTC_TABLE\" = ?");

Review Comment:
   You do not need db and table filters as txnid is unique across them, see findTxnState(). Same query is duplicated in many other places like getCommittedTxns(), see if you could extract it. 



-- 
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.

To unsubscribe, e-mail: gitbox-unsubscribe@hive.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: gitbox-unsubscribe@hive.apache.org
For additional commands, e-mail: gitbox-help@hive.apache.org