private synchronized void acquireAfterOpLock(boolean userAccess) { // Need to make sure that the this HiveServer2's session's SessionState is // stored in the thread local for the handler thread. SessionState.setCurrentSessionState(sessionState); sessionState.setForwardedAddresses(SessionManager.getForwardedAddresses()); sessionState.setIsUsingThriftJDBCBinarySerDe(updateIsUsingThriftJDBCBinarySerDe()); if (userAccess) { lastAccessTime = System.currentTimeMillis(); lockedByUser = true; } // set the thread name with the logging prefix. sessionState.updateThreadName(); // If the thread local Hive is different from sessionHive, it means, the previous query execution in // master thread has re-created Hive object due to changes in MS related configurations in sessionConf. // So, it is necessary to reset sessionHive object based on new sessionConf. Here, we cannot, // directly set sessionHive with thread local Hive because if the previous command was REPL LOAD, then // the config changes lives only within command execution not in session level. // So, the safer option is to invoke Hive.get() which decides if to reuse Thread local Hive or re-create it. if (Hive.getThreadLocal() != sessionHive) { try { setSessionHive(); } catch (HiveSQLException e) { throw new RuntimeException(e); } } }
sessionState.setIsHiveServerQuery(true); sessionState.setForwardedAddresses(SessionManager.getForwardedAddresses()); sessionState.setIsUsingThriftJDBCBinarySerDe(updateIsUsingThriftJDBCBinarySerDe()); try { if (sessionManager != null) {
private synchronized void acquireAfterOpLock(boolean userAccess) { // Need to make sure that the this HiveServer2's session's SessionState is // stored in the thread local for the handler thread. SessionState.setCurrentSessionState(sessionState); sessionState.setForwardedAddresses(SessionManager.getForwardedAddresses()); sessionState.setIsUsingThriftJDBCBinarySerDe(updateIsUsingThriftJDBCBinarySerDe()); if (userAccess) { lastAccessTime = System.currentTimeMillis(); lockedByUser = true; } // set the thread name with the logging prefix. sessionState.updateThreadName(); Hive.set(sessionHive); }
sessionState.setIsHiveServerQuery(true); sessionState.setForwardedAddresses(SessionManager.getForwardedAddresses()); sessionState.setIsUsingThriftJDBCBinarySerDe(updateIsUsingThriftJDBCBinarySerDe()); try { if (sessionManager != null) {