You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hive.apache.org by kg...@apache.org on 2022/06/14 13:15:26 UTC

[hive] branch master updated: HIVE-25879: MetaStoreDirectSql test query should not query the whole DBS table (#3348) (Miklos Szurap reviewed by Zoltan Haindrich)

This is an automated email from the ASF dual-hosted git repository.

kgyrtkirk pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/hive.git


The following commit(s) were added to refs/heads/master by this push:
     new 4ce96653713 HIVE-25879: MetaStoreDirectSql test query should not query the whole DBS table (#3348) (Miklos Szurap reviewed by Zoltan Haindrich)
4ce96653713 is described below

commit 4ce96653713325570a83704d2e131e284acdfe65
Author: mszurap <ms...@gmail.com>
AuthorDate: Tue Jun 14 15:15:18 2022 +0200

    HIVE-25879: MetaStoreDirectSql test query should not query the whole DBS table (#3348) (Miklos Szurap reviewed by Zoltan Haindrich)
---
 .../java/org/apache/hadoop/hive/metastore/MetaStoreDirectSql.java    | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/standalone-metastore/metastore-server/src/main/java/org/apache/hadoop/hive/metastore/MetaStoreDirectSql.java b/standalone-metastore/metastore-server/src/main/java/org/apache/hadoop/hive/metastore/MetaStoreDirectSql.java
index d24128c9618..6be4c3f84a0 100644
--- a/standalone-metastore/metastore-server/src/main/java/org/apache/hadoop/hive/metastore/MetaStoreDirectSql.java
+++ b/standalone-metastore/metastore-server/src/main/java/org/apache/hadoop/hive/metastore/MetaStoreDirectSql.java
@@ -316,6 +316,7 @@ class MetaStoreDirectSql {
   }
 
   private boolean runTestQuery() {
+    boolean doTrace = LOG.isDebugEnabled();
     Transaction tx = pm.currentTransaction();
     boolean doCommit = false;
     if (!tx.isActive()) {
@@ -323,10 +324,12 @@ class MetaStoreDirectSql {
       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";
     try (QueryWrapper query = new QueryWrapper(pm.newQuery("javax.jdo.query.SQL", selfTestQuery))) {
       prepareTxn();
+      long start = doTrace ? System.nanoTime() : 0;
       query.execute();
+      MetastoreDirectSqlUtils.timingTrace(doTrace, selfTestQuery, start, doTrace ? System.nanoTime() : 0);
       return true;
     } catch (Throwable t) {
       doCommit = false;