wecharyu commented on code in PR #6464:
URL: https://github.com/apache/hive/pull/6464#discussion_r3215023864


##########
standalone-metastore/metastore-common/src/main/java/org/apache/hadoop/hive/metastore/conf/MetastoreConf.java:
##########
@@ -648,6 +648,13 @@ public enum ConfVars {
         "hive.txn.acid.metrics.delta.pct.threshold", 0.01f,
         "Percentage (fractional) size of the delta files relative to the base 
directory. Deltas smaller than this threshold " +
             "count as small deltas. Default 0.01 = 1%.)"),
+    
METASTORE_JDBC_SLOW_QUERIES("metastore.jdbc.execution.logSlowQueriesThreshold", 
"metastore.jdbc.execution.logSlowQueriesThreshold",

Review Comment:
   ```suggestion
       
METASTORE_JDBC_SLOW_QUERY_THRESHOLD("metastore.jdbc.execution.logSlowQueriesThreshold",
 "hive.metastore.jdbc.execution.logSlowQueriesThreshold",
   ```



##########
standalone-metastore/metastore-server/src/main/java/org/apache/hadoop/hive/metastore/datasource/DataSourceProvider.java:
##########
@@ -76,14 +84,58 @@ static String getMetastoreJdbcPasswd(Configuration conf) 
throws SQLException {
     }
   }
 
-  static String getMetastoreJdbcDriverUrl(Configuration conf) throws 
SQLException {
+  static String getMetastoreJdbcDriverUrl(Configuration conf) {
+    if (MetastoreConf.getBoolVar(conf, 
MetastoreConf.ConfVars.METASTORE_PROFILE_JDBC_EXECUTION)) {
+      return MetastoreDriver.getMetastoreDbUrl(conf);
+    }
     return MetastoreConf.getVar(conf, MetastoreConf.ConfVars.CONNECT_URL_KEY);
   }
 
+  static void addJdbcWrapperProperties(Configuration configuration, Properties 
properties)
+      throws SQLException {
+    if (MetastoreConf.getBoolVar(configuration, 
MetastoreConf.ConfVars.METASTORE_PROFILE_JDBC_EXECUTION)) {
+      try {
+        Configuration slimConf = new Configuration(false);
+        configuration.getPropsWithPrefix("metastore.jdbc.")

Review Comment:
   nit: make `"metastore.jdbc."` as a constant string like 
`METASTORE_CONF_PROPERTY`.



##########
standalone-metastore/metastore-server/src/main/java/org/apache/hadoop/hive/metastore/datasource/MetastoreConnection.java:
##########
@@ -0,0 +1,325 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.hadoop.hive.metastore.datasource;
+
+import java.sql.Array;
+import java.sql.Blob;
+import java.sql.CallableStatement;
+import java.sql.Clob;
+import java.sql.Connection;
+import java.sql.DatabaseMetaData;
+import java.sql.NClob;
+import java.sql.PreparedStatement;
+import java.sql.SQLClientInfoException;
+import java.sql.SQLException;
+import java.sql.SQLWarning;
+import java.sql.SQLXML;
+import java.sql.Savepoint;
+import java.sql.Statement;
+import java.sql.Struct;
+import java.util.Map;
+import java.util.Properties;
+import java.util.concurrent.Executor;
+
+import org.apache.hadoop.conf.Configuration;
+
+public record MetastoreConnection(Connection delegate, Configuration 
configuration) implements Connection {

Review Comment:
   Nit: `MetastoreConnection` is a stateful `Connection` wrapper, not a value 
object. A regular `final class` may be clearer than `record`, and avoids 
record-generated `equals/hashCode/toString` semantics.



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to