[SPARK-28311][SQL] Fix STS OpenSession failed return wrong origin PROTOCOL_VERSION
## What changes were proposed in this pull request? For Thrift server, It's downward compatible. Such as if a PROTOCOL_VERSION_V7 client connect to a PROTOCOL_VERSION_V8 server, when OpenSession, server will change his response's protocol version to min of (client and server). `TProtocolVersion protocol = getMinVersion(CLIService.SERVER_VERSION,` ` req.getClient_protocol());` then set it to OpenSession's response. But if OpenSession failed , it won't execute behavior of reset response's protocol_version. Then it will return server's origin protocol version. Finally client will get en error as below: ![image](https://user-images.githubusercontent.com/46485123/61023164-54f4b780-a3db-11e9-8c49-60217b36287b.png) Since we write a wrong database,, OpenSession failed, right protocol version haven't been rest. ## How was this patch tested? Since I really don't know how to write unit test about this, so I build a jar with this PR,and retry the error above, then it will return a reasonable Error of DB not found : ![image](https://user-images.githubusercontent.com/46485123/61023923-67242500-a3de-11e9-8e98-8f391a038480.png) Closes #25083 from AngersZhuuuu/SPARK-28311. Authored-by: 朱夷 <zhuyi01@corp.netease.com> Signed-off-by: Sean Owen <sean.owen@databricks.com>
This commit is contained in:
parent
f241fc7776
commit
8ecbb67b3b
|
@ -344,6 +344,7 @@ public abstract class ThriftCLIService extends AbstractService implements TCLISe
|
|||
String ipAddress = getIpAddress();
|
||||
TProtocolVersion protocol = getMinVersion(CLIService.SERVER_VERSION,
|
||||
req.getClient_protocol());
|
||||
res.setServerProtocolVersion(protocol);
|
||||
SessionHandle sessionHandle;
|
||||
if (cliService.getHiveConf().getBoolVar(ConfVars.HIVE_SERVER2_ENABLE_DOAS) &&
|
||||
(userName != null)) {
|
||||
|
@ -354,7 +355,6 @@ public abstract class ThriftCLIService extends AbstractService implements TCLISe
|
|||
sessionHandle = cliService.openSession(protocol, userName, req.getPassword(),
|
||||
ipAddress, req.getConfiguration());
|
||||
}
|
||||
res.setServerProtocolVersion(protocol);
|
||||
return sessionHandle;
|
||||
}
|
||||
|
||||
|
|
|
@ -345,6 +345,7 @@ public abstract class ThriftCLIService extends AbstractService implements TCLISe
|
|||
String ipAddress = getIpAddress();
|
||||
TProtocolVersion protocol = getMinVersion(CLIService.SERVER_VERSION,
|
||||
req.getClient_protocol());
|
||||
res.setServerProtocolVersion(protocol);
|
||||
SessionHandle sessionHandle;
|
||||
if (cliService.getHiveConf().getBoolVar(ConfVars.HIVE_SERVER2_ENABLE_DOAS) &&
|
||||
(userName != null)) {
|
||||
|
@ -355,7 +356,6 @@ public abstract class ThriftCLIService extends AbstractService implements TCLISe
|
|||
sessionHandle = cliService.openSession(protocol, userName, req.getPassword(),
|
||||
ipAddress, req.getConfiguration());
|
||||
}
|
||||
res.setServerProtocolVersion(protocol);
|
||||
return sessionHandle;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue