private void cancelDelegationToken() throws HiveSQLException { if (hmsDelegationTokenStr != null) { try { Hive.get(getHiveConf()).cancelDelegationToken(hmsDelegationTokenStr); hmsDelegationTokenStr = null; getHiveConf().setVar(HiveConf.ConfVars.METASTORE_TOKEN_SIGNATURE, ""); } catch (HiveException e) { throw new HiveSQLException("Couldn't cancel delegation token", e); } } }
/** * Enable delegation token for the session * save the token string and set the token.signature in hive conf. The metastore client uses * this token.signature to determine where to use kerberos or delegation token * @throws HiveException * @throws IOException */ private void setDelegationToken(String hmsDelegationTokenStr) throws HiveSQLException { this.hmsDelegationTokenStr = hmsDelegationTokenStr; if (hmsDelegationTokenStr != null) { getHiveConf().setVar(HiveConf.ConfVars.METASTORE_TOKEN_SIGNATURE, HS2TOKEN); try { SessionUtils.setTokenStr(sessionUgi, hmsDelegationTokenStr, HS2TOKEN); } catch (IOException e) { throw new HiveSQLException("Couldn't setup delegation token in the ugi: " + e, e); } } }
private IMetaStoreClient getMetaStoreClient(boolean retryInCaseOfTokenExpiration) throws HiveSQLException { try { return Hive.get(getHiveConf()).getMSC(); } catch (HiveException e) { throw new HiveSQLException("Failed to get metastore connection: " + e, e); } catch(MetaException e1) { if (hmsDelegationTokenStr != null && retryInCaseOfTokenExpiration) { LOG.info("Retrying failed metastore connection: " + e1, e1); Hive.closeCurrent(); try { setDelegationToken(Hive.get(getHiveConf()).getDelegationToken(sessionUgi.getUserName(), getUserName())); } catch (HiveException e2) { throw new HiveSQLException("Error connect metastore to setup impersonation: " + e2, e2); } return getMetaStoreClient(false); } else { throw new HiveSQLException("Failed to get metastore connection: " + e1, e1); } } }
private void cancelDelegationToken() throws HiveSQLException { if (hmsDelegationTokenStr != null) { try { Hive.get(getHiveConf()).cancelDelegationToken(hmsDelegationTokenStr); hmsDelegationTokenStr = null; getHiveConf().setVar(HiveConf.ConfVars.METASTORE_TOKEN_SIGNATURE, ""); } catch (HiveException e) { throw new HiveSQLException("Couldn't cancel delegation token", e); } } }
/** * Enable delegation token for the session * save the token string and set the token.signature in hive conf. The metastore client uses * this token.signature to determine where to use kerberos or delegation token * @throws HiveException * @throws IOException */ private void setDelegationToken(String hmsDelegationTokenStr) throws HiveSQLException { this.hmsDelegationTokenStr = hmsDelegationTokenStr; if (hmsDelegationTokenStr != null) { getHiveConf().setVar(HiveConf.ConfVars.METASTORE_TOKEN_SIGNATURE, HS2TOKEN); try { SessionUtils.setTokenStr(sessionUgi, hmsDelegationTokenStr, HS2TOKEN); } catch (IOException e) { throw new HiveSQLException("Couldn't setup delegation token in the ugi: " + e, e); } } }
/** * Enable delegation token for the session * save the token string and set the token.signature in hive conf. The metastore client uses * this token.signature to determine where to use kerberos or delegation token * @throws HiveException * @throws IOException */ private void setDelegationToken(String delegationTokenStr) throws HiveSQLException { this.delegationTokenStr = delegationTokenStr; if (delegationTokenStr != null) { getHiveConf().set("hive.metastore.token.signature", HS2TOKEN); try { Utils.setTokenStr(sessionUgi, delegationTokenStr, HS2TOKEN); } catch (IOException e) { throw new HiveSQLException("Couldn't setup delegation token in the ugi", e); } } }
/** * Enable delegation token for the session * save the token string and set the token.signature in hive conf. The metastore client uses * this token.signature to determine where to use kerberos or delegation token * @throws HiveException * @throws IOException */ private void setDelegationToken(String delegationTokenStr) throws HiveSQLException { this.delegationTokenStr = delegationTokenStr; if (delegationTokenStr != null) { getHiveConf().set("hive.metastore.token.signature", HS2TOKEN); try { Utils.setTokenStr(sessionUgi, delegationTokenStr, HS2TOKEN); } catch (IOException e) { throw new HiveSQLException("Couldn't setup delegation token in the ugi", e); } } }
/** * Enable delegation token for the session * save the token string and set the token.signature in hive conf. The metastore client uses * this token.signature to determine where to use kerberos or delegation token * @throws HiveException * @throws IOException */ private void setDelegationToken(String delegationTokenStr) throws HiveSQLException { this.delegationTokenStr = delegationTokenStr; if (delegationTokenStr != null) { getHiveConf().set("hive.metastore.token.signature", HS2TOKEN); try { Utils.setTokenStr(sessionUgi, delegationTokenStr, HS2TOKEN); } catch (IOException e) { throw new HiveSQLException("Couldn't setup delegation token in the ugi", e); } } }
/** * Enable delegation token for the session * save the token string and set the token.signature in hive conf. The metastore client uses * this token.signature to determine where to use kerberos or delegation token * @throws HiveException * @throws IOException */ private void setDelegationToken(String delegationTokenStr) throws HiveSQLException { this.delegationTokenStr = delegationTokenStr; if (delegationTokenStr != null) { getHiveConf().set("hive.metastore.token.signature", HS2TOKEN); try { Utils.setTokenStr(sessionUgi, delegationTokenStr, HS2TOKEN); } catch (IOException e) { throw new HiveSQLException("Couldn't setup delegation token in the ugi", e); } } }
private void cancelDelegationToken() throws HiveSQLException { if (delegationTokenStr != null) { try { Hive.get(getHiveConf()).cancelDelegationToken(delegationTokenStr); } catch (HiveException e) { throw new HiveSQLException("Couldn't cancel delegation token", e); } // close the metastore connection created with this delegation token Hive.closeCurrent(); } }
private void cancelDelegationToken() throws HiveSQLException { if (delegationTokenStr != null) { try { Hive.get(getHiveConf()).cancelDelegationToken(delegationTokenStr); } catch (HiveException e) { throw new HiveSQLException("Couldn't cancel delegation token", e); } // close the metastore connection created with this delegation token Hive.closeCurrent(); } }
private void cancelDelegationToken() throws HiveSQLException { if (delegationTokenStr != null) { try { Hive.get(getHiveConf()).cancelDelegationToken(delegationTokenStr); } catch (HiveException e) { throw new HiveSQLException("Couldn't cancel delegation token", e); } // close the metastore connection created with this delegation token Hive.closeCurrent(); } }
private void cancelDelegationToken() throws HiveSQLException { if (delegationTokenStr != null) { try { Hive.get(getHiveConf()).cancelDelegationToken(delegationTokenStr); } catch (HiveException e) { throw new HiveSQLException("Couldn't cancel delegation token", e); } // close the metastore connection created with this delegation token Hive.closeCurrent(); } }
private IMetaStoreClient getMetaStoreClient(boolean retryInCaseOfTokenExpiration) throws HiveSQLException { try { return Hive.get(getHiveConf()).getMSC(); } catch (HiveException e) { throw new HiveSQLException("Failed to get metastore connection: " + e, e); } catch(MetaException e1) { if (hmsDelegationTokenStr != null && retryInCaseOfTokenExpiration) { LOG.info("Retrying failed metastore connection: " + e1, e1); Hive.closeCurrent(); try { setDelegationToken(Hive.get(getHiveConf()).getDelegationToken(sessionUgi.getUserName(), getUserName())); } catch (HiveException e2) { throw new HiveSQLException("Error connect metastore to setup impersonation: " + e2, e2); } return getMetaStoreClient(false); } else { throw new HiveSQLException("Failed to get metastore connection: " + e1, e1); } } }
public HiveSessionImplwithUGI(TProtocolVersion protocol, String username, String password, HiveConf hiveConf, String ipAddress, String delegationToken) throws HiveSQLException { super(protocol, username, password, hiveConf, ipAddress); setSessionUGI(username); setDelegationToken(delegationToken); // create a new metastore connection for this particular user session Hive.set(null); try { sessionHive = Hive.get(getHiveConf()); } catch (HiveException e) { throw new HiveSQLException("Failed to setup metastore connection", e); } }
public HiveSessionImplwithUGI(TProtocolVersion protocol, String username, String password, HiveConf hiveConf, String ipAddress, String delegationToken) throws HiveSQLException { super(protocol, username, password, hiveConf, ipAddress); setSessionUGI(username); setDelegationToken(delegationToken); // create a new metastore connection for this particular user session Hive.set(null); try { sessionHive = Hive.get(getHiveConf()); } catch (HiveException e) { throw new HiveSQLException("Failed to setup metastore connection", e); } }
public HiveSessionImplwithUGI(TProtocolVersion protocol, String username, String password, HiveConf hiveConf, String ipAddress, String delegationToken) throws HiveSQLException { super(protocol, username, password, hiveConf, ipAddress); setSessionUGI(username); setDelegationToken(delegationToken); // create a new metastore connection for this particular user session Hive.set(null); try { sessionHive = Hive.get(getHiveConf()); } catch (HiveException e) { throw new HiveSQLException("Failed to setup metastore connection", e); } }
public HiveSessionImplwithUGI(TProtocolVersion protocol, String username, String password, HiveConf hiveConf, String ipAddress, String delegationToken) throws HiveSQLException { super(protocol, username, password, hiveConf, ipAddress); setSessionUGI(username); setDelegationToken(delegationToken); // create a new metastore connection for this particular user session Hive.set(null); try { sessionHive = Hive.get(getHiveConf()); } catch (HiveException e) { throw new HiveSQLException("Failed to setup metastore connection", e); } }