Uploaded image for project: 'Hive'
  1. Hive
  2. HIVE-9622

Getting NPE when trying to restart HS2 when metastore is configured to use org.apache.hadoop.hive.thrift.DBTokenStore

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 0.13.0, 0.13.1, 0.14.0, 1.0.0, 1.1.0, 1.1.1
    • 1.0.2, 1.2.0
    • None

    Description

      1. Configure the cluster to use kerberos for HS2 and Metastore.
        1. http://www.cloudera.com/content/cloudera/en/documentation/cdh4/v4-3-0/CDH4-Security-Guide/cdh4sg_topic_9_1.html
        2. http://www.cloudera.com/content/cloudera/en/documentation/cdh4/v4-6-0/CDH4-Security-Guide/cdh4sg_topic_9_2.html
      2. Set hive metastore delegation token to org.apache.hadoop.hive.thrift.DBTokenStore in hive-site.xml
        <property>
             <name>hive.cluster.delegation.token.store.class&lt;/name>
             <value>org.apache.hadoop.hive.thrift.DBTokenStore</value>
        </property>
        
      3. Then trying to restart hive service, HS2 fails to start the NPE below:
        9:43:10.711 AM	ERROR	org.apache.hive.service.cli.thrift.ThriftCLIService	
        Error: 
        org.apache.thrift.transport.TTransportException: Failed to start token manager
        	at org.apache.hive.service.auth.HiveAuthFactory.<init>(HiveAuthFactory.java:107)
        	at org.apache.hive.service.cli.thrift.ThriftBinaryCLIService.run(ThriftBinaryCLIService.java:51)
        	at java.lang.Thread.run(Thread.java:745)
        Caused by: java.io.IOException: Failed to initialize master key
        	at org.apache.hadoop.hive.thrift.TokenStoreDelegationTokenSecretManager.startThreads(TokenStoreDelegationTokenSecretManager.java:223)
        	at org.apache.hadoop.hive.thrift.HadoopThriftAuthBridge20S$Server.startDelegationTokenSecretManager(HadoopThriftAuthBridge20S.java:438)
        	at org.apache.hive.service.auth.HiveAuthFactory.<init>(HiveAuthFactory.java:105)
        	... 2 more
        Caused by: java.lang.reflect.InvocationTargetException
        	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:483)
        	at org.apache.hadoop.hive.thrift.TokenStoreDelegationTokenSecretManager.startThreads(TokenStoreDelegationTokenSecretManager.java:221)
        	... 4 more
        Caused by: java.lang.NullPointerException
        	at org.apache.hadoop.hive.thrift.DBTokenStore.invokeOnRawStore(DBTokenStore.java:145)
        	at org.apache.hadoop.hive.thrift.DBTokenStore.addMasterKey(DBTokenStore.java:41)
        	at org.apache.hadoop.hive.thrift.TokenStoreDelegationTokenSecretManager.logUpdateMasterKey(TokenStoreDelegationTokenSecretManager.java:203)
        	at org.apache.hadoop.security.token.delegation.AbstractDelegationTokenSecretManager.updateCurrentKey(AbstractDelegationTokenSecretManager.java:339)
        	... 9 more
        9:43:10.719 AM	INFO	org.apache.hive.service.server.HiveServer2	
        SHUTDOWN_MSG: 
        /************************************************************
        SHUTDOWN_MSG: Shutting down HiveServer2 at a1909.halxg.cloudera.com/10.20.202.109
        ************************************************************/
        

      The problem appears that we didn't pass a RawStore object in the following:

      https://github.com/apache/hive/blob/trunk/service/src/java/org/apache/hive/service/auth/HiveAuthFactory.java#L111

      Attachments

        1. HIVE-9622.1.patch
          2 kB
          Aihua Xu
        2. HIVE-9622.2.patch
          5 kB
          Aihua Xu
        3. HIVE-9622.patch.branch-1.0
          5 kB
          Jason Dere

        Activity

          People

            aihuaxu Aihua Xu
            aihuaxu Aihua Xu
            Votes:
            0 Vote for this issue
            Watchers:
            9 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: