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

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

                Author: ASF GitHub Bot
            Created on: 08/Jun/22 08:32
            Start Date: 08/Jun/22 08:32
    Worklog Time Spent: 10m 
      Work Description: mszurap commented on code in PR #3348:
URL: https://github.com/apache/hive/pull/3348#discussion_r892075811


##########
standalone-metastore/metastore-server/src/main/java/org/apache/hadoop/hive/metastore/MetaStoreDirectSql.java:
##########
@@ -316,17 +316,20 @@ private boolean ensureDbInit() {
   }
 
   private boolean runTestQuery() {
+    boolean doTrace = LOG.isDebugEnabled();
     Transaction tx = pm.currentTransaction();
     boolean doCommit = false;
     if (!tx.isActive()) {
       tx.begin();
       doCommit = true;
     }
     // Run a self-test query. If it doesn't work, we will self-disable. What a 
PITA...
-    String selfTestQuery = "select \"DB_ID\" from " + DBS + "";
+    String selfTestQuery = "select \"DB_ID\" from " + DBS + " WHERE 
\"DB_ID\"=1";

Review Comment:
   Yes, the results do not matter at this part of the code. Actually I did not 
want to introduce RDBMS specific clauses like "LIMIT 0" (which is not 
recognized by Oracle for example), also the "WHERE 1=0" could be a valid 
"no-results" filter, but again, I do not know if all different DBs like that or 
not. 





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

    Worklog Id:     (was: 779356)
    Time Spent: 1h 20m  (was: 1h 10m)

> MetaStoreDirectSql test query should not query the whole DBS table
> ------------------------------------------------------------------
>
>                 Key: HIVE-25879
>                 URL: https://issues.apache.org/jira/browse/HIVE-25879
>             Project: Hive
>          Issue Type: Bug
>            Reporter: Miklos Szurap
>            Priority: Major
>              Labels: pull-request-available
>          Time Spent: 1h 20m
>  Remaining Estimate: 0h
>
> The runTestQuery() in the 
> org/apache/hadoop/hive/metastore/MetaStoreDirectSql.java is using a test query
> {code:java}
> select "DB_ID" from "DBS"{code}
> to determine whether the direct SQL can be used.
> With larger deployments with many (10k+) Hive databases it would be more 
> efficienct to query a small table instead, for example the "VERSION" table 
> should always have a single row only.



--
This message was sent by Atlassian Jira
(v8.20.7#820007)

Reply via email to