You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@hive.apache.org by "ASF GitHub Bot (Jira)" <ji...@apache.org> on 2022/11/22 18:37:00 UTC

[jira] [Work logged] (HIVE-26767) Support for custom RDBMS is broken

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

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

                Author: ASF GitHub Bot
            Created on: 22/Nov/22 18:36
            Start Date: 22/Nov/22 18:36
    Worklog Time Spent: 10m 
      Work Description: tthorpeIBM commented on code in PR #3799:
URL: https://github.com/apache/hive/pull/3799#discussion_r1029699722


##########
standalone-metastore/metastore-server/src/main/java/org/apache/hadoop/hive/metastore/DatabaseProduct.java:
##########
@@ -77,8 +77,15 @@ public static DatabaseProduct determineDatabaseProduct(String productName,
       Configuration conf) {
     DbType dbt;
 
+    // Check if we are using an external database product
+    boolean isExternal = MetastoreConf.getBoolVar(conf, ConfVars.USE_CUSTOM_RDBMS);
+
     if (theDatabaseProduct != null) {
-      Preconditions.checkState(theDatabaseProduct.dbType == getDbType(productName));
+      dbt = getDbType(productName);
+      if (isExternal) {
+        dbt = DbType.CUSTOM;
+      }
+      Preconditions.checkState(theDatabaseProduct.dbType == dbt);

Review Comment:
   Which condition do you think would fail?





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

            Worklog Id:     (was: 828132)
    Remaining Estimate: 0h
            Time Spent: 10m

> Support for custom RDBMS is broken
> ----------------------------------
>
>                 Key: HIVE-26767
>                 URL: https://issues.apache.org/jira/browse/HIVE-26767
>             Project: Hive
>          Issue Type: Bug
>          Components: Metastore
>    Affects Versions: 4.0.0
>            Reporter: Tim Thorpe
>            Priority: Minor
>          Time Spent: 10m
>  Remaining Estimate: 0h
>
> HIVE-24120 introduced code to support custom RDBMS.
> DatabaseProduct.getDbType(String productName) will return *DbType.UNDEFINED* for anything other than the hardcoded/internally supported database types.
> When initializing DatabaseProduct with an external/custom RDBMS, it follows this logic:
>  
>         boolean isExternal = MetastoreConf.getBoolVar(conf, ConfVars.USE_CUSTOM_RDBMS);
>         if (isExternal) {
>           // The DatabaseProduct will be created by instantiating an external class via
>           // reflection. The external class can override any method in the current class
>           String className = MetastoreConf.getVar(conf, ConfVars.CUSTOM_RDBMS_CLASSNAME);
>           if (className != null) {
>             try {
>               theDatabaseProduct = (DatabaseProduct)
>                   ReflectionUtils.newInstance(Class.forName(className), conf);
>               LOG.info(String.format("Using custom RDBMS %s", className));
>               dbt = DbType.CUSTOM;
> These 2 database types (DbType.UNDEFINED, DbType.CUSTOM) are then compared to each other to make sure they are the same.
>  
> Preconditions.checkState(theDatabaseProduct.dbType == getDbType(productName));
>  
> [https://github.com/gatorblue/hive/blob/3a65c6cf9cb552e7c34bfb449a419abfde0a58b6/standalone-metastore/metastore-server/src/main/java/org/apache/hadoop/hive/metastore/DatabaseProduct.java#L80]
>  



--
This message was sent by Atlassian Jira
(v8.20.10#820010)