[ 
https://issues.apache.org/jira/browse/HIVE-13160?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15180333#comment-15180333
 ] 

Prasanth Jayachandran commented on HIVE-13160:
----------------------------------------------

[~aihuaxu] I have a setup that runs 1.2.0 version of HMS. Last week I was able 
to run latest 2.1.0-SNAPSHOT CLI client with 1.2.0 HMS. The thrift service of 
1.2.0 does not have get_all_functions interface. When the cli starts a session, 
it will internally invoke registerAllFunctionOnce which in turn calls 
getAllFunctions(). Since getAllFunctions() does not exist in old HMS it will 
throw an error which will be ignored. This will let CLI start (and Session) 
without any issues. With this patch registerAllFunctionOnce() throws exception 
will not be caught by the CLI and fails to start. This means that new clients 
cannot work with old HMS. Following is the full stacktrace

{code}
Exception in thread "main" java.lang.RuntimeException: 
org.apache.hadoop.hive.ql.metadata.HiveException: 
org.apache.hadoop.hive.ql.metadata.HiveException: 
org.apache.thrift.TApplicationException: Invalid method name: 
'get_all_functions'
at org.apache.hadoop.hive.ql.session.SessionState.start(SessionState.java:563)
at 
org.apache.hadoop.hive.ql.session.SessionState.beginStart(SessionState.java:503)
at org.apache.hadoop.hive.cli.CliDriver.run(CliDriver.java:709)
at org.apache.hadoop.hive.cli.CliDriver.main(CliDriver.java:645)
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:497)
at org.apache.hadoop.util.RunJar.run(RunJar.java:221)
at org.apache.hadoop.util.RunJar.main(RunJar.java:136)
Caused by: org.apache.hadoop.hive.ql.metadata.HiveException: 
org.apache.hadoop.hive.ql.metadata.HiveException: 
org.apache.thrift.TApplicationException: Invalid method name: 
'get_all_functions'
at 
org.apache.hadoop.hive.ql.metadata.Hive.registerAllFunctionsOnce(Hive.java:211)
at org.apache.hadoop.hive.ql.metadata.Hive.<init>(Hive.java:341)
at org.apache.hadoop.hive.ql.metadata.Hive.get(Hive.java:296)
at org.apache.hadoop.hive.ql.metadata.Hive.getInternal(Hive.java:266)
at org.apache.hadoop.hive.ql.metadata.Hive.get(Hive.java:251)
at org.apache.hadoop.hive.ql.session.SessionState.start(SessionState.java:530)
... 9 more
Caused by: org.apache.hadoop.hive.ql.metadata.HiveException: 
org.apache.thrift.TApplicationException: Invalid method name: 
'get_all_functions'
at org.apache.hadoop.hive.ql.metadata.Hive.getAllFunctions(Hive.java:3414)
at org.apache.hadoop.hive.ql.metadata.Hive.reloadFunctions(Hive.java:221)
at 
org.apache.hadoop.hive.ql.metadata.Hive.registerAllFunctionsOnce(Hive.java:206)
... 14 more
Caused by: org.apache.thrift.TApplicationException: Invalid method name: 
'get_all_functions'
at org.apache.thrift.TApplicationException.read(TApplicationException.java:111)
at org.apache.thrift.TServiceClient.receiveBase(TServiceClient.java:79)
at 
org.apache.hadoop.hive.metastore.api.ThriftHiveMetastore$Client.recv_get_all_functions(ThriftHiveMetastore.java:3490)
at 
org.apache.hadoop.hive.metastore.api.ThriftHiveMetastore$Client.get_all_functions(ThriftHiveMetastore.java:3478)
at 
org.apache.hadoop.hive.metastore.HiveMetaStoreClient.getAllFunctions(HiveMetaStoreClient.java:2172)
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:497)
at 
org.apache.hadoop.hive.metastore.RetryingMetaStoreClient.invoke(RetryingMetaStoreClient.java:153)
at com.sun.proxy.$Proxy28.getAllFunctions(Unknown Source)
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:497)
at 
org.apache.hadoop.hive.metastore.HiveMetaStoreClient$SynchronizedHandler.invoke(HiveMetaStoreClient.java:2109)
at com.sun.proxy.$Proxy28.getAllFunctions(Unknown Source)
at org.apache.hadoop.hive.ql.metadata.Hive.getAllFunctions(Hive.java:3411)
{code}

> HS2 unable to load UDFs on startup when HMS is not ready
> --------------------------------------------------------
>
>                 Key: HIVE-13160
>                 URL: https://issues.apache.org/jira/browse/HIVE-13160
>             Project: Hive
>          Issue Type: Bug
>          Components: HiveServer2
>    Affects Versions: 1.2.1
>            Reporter: Eric Lin
>            Assignee: Aihua Xu
>             Fix For: 2.1.0
>
>         Attachments: HIVE-13160.1.patch, HIVE-13160.2.patch
>
>
> The error looks like this:
> {code}
> 2016-02-18 14:43:54,251 INFO  hive.metastore: [main]: Trying to connect to 
> metastore with URI thrift://host-10-17-81-201.coe.cloudera.com:9083
> 2016-02-18 14:48:54,692 WARN  hive.metastore: [main]: Failed to connect to 
> the MetaStore Server...
> 2016-02-18 14:48:54,692 INFO  hive.metastore: [main]: Waiting 1 seconds 
> before next connection attempt.
> 2016-02-18 14:48:55,692 INFO  hive.metastore: [main]: Trying to connect to 
> metastore with URI thrift://host-10-17-81-201.coe.cloudera.com:9083
> 2016-02-18 14:53:55,800 WARN  hive.metastore: [main]: Failed to connect to 
> the MetaStore Server...
> 2016-02-18 14:53:55,800 INFO  hive.metastore: [main]: Waiting 1 seconds 
> before next connection attempt.
> 2016-02-18 14:53:56,801 INFO  hive.metastore: [main]: Trying to connect to 
> metastore with URI thrift://host-10-17-81-201.coe.cloudera.com:9083
> 2016-02-18 14:58:56,967 WARN  hive.metastore: [main]: Failed to connect to 
> the MetaStore Server...
> 2016-02-18 14:58:56,967 INFO  hive.metastore: [main]: Waiting 1 seconds 
> before next connection attempt.
> 2016-02-18 14:58:57,994 WARN  hive.ql.metadata.Hive: [main]: Failed to 
> register all functions.
> java.lang.RuntimeException: Unable to instantiate 
> org.apache.hadoop.hive.ql.metadata.SessionHiveMetaStoreClient
>         at 
> org.apache.hadoop.hive.metastore.MetaStoreUtils.newInstance(MetaStoreUtils.java:1492)
>         at 
> org.apache.hadoop.hive.metastore.RetryingMetaStoreClient.<init>(RetryingMetaStoreClient.java:64)
>         at 
> org.apache.hadoop.hive.metastore.RetryingMetaStoreClient.getProxy(RetryingMetaStoreClient.java:74)
>         at 
> org.apache.hadoop.hive.ql.metadata.Hive.createMetaStoreClient(Hive.java:2915)
> .......
> 016-02-18 14:58:57,997 INFO  hive.metastore: [main]: Trying to connect to 
> metastore with URI thrift://host-10-17-81-201.coe.cloudera.com:9083
> 2016-02-18 15:03:58,094 WARN  hive.metastore: [main]: Failed to connect to 
> the MetaStore Server...
> 2016-02-18 15:03:58,095 INFO  hive.metastore: [main]: Waiting 1 seconds 
> before next connection attempt.
> 2016-02-18 15:03:59,095 INFO  hive.metastore: [main]: Trying to connect to 
> metastore with URI thrift://host-10-17-81-201.coe.cloudera.com:9083
> 2016-02-18 15:08:59,203 WARN  hive.metastore: [main]: Failed to connect to 
> the MetaStore Server...
> 2016-02-18 15:08:59,203 INFO  hive.metastore: [main]: Waiting 1 seconds 
> before next connection attempt.
> 2016-02-18 15:09:00,203 INFO  hive.metastore: [main]: Trying to connect to 
> metastore with URI thrift://host-10-17-81-201.coe.cloudera.com:9083
> 2016-02-18 15:14:00,304 WARN  hive.metastore: [main]: Failed to connect to 
> the MetaStore Server...
> 2016-02-18 15:14:00,304 INFO  hive.metastore: [main]: Waiting 1 seconds 
> before next connection attempt.
> 2016-02-18 15:14:01,306 INFO  org.apache.hive.service.server.HiveServer2: 
> [main]: Shutting down HiveServer2
> 2016-02-18 15:14:01,308 INFO  org.apache.hive.service.server.HiveServer2: 
> [main]: Exception caught when calling stop of HiveServer2 before retrying 
> start
> java.lang.NullPointerException
>         at 
> org.apache.hive.service.server.HiveServer2.stop(HiveServer2.java:283)
>         at 
> org.apache.hive.service.server.HiveServer2.startHiveServer2(HiveServer2.java:351)
>         at 
> org.apache.hive.service.server.HiveServer2.access$400(HiveServer2.java:69)
>         at 
> org.apache.hive.service.server.HiveServer2$StartOptionExecutor.execute(HiveServer2.java:545)
> {code}
> And then none of the functions will be available for use as HS2 does not 
> re-register them after HMS is up and ready.
> This is not desired behaviour, we shouldn't allow HS2 to be in a servicing 
> state if function list is not ready. Or, maybe instead of initialize the 
> function list when HS2 starts, try to load the function list when each Hive 
> session is created. Of course we can have a cache of function list somewhere 
> for better performance, but we would better decouple it from class Hive.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to