/** * Sets sessionHive object created based on sessionConf. * @throws HiveSQLException */ private void setSessionHive() throws HiveSQLException { Hive newSessionHive; try { newSessionHive = Hive.get(getHiveConf()); // HMS connections from sessionHive shouldn't be closed by any query execution thread when it // recreates the Hive object. It is allowed to be closed only when session is closed/released. newSessionHive.setAllowClose(false); } catch (HiveException e) { throw new HiveSQLException("Failed to get metastore connection", e); } // The previous sessionHive object might still be referred by any async query execution thread. // So, it shouldn't be closed here explicitly. Anyways, Hive object will auto-close HMS connection // when it is garbage collected. So, it is safe to just overwrite sessionHive here. sessionHive = newSessionHive; }
@Override public void cancelDelegationToken(HiveAuthFactory authFactory, String tokenStr) throws HiveSQLException { HiveAuthFactory.verifyProxyAccess(getUserName(), getUserFromToken(authFactory, tokenStr), getIpAddress(), getHiveConf()); authFactory.cancelDelegationToken(tokenStr); }
@Override public String getDelegationToken(HiveAuthFactory authFactory, String owner, String renewer) throws HiveSQLException { HiveAuthFactory.verifyProxyAccess(getUserName(), owner, getIpAddress(), getHiveConf()); return authFactory.getDelegationToken(owner, renewer, getIpAddress()); }
@Override public void renewDelegationToken(HiveAuthFactory authFactory, String tokenStr) throws HiveSQLException { HiveAuthFactory.verifyProxyAccess(getUserName(), getUserFromToken(authFactory, tokenStr), getIpAddress(), getHiveConf()); authFactory.renewDelegationToken(tokenStr); }
@Override public IMetaStoreClient getMetaStoreClient() throws HiveSQLException { try { return Hive.get(getHiveConf()).getMSC(); } catch (HiveException e) { throw new HiveSQLException("Failed to get metastore connection", e); } catch (MetaException e) { throw new HiveSQLException("Failed to get metastore connection", e); } }
@Override public String getDelegationToken(HiveAuthFactory authFactory, String owner, String renewer) throws HiveSQLException { HiveAuthFactory.verifyProxyAccess(getUsername(), owner, getIpAddress(), getHiveConf()); return authFactory.getDelegationToken(owner, renewer); }
@Override public IMetaStoreClient getMetaStoreClient() throws HiveSQLException { try { return Hive.get(getHiveConf()).getMSC(); } catch (HiveException e) { throw new HiveSQLException("Failed to get metastore connection", e); } catch (MetaException e) { throw new HiveSQLException("Failed to get metastore connection", e); } }
@Override public String getDelegationToken(HiveAuthFactory authFactory, String owner, String renewer) throws HiveSQLException { HiveAuthFactory.verifyProxyAccess(getUsername(), owner, getIpAddress(), getHiveConf()); return authFactory.getDelegationToken(owner, renewer); }
@Override public String getDelegationToken(HiveAuthFactory authFactory, String owner, String renewer) throws HiveSQLException { HiveAuthFactory.verifyProxyAccess(getUsername(), owner, getIpAddress(), getHiveConf()); return authFactory.getDelegationToken(owner, renewer); }
@Override public IMetaStoreClient getMetaStoreClient() throws HiveSQLException { try { return Hive.get(getHiveConf()).getMSC(); } catch (HiveException e) { throw new HiveSQLException("Failed to get metastore connection", e); } catch (MetaException e) { throw new HiveSQLException("Failed to get metastore connection", e); } }
@Override public void cancelDelegationToken(HiveAuthFactory authFactory, String tokenStr) throws HiveSQLException { HiveAuthFactory.verifyProxyAccess(getUsername(), getUserFromToken(authFactory, tokenStr), getIpAddress(), getHiveConf()); authFactory.cancelDelegationToken(tokenStr); }
@Override public void renewDelegationToken(HiveAuthFactory authFactory, String tokenStr) throws HiveSQLException { HiveAuthFactory.verifyProxyAccess(getUsername(), getUserFromToken(authFactory, tokenStr), getIpAddress(), getHiveConf()); authFactory.renewDelegationToken(tokenStr); }
@Override public String getDelegationToken(HiveAuthFactory authFactory, String owner, String renewer) throws HiveSQLException { HiveAuthFactory.verifyProxyAccess(getUserName(), owner, getIpAddress(), getHiveConf()); return authFactory.getDelegationToken(owner, renewer, getIpAddress()); }
@Override public void renewDelegationToken(HiveAuthFactory authFactory, String tokenStr) throws HiveSQLException { HiveAuthFactory.verifyProxyAccess(getUsername(), getUserFromToken(authFactory, tokenStr), getIpAddress(), getHiveConf()); authFactory.renewDelegationToken(tokenStr); }
@Override public void cancelDelegationToken(HiveAuthFactory authFactory, String tokenStr) throws HiveSQLException { HiveAuthFactory.verifyProxyAccess(getUsername(), getUserFromToken(authFactory, tokenStr), getIpAddress(), getHiveConf()); authFactory.cancelDelegationToken(tokenStr); }
@Override public void cancelDelegationToken(HiveAuthFactory authFactory, String tokenStr) throws HiveSQLException { HiveAuthFactory.verifyProxyAccess(getUserName(), getUserFromToken(authFactory, tokenStr), getIpAddress(), getHiveConf()); authFactory.cancelDelegationToken(tokenStr); }
@Override public void renewDelegationToken(HiveAuthFactory authFactory, String tokenStr) throws HiveSQLException { HiveAuthFactory.verifyProxyAccess(getUserName(), getUserFromToken(authFactory, tokenStr), getIpAddress(), getHiveConf()); authFactory.renewDelegationToken(tokenStr); }
@Override public void cancelDelegationToken(HiveAuthFactory authFactory, String tokenStr) throws HiveSQLException { HiveAuthFactory.verifyProxyAccess(getUsername(), getUserFromToken(authFactory, tokenStr), getIpAddress(), getHiveConf()); authFactory.cancelDelegationToken(tokenStr); }
@Override public void cancelDelegationToken(HiveAuthFactory authFactory, String tokenStr) throws HiveSQLException { HiveAuthFactory.verifyProxyAccess(getUsername(), getUserFromToken(authFactory, tokenStr), getIpAddress(), getHiveConf()); authFactory.cancelDelegationToken(tokenStr); }
@Override public void renewDelegationToken(HiveAuthFactory authFactory, String tokenStr) throws HiveSQLException { HiveAuthFactory.verifyProxyAccess(getUsername(), getUserFromToken(authFactory, tokenStr), getIpAddress(), getHiveConf()); authFactory.renewDelegationToken(tokenStr); }