@Override public String getSessionHandle() { return hiveSession.getSessionHandle().toString(); } }
/** * Opens a new session and creates a session handle. * The username passed to this method is the effective username. * If withImpersonation is true (==doAs true) we wrap all the calls in HiveSession * within a UGI.doAs, where UGI corresponds to the effective user. * @see org.apache.hive.service.cli.thrift.ThriftCLIService#getUserName(TOpenSessionReq) * * @param protocol * @param username * @param password * @param ipAddress * @param sessionConf * @param withImpersonation * @param delegationToken * @return * @throws HiveSQLException */ public SessionHandle openSession(TProtocolVersion protocol, String username, String password, String ipAddress, Map<String, String> sessionConf, boolean withImpersonation, String delegationToken) throws HiveSQLException { return createSession(null, protocol, username, password, ipAddress, sessionConf, withImpersonation, delegationToken).getSessionHandle(); }
private void addOperation(Operation operation) { LOG.info("Adding operation: {} {}", operation.getHandle(), operation.getParentSession().getSessionHandle()); queryIdOperation.put(getQueryId(operation), operation); handleToOperation.put(operation.getHandle(), operation); if (operation instanceof SQLOperation) { synchronized (webuiLock) { liveQueryInfos.put(operation.getHandle().getHandleIdentifier().toString(), ((SQLOperation) operation).getQueryInfo()); } } }
private void closeAndDisallowHiveSessions() { LOG.info("Closing all open hive sessions."); if (cliService == null) return; cliService.getSessionManager().allowSessions(false); // No sessions can be opened after the above call. Close the existing ones if any. try { for (HiveSession session : cliService.getSessionManager().getSessions()) { cliService.getSessionManager().closeSession(session.getSessionHandle()); } LOG.info("Closed all open hive sessions"); } catch (HiveSQLException e) { LOG.error("Unable to close all open sessions.", e); } }
SessionHandle handle = session.getSessionHandle(); LOG.warn("Session " + handle + " is Timed-out (last access : " + new Date(session.getLastAccessTime()) + ") and will be closed");
synchronized (sessionAddLock) { if (allowSessions) { handleToSession.put(session.getSessionHandle(), session); isAdded = true; LOG.info("Session opened, " + session.getSessionHandle() + ", current sessions:" + getOpenSessionCount()); return session;
@Override public String getSessionHandle() { return hiveSession.getSessionHandle().toString(); } }
@Override public String getSessionHandle() { return hiveSession.getSessionHandle().toString(); } }
@Override public String getSessionHandle() { return hiveSession.getSessionHandle().toString(); } }
@Override public String getSessionHandle() { return hiveSession.getSessionHandle().toString(); } }
@Override public String getSessionHandle() { return hiveSession.getSessionHandle().toString(); } }
/** * Opens a new session and creates a session handle. * The username passed to this method is the effective username. * If withImpersonation is true (==doAs true) we wrap all the calls in HiveSession * within a UGI.doAs, where UGI corresponds to the effective user. * @see org.apache.hive.service.cli.thrift.ThriftCLIService#getUserName(TOpenSessionReq) * * @param protocol * @param username * @param password * @param ipAddress * @param sessionConf * @param withImpersonation * @param delegationToken * @return * @throws HiveSQLException */ public SessionHandle openSession(TProtocolVersion protocol, String username, String password, String ipAddress, Map<String, String> sessionConf, boolean withImpersonation, String delegationToken) throws HiveSQLException { return createSession(null, protocol, username, password, ipAddress, sessionConf, withImpersonation, delegationToken).getSessionHandle(); } public HiveSession createSession(SessionHandle sessionHandle, TProtocolVersion protocol, String username,
private void closeHiveSessions() { LOG.info("Closing all open hive sessions."); if (cliService != null && cliService.getSessionManager().getOpenSessionCount() > 0) { try { for (HiveSession session : cliService.getSessionManager().getSessions()) { cliService.getSessionManager().closeSession(session.getSessionHandle()); } LOG.info("Closed all open hive sessions"); } catch (HiveSQLException e) { LOG.error("Unable to close all open sessions.", e); } } }
@Override public void run() { for (sleepInterval(interval); !shutdown; sleepInterval(interval)) { long current = System.currentTimeMillis(); for (HiveSession session : new ArrayList<HiveSession>(handleToSession.values())) { if (sessionTimeout > 0 && session.getLastAccessTime() + sessionTimeout <= current && (!checkOperation || session.getNoOperationTime() > sessionTimeout)) { SessionHandle handle = session.getSessionHandle(); LOG.warn("Session " + handle + " is Timed-out (last access : " + new Date(session.getLastAccessTime()) + ") and will be closed"); try { closeSession(handle); } catch (HiveSQLException e) { LOG.warn("Exception is thrown closing session " + handle, e); } } else { session.closeExpiredOperations(); } } } }
@Override public void run() { for (sleepInterval(interval); !shutdown; sleepInterval(interval)) { long current = System.currentTimeMillis(); for (HiveSession session : new ArrayList<HiveSession>(handleToSession.values())) { if (sessionTimeout > 0 && session.getLastAccessTime() + sessionTimeout <= current && (!checkOperation || session.getNoOperationTime() > sessionTimeout)) { SessionHandle handle = session.getSessionHandle(); LOG.warn("Session " + handle + " is Timed-out (last access : " + new Date(session.getLastAccessTime()) + ") and will be closed"); try { closeSession(handle); } catch (HiveSQLException e) { LOG.warn("Exception is thrown closing session " + handle, e); } } else { session.closeExpiredOperations(); } } } }
@Override public void run() { for (sleepInterval(interval); !shutdown; sleepInterval(interval)) { long current = System.currentTimeMillis(); for (HiveSession session : new ArrayList<HiveSession>(handleToSession.values())) { if (sessionTimeout > 0 && session.getLastAccessTime() + sessionTimeout <= current && (!checkOperation || session.getNoOperationTime() > sessionTimeout)) { SessionHandle handle = session.getSessionHandle(); LOG.warn("Session " + handle + " is Timed-out (last access : " + new Date(session.getLastAccessTime()) + ") and will be closed"); try { closeSession(handle); } catch (HiveSQLException e) { LOG.warn("Exception is thrown closing session " + handle, e); } } else { session.closeExpiredOperations(); } } } }
@Override public void run() { for (sleepInterval(interval); !shutdown; sleepInterval(interval)) { long current = System.currentTimeMillis(); for (HiveSession session : new ArrayList<HiveSession>(handleToSession.values())) { if (sessionTimeout > 0 && session.getLastAccessTime() + sessionTimeout <= current && (!checkOperation || session.getNoOperationTime() > sessionTimeout)) { SessionHandle handle = session.getSessionHandle(); LOG.warn("Session " + handle + " is Timed-out (last access : " + new Date(session.getLastAccessTime()) + ") and will be closed"); try { closeSession(handle); } catch (HiveSQLException e) { LOG.warn("Exception is thrown closing session " + handle, e); } } else { session.closeExpiredOperations(); } } } }
SessionHandle handle = session.getSessionHandle(); LOG.warn("Session " + handle + " is Timed-out (last access : " + new Date(session.getLastAccessTime()) + ") and will be closed");
session.setOperationLogSessionDir(operationLogRootDir); handleToSession.put(session.getSessionHandle(), session); return session.getSessionHandle();
throw new HiveSQLException("Failed to execute session hooks", e); handleToSession.put(session.getSessionHandle(), session); return session.getSessionHandle();