wForget commented on code in PR #5217:
URL: https://github.com/apache/hive/pull/5217#discussion_r1582022107


##########
jdbc/src/java/org/apache/hive/jdbc/Utils.java:
##########
@@ -725,15 +725,21 @@ private static String getAuthorityFromJdbcURL(String uri) 
throws JdbcUriParseExc
    * explored. Also update the host, port, jdbcUriString and other configs 
published by the server.
    *
    * @param connParams
+   * @param info
    * @return true if new server info is retrieved successfully
    */
-  static boolean updateConnParamsFromZooKeeper(JdbcConnectionParams 
connParams) {
+  static boolean updateConnParamsFromZooKeeper(JdbcConnectionParams 
connParams, Properties info) throws JdbcUriParseException {
     // Add current host to the rejected list
     
connParams.getRejectedHostZnodePaths().add(connParams.getCurrentHostZnodePath());
     String oldServerHost = connParams.getHost();
     int oldServerPort = connParams.getPort();
     // Update connection params (including host, port) from ZooKeeper
     try {
+      // We should reset sessionVars to the original client configurations to
+      // avoid the rejected server-side sessionVars affecting next server.
+      JdbcConnectionParams originalConnParams = 
extractURLComponents(connParams.getJdbcUriString(), info);
+      connParams.getSessionVars().clear();

Review Comment:
   > can you please elaborate a bit? looks we have already changed the host:
   
   I see what you mean, I used server principal with actual hostname instead of 
`_HOST`. But I think this is still an improvement.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: gitbox-unsubscr...@hive.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: gitbox-unsubscr...@hive.apache.org
For additional commands, e-mail: gitbox-h...@hive.apache.org

Reply via email to