kudu-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From aw...@apache.org
Subject [kudu] branch master updated: hms plugin: don't expect table type
Date Sun, 26 May 2019 18:48:25 GMT
This is an automated email from the ASF dual-hosted git repository.

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


The following commit(s) were added to refs/heads/master by this push:
     new de12c3d  hms plugin: don't expect table type
de12c3d is described below

commit de12c3da9de4251fb1380560964954a98286e4aa
Author: Andrew Wong <awong@apache.org>
AuthorDate: Fri May 24 00:16:00 2019 -0700

    hms plugin: don't expect table type
    
    While the HMS Thrift client will enforce a table type to be present,
    it's still possible for an HMS to create such a table. This resulted in
    a NPE in the Kudu HMS plugin:
    
    2019-05-23 01:02:31,014 INFO  org.apache.hadoop.hive.metastore.HiveMetaStore.audit: [pool-14-thread-25]:
ugi=hue  ip=10.65.28.176  cmd=source:10.65.28.176 create_table: Table(tableName:CM_TEST_TABLE,
dbName:cloudera_manager_metastore_canary_test_db_hive_1_hivemetastore_86b8275f9909af198bdf2a65e6fd501b,
owner:null, createTime:0, lastAccessTime:0, retention:0, sd:StorageDescriptor(cols:[FieldSchema(name:s,
type:string, comment:test string), FieldSchema(name:f, type:float, comment:test f [...]
    ... // note the null table type
    2019-05-23 01:02:31,117 ERROR org.apache.hadoop.hive.metastore.RetryingHMSHandler: [pool-14-thread-25]:
MetaException(message:java.lang.NullPointerException)
      at org.apache.hadoop.hive.metastore.HiveMetaStore$HMSHandler.newMetaException(HiveMetaStore.java:6236)
      at org.apache.hadoop.hive.metastore.HiveMetaStore$HMSHandler.create_table_with_environment_context(HiveMetaStore.java:1629)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      at java.lang.reflect.Method.invoke(Method.java:498)
      at org.apache.hadoop.hive.metastore.RetryingHMSHandler.invokeInternal(RetryingHMSHandler.java:140)
      at org.apache.hadoop.hive.metastore.RetryingHMSHandler.invoke(RetryingHMSHandler.java:99)
      at com.sun.proxy.$Proxy32.create_table_with_environment_context(Unknown Source)
      at org.apache.hadoop.hive.metastore.api.ThriftHiveMetastore$Processor$create_table_with_environment_context.getResult(ThriftHiveMetastore.java:10993)
      at org.apache.hadoop.hive.metastore.api.ThriftHiveMetastore$Processor$create_table_with_environment_context.getResult(ThriftHiveMetastore.java:10977)
      at org.apache.thrift.ProcessFunction.process(ProcessFunction.java:39)
      at org.apache.hadoop.hive.metastore.TUGIBasedProcessor$1.run(TUGIBasedProcessor.java:110)
      at org.apache.hadoop.hive.metastore.TUGIBasedProcessor$1.run(TUGIBasedProcessor.java:106)
      at java.security.AccessController.doPrivileged(Native Method)
      at javax.security.auth.Subject.doAs(Subject.java:422)
      at org.apache.hadoop.security.UserGroupInformation.doAs(UserGroupInformation.java:1875)
      at org.apache.hadoop.hive.metastore.TUGIBasedProcessor.process(TUGIBasedProcessor.java:118)
      at org.apache.thrift.server.TThreadPoolServer$WorkerProcess.run(TThreadPoolServer.java:286)
      at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
      at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
      at java.lang.Thread.run(Thread.java:748)
    Caused by: java.lang.NullPointerException
      at org.apache.kudu.hive.metastore.KuduMetastorePlugin.onCreateTable(KuduMetastorePlugin.java:90)
      at org.apache.hadoop.hive.metastore.MetaStoreListenerNotifier$13.notify(MetaStoreListenerNotifier.java:76)
      at org.apache.hadoop.hive.metastore.MetaStoreListenerNotifier.notifyEvent(MetaStoreListenerNotifier.java:175)
      at org.apache.hadoop.hive.metastore.MetaStoreListenerNotifier.notifyEvent(MetaStoreListenerNotifier.java:205)
      at org.apache.hadoop.hive.metastore.HiveMetaStore$HMSHandler.create_table_core(HiveMetaStore.java:1576)
      at org.apache.hadoop.hive.metastore.HiveMetaStore$HMSHandler.create_table_with_environment_context(HiveMetaStore.java:1615)
      ... 20 more
    
    This patch handles this by not dereferencing the pointers to check table type.
    
    Change-Id: If76533a94f6ef2ae135af4bd441fc2652a6a5dda
    Reviewed-on: http://gerrit.cloudera.org:8080/13424
    Tested-by: Kudu Jenkins
    Reviewed-by: Hao Hao <hao.hao@cloudera.com>
---
 .../kudu/hive/metastore/KuduMetastorePlugin.java       | 18 +++++++++---------
 1 file changed, 9 insertions(+), 9 deletions(-)

diff --git a/java/kudu-hive/src/main/java/org/apache/kudu/hive/metastore/KuduMetastorePlugin.java
b/java/kudu-hive/src/main/java/org/apache/kudu/hive/metastore/KuduMetastorePlugin.java
index b508c27..c36bc8e 100644
--- a/java/kudu-hive/src/main/java/org/apache/kudu/hive/metastore/KuduMetastorePlugin.java
+++ b/java/kudu-hive/src/main/java/org/apache/kudu/hive/metastore/KuduMetastorePlugin.java
@@ -96,9 +96,8 @@ public class KuduMetastorePlugin extends MetaStoreEventListener {
 
     Table table = tableEvent.getTable();
 
-    // Only validate managed tables.
-    // Kudu only synchronizes managed tables.
-    if (!table.getTableType().equals(TableType.MANAGED_TABLE.name())) {
+    // Only validate managed tables. Kudu only synchronizes managed tables.
+    if (!TableType.MANAGED_TABLE.name().equals(table.getTableType())) {
       return;
     }
 
@@ -121,13 +120,12 @@ public class KuduMetastorePlugin extends MetaStoreEventListener {
     super.onDropTable(tableEvent);
     Table table = tableEvent.getTable();
 
-    // Only validate managed tables.
-    // Kudu only synchronizes managed tables.
-    if (!table.getTableType().equals(TableType.MANAGED_TABLE.name())) {
+    if (skipsValidation()) {
       return;
     }
 
-    if (skipsValidation()) {
+    // Only validate managed tables. Kudu only synchronizes managed tables.
+    if (!TableType.MANAGED_TABLE.name().equals(table.getTableType())) {
       return;
     }
 
@@ -172,13 +170,15 @@ public class KuduMetastorePlugin extends MetaStoreEventListener {
     // Note: This doesn't prevent altering the table type for legacy tables
     // because they should continue to work as they always have primarily for
     // migration purposes.
-    if (isKuduTable(oldTable) && !oldTable.getTableType().equals(newTable.getTableType()))
{
+    String oldTableType = oldTable.getTableType();
+    if (isKuduTable(oldTable) &&
+        oldTableType != null && !oldTableType.equals(newTable.getTableType())) {
       throw new MetaException("Kudu table type may not be altered");
     }
 
     // Only validate managed tables.
     // Kudu only synchronizes managed tables.
-    if (!oldTable.getTableType().equals(TableType.MANAGED_TABLE.name())) {
+    if (!TableType.MANAGED_TABLE.name().equals(oldTableType)) {
       return;
     }
 


Mime
View raw message