Skip to content

Commit

Permalink
[KYUUBI #2281] The RenewDelegationToken method of TFrontendService sh…
Browse files Browse the repository at this point in the history
…ould return SUCCESS_STATUS by default

### _Why are the changes needed?_

fix #2281

### _How was this patch tested?_
- [x] Add some test cases that check the changes thoroughly including negative and positive cases if possible

- [ ] Add screenshots for manual tests if appropriate

- [x] [Run test](https://kyuubi.apache.org/docs/latest/develop_tools/testing.html#running-tests) locally before make a pull request

Closes #2286 from jiaoqingbo/2281.

Closes #2281

3dfa707 [jiaoqingbo] use OK_STATUS
8b98b6c [jiaoqingbo] code review
b262841 [jiaoqingbo] fix ut failed
83a9393 [jiaoqingbo] HadoopCredentialManager can maintain fewer userCredentials as currently only Spark Engine requires token renewal.
03caa96 [jiaoqingbo] mvn spotless
21fd415 [jiaoqingbo] [KYUUBI #2281] renewalExecutor should be stopped when  Engine's side Delegation token is not supported
25063a3 [jiaoqingbo] Merge branch 'master' of https://github.com/jiaoqingbo/incubator-kyuubi
0ad3b76 [jiaoqingbo] Merge branch 'master' of https://github.com/jiaoqingbo/incubator-kyuubi
f9d68c7 [jiaoqingbo] [KYUUBI #2244] load-kyuubi-env.sh should print SPARK_ENGINE_HOME for consistency

Authored-by: jiaoqingbo <1178404354@qq.com>
Signed-off-by: Kent Yao <yao@apache.org>
  • Loading branch information
jiaoqingbo authored and yaooqinn committed Apr 12, 2022
1 parent 9bd9105 commit 04c536b
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 6 deletions.
Expand Up @@ -498,7 +498,7 @@ abstract class TFrontendService(name: String)
resp
}

private def notSupportTokenErrorStatus = {
protected def notSupportTokenErrorStatus = {
val errorStatus = new TStatus(TStatusCode.ERROR_STATUS)
errorStatus.setErrorMessage("Delegation token is not supported")
errorStatus
Expand All @@ -521,7 +521,7 @@ abstract class TFrontendService(name: String)
override def RenewDelegationToken(req: TRenewDelegationTokenReq): TRenewDelegationTokenResp = {
debug(req.toString)
val resp = new TRenewDelegationTokenResp
resp.setStatus(notSupportTokenErrorStatus)
resp.setStatus(OK_STATUS)
resp
}

Expand Down
Expand Up @@ -468,7 +468,7 @@ class TFrontendServiceSuite extends KyuubiFunSuite {
}
}

test("Delegation token is not supported") {
test("Delegation token is supported by default") {
withSessionHandle { (client, handle) =>
val tGetDelegationTokenReq = new TGetDelegationTokenReq()
tGetDelegationTokenReq.setSessionHandle(handle)
Expand All @@ -490,8 +490,7 @@ class TFrontendServiceSuite extends KyuubiFunSuite {
tRenewDelegationTokenReq.setSessionHandle(handle)
tRenewDelegationTokenReq.setDelegationToken("")
val tRenewDelegationTokenResp = client.RenewDelegationToken(tRenewDelegationTokenReq)
assert(tRenewDelegationTokenResp.getStatus.getErrorMessage ===
"Delegation token is not supported")
assert(tRenewDelegationTokenResp.getStatus.getStatusCode === TStatusCode.SUCCESS_STATUS)
}
}

Expand Down
Expand Up @@ -19,7 +19,7 @@ package org.apache.kyuubi.server

import java.util.Base64

import org.apache.hive.service.rpc.thrift.{TOpenSessionReq, TOpenSessionResp}
import org.apache.hive.service.rpc.thrift.{TOpenSessionReq, TOpenSessionResp, TRenewDelegationTokenReq, TRenewDelegationTokenResp}

import org.apache.kyuubi.KyuubiSQLException
import org.apache.kyuubi.ha.client.{KyuubiServiceDiscovery, ServiceDiscovery}
Expand Down Expand Up @@ -71,4 +71,11 @@ final class KyuubiTBinaryFrontendService(
}

override protected def isServer(): Boolean = true

override def RenewDelegationToken(req: TRenewDelegationTokenReq): TRenewDelegationTokenResp = {
debug(req.toString)
val resp = new TRenewDelegationTokenResp
resp.setStatus(notSupportTokenErrorStatus)
resp
}
}

0 comments on commit 04c536b

Please sign in to comment.