[ 
https://issues.apache.org/jira/browse/HIVE-25037?focusedWorklogId=590918&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-590918
 ]

ASF GitHub Bot logged work on HIVE-25037:
-----------------------------------------

                Author: ASF GitHub Bot
            Created on: 29/Apr/21 10:31
            Start Date: 29/Apr/21 10:31
    Worklog Time Spent: 10m 
      Work Description: asinkovits commented on a change in pull request #2199:
URL: https://github.com/apache/hive/pull/2199#discussion_r622925033



##########
File path: 
standalone-metastore/metastore-server/src/main/java/org/apache/hadoop/hive/metastore/txn/TxnHandler.java
##########
@@ -290,7 +290,11 @@
         TxnStatus.OPEN + "') \"T\" CROSS JOIN (" +
       "SELECT COUNT(*), MIN(\"TXN_ID\"), ({0} - MIN(\"TXN_STARTED\"))/1000 
FROM \"TXNS\" WHERE \"TXN_STATE\"='" +
         TxnStatus.ABORTED + "') \"A\" CROSS JOIN (" +
-      "SELECT COUNT(*), ({0} - MIN(\"HL_ACQUIRED_AT\"))/1000 FROM 
\"HIVE_LOCKS\") \"HL\"";
+      "SELECT COUNT(*), ({0} - MIN(\"HL_ACQUIRED_AT\"))/1000 FROM 
\"HIVE_LOCKS\") \"HL\" CROSS JOIN (" +
+      "SELECT COUNT(*) FROM (SELECT COUNT(\"TXN_ID\"), \"T2W_DATABASE\", 
\"T2W_TABLE\" FROM \"TXN_TO_WRITE_ID\" " +
+          "INNER JOIN \"TXNS\" ON \"T2W_TXNID\" = \"TXN_ID\" WHERE 
\"TXN_STATE\"='" + TxnStatus.ABORTED + "' " +
+          "GROUP BY \"T2W_DATABASE\", \"T2W_TABLE\" HAVING COUNT(\"TXN_ID\") > 
?) \"L\") \"L\"";

Review comment:
       I've double checked having seems to be fine in all 5 databases.

##########
File path: 
standalone-metastore/metastore-server/src/main/java/org/apache/hadoop/hive/metastore/txn/TxnHandler.java
##########
@@ -3739,34 +3743,34 @@ public GetLatestCommittedCompactionInfoResponse 
getLatestCommittedCompactionInfo
 
   public MetricsInfo getMetricsInfo() throws MetaException {
     Connection dbConn = null;
-    Statement stmt = null;
     try {
       MetricsInfo metrics = new MetricsInfo();
       String s = MessageFormat.format(SELECT_METRICS_INFO_QUERY, 
getEpochFn(dbProduct));

Review comment:
       I've checked this, and it seems that prepared statements cannot handle 
complex queries getEpochFn returns. In case of oracle for example: 
"(cast(systimestamp at time zone 'UTC' as date) - date 
'1970-01-01')*24*60*60*1000 + cast(mod( extract( second from systimestamp ), 1 
) * 1000 as int)"
   
   
https://github.com/apache/hive/blob/master/standalone-metastore/metastore-server/src/main/java/org/apache/hadoop/hive/metastore/DatabaseProduct.java#L258
   




-- 
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:
us...@infra.apache.org


Issue Time Tracking
-------------------

    Worklog Id:     (was: 590918)
    Time Spent: 0.5h  (was: 20m)

> Create metric: Number of tables with > x aborts
> -----------------------------------------------
>
>                 Key: HIVE-25037
>                 URL: https://issues.apache.org/jira/browse/HIVE-25037
>             Project: Hive
>          Issue Type: Sub-task
>            Reporter: Antal Sinkovits
>            Assignee: Antal Sinkovits
>            Priority: Major
>              Labels: pull-request-available
>          Time Spent: 0.5h
>  Remaining Estimate: 0h
>
> Create metric about number of tables with > x aborts.
> x should be settable and default to 1500.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to