Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[KYUUBI #1176] InvalidACL appears in the engine when zookeeper acl is turned on #1177

Closed
wants to merge 2 commits into from

Conversation

cxzl25
Copy link
Contributor

@cxzl25 cxzl25 commented Sep 28, 2021

Why are the changes needed?

#1176
When kyuubi.ha.zookeeper.acl.enabled=true, both service and engine will use zookeeper acl to create znode, but engine has no keytab information and cannot write information to zookeeper, throwing an exception.

Caused by: org.apache.zookeeper.KeeperException$InvalidACLException: KeeperErrorCode = InvalidACL for /kyuubi_USER/XXXX
	at org.apache.zookeeper.KeeperException.create(KeeperException.java:124)
	at org.apache.zookeeper.KeeperException.create(KeeperException.java:54)
	at org.apache.zookeeper.ZooKeeper.create(ZooKeeper.java:792)
	at org.apache.kyuubi.shade.org.apache.curator.framework.imps.CreateBuilderImpl$11.call(CreateBuilderImpl.java:740)

How was this patch tested?

  • Add some test cases that check the changes thoroughly including negative and positive cases if possible

  • Add screenshots for manual tests if appropriate

  • Run test locally before make a pull request

@cxzl25
Copy link
Contributor Author

cxzl25 commented Sep 28, 2021

Current

image

Fix

image

@codecov-commenter
Copy link

Codecov Report

Merging #1177 (4a28756) into master (191d30e) will increase coverage by 0.04%.
The diff coverage is 78.75%.

❗ Current head 4a28756 differs from pull request most recent head 0b7cc2e. Consider uploading reports for the commit 0b7cc2e to get more accurate results
Impacted file tree graph

@@             Coverage Diff              @@
##             master    #1177      +/-   ##
============================================
+ Coverage     78.79%   78.84%   +0.04%     
  Complexity       93       93              
============================================
  Files           182      182              
  Lines          6654     6683      +29     
  Branches        785      784       -1     
============================================
+ Hits           5243     5269      +26     
- Misses          961      966       +5     
+ Partials        450      448       -2     
Impacted Files Coverage Δ
...ubi/engine/spark/operation/PlanOnlyStatement.scala 0.00% <0.00%> (ø)
...la/org/apache/kyuubi/session/AbstractSession.scala 95.40% <0.00%> (ø)
...rg/apache/kyuubi/engine/spark/SparkSQLEngine.scala 63.88% <46.15%> (-1.39%) ⬇️
...g/apache/kyuubi/session/KyuubiSessionManager.scala 94.73% <80.00%> (-2.33%) ⬇️
...uubi/engine/spark/events/EventLoggingService.scala 79.16% <100.00%> (-7.20%) ⬇️
...uubi/engine/spark/operation/ExecuteStatement.scala 88.75% <100.00%> (-0.14%) ⬇️
.../engine/spark/session/SparkSQLSessionManager.scala 92.10% <100.00%> (+0.43%) ⬆️
...in/scala/org/apache/kyuubi/config/KyuubiConf.scala 95.33% <100.00%> (+0.08%) ⬆️
...org/apache/kyuubi/operation/log/OperationLog.scala 97.82% <100.00%> (+2.17%) ⬆️
...ala/org/apache/kyuubi/session/SessionManager.scala 56.36% <100.00%> (+3.42%) ⬆️
... and 4 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 191d30e...0b7cc2e. Read the comment docs.

@@ -48,14 +49,18 @@ class KyuubiSessionManager private (name: String) extends SessionManager(name) {

val username = Option(user).filter(_.nonEmpty).getOrElse("anonymous")

val sessionConf = this.getConf.getUserDefaults(user)
if (!sessionConf.get(HA_ZK_ACL_ENGINE_ENABLED)) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It‘s a bit hacky, can we use HA_ZK_ACL_ENGINE_ENABLED at the caller side?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Move to ZooKeeperACLProvider

val acl1 = new ZooKeeperACLProvider(conf1).getDefaultAcl
assert(acl1.size() === 2)
val expected = ZooDefs.Ids.READ_ACL_UNSAFE
expected.addAll(ZooDefs.Ids.CREATOR_ALL_ACL)
Copy link
Contributor Author

@cxzl25 cxzl25 Sep 29, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This (expected.addAll) will modify the original list

}

if (conf.get(HighAvailabilityConf.HA_ZK_ACL_ENABLED) &&
conf.get(HighAvailabilityConf.HA_ZK_ENGINE_REF_ID).isEmpty) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ulysses-you does this sufficient to distinguish between the server side and the engine side?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don’t seem to find other ways to distinguish server and engine, or use main class to distinguish.

@yaooqinn yaooqinn closed this in d332534 Oct 8, 2021
yaooqinn pushed a commit that referenced this pull request Oct 8, 2021
… turned on

### _Why are the changes needed?_
#1176
When `kyuubi.ha.zookeeper.acl.enabled=true`, both service and engine will use zookeeper acl to create znode, but engine has no keytab information and cannot write information to zookeeper, throwing an exception.

```java
Caused by: org.apache.zookeeper.KeeperException$InvalidACLException: KeeperErrorCode = InvalidACL for /kyuubi_USER/XXXX
	at org.apache.zookeeper.KeeperException.create(KeeperException.java:124)
	at org.apache.zookeeper.KeeperException.create(KeeperException.java:54)
	at org.apache.zookeeper.ZooKeeper.create(ZooKeeper.java:792)
	at org.apache.kyuubi.shade.org.apache.curator.framework.imps.CreateBuilderImpl$11.call(CreateBuilderImpl.java:740)
```

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

- [x] Add screenshots for manual tests if appropriate

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

Closes #1177 from cxzl25/KYUUBI-1176.

Closes #1176

ecc08fa [sychen] fix engine acl
0b7cc2e [sychen] fix InvalidACL

Authored-by: sychen <sychen@trip.com>
Signed-off-by: Kent Yao <yao@apache.org>
(cherry picked from commit d332534)
Signed-off-by: Kent Yao <yao@apache.org>
@yaooqinn yaooqinn added this to the v1.3.1 milestone Oct 8, 2021
@yaooqinn
Copy link
Member

yaooqinn commented Oct 8, 2021

thanks, merged to master/1.3

@ulysses-you ulysses-you modified the milestones: v1.3.1, v1.4.0 Oct 8, 2021
val HA_ZK_ACL_ENGINE_ENABLED: ConfigEntry[Boolean] =
buildConf("ha.zookeeper.acl.engine.enabled")
.doc("Set to true if the zookeeper ensemble is kerberized at engine side.")
.version("1.4.0")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@cxzl25 sorry for the late, can we send a followup change the version to 1.3.1 ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

see #1193

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

branch-1.3 lacks HA_ZK_ENGINE_REF_ID configuration to distinguish between service and engine.
It should be compilation failure now?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

good point, seems branch-1.3 would fail. Can you send a PR target to branch-1.3 ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you mean to merge #1032 into branch-1.3? And change the version of ha.engine.ref.id to 1.3.1

ulysses-you pushed a commit that referenced this pull request Oct 8, 2021
….enabled) version

#1177
### _Why are the changes needed?_
change configuration(ha.zookeeper.acl.engine.enabled) version to `1.3.1`

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

- [] Add screenshots for manual tests if appropriate

- [] [Run test](https://kyuubi.readthedocs.io/en/latest/develop_tools/testing.html#running-tests) locally before make a pull request

Closes #1193 from cxzl25/KYUUBI-1176-followup.

Closes #1176

72753ae [sychen] change config version

Authored-by: sychen <sychen@trip.com>
Signed-off-by: ulysses-you <ulyssesyou@apache.org>
ulysses-you pushed a commit that referenced this pull request Oct 8, 2021
….enabled) version

#1177
### _Why are the changes needed?_
change configuration(ha.zookeeper.acl.engine.enabled) version to `1.3.1`

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

- [] Add screenshots for manual tests if appropriate

- [] [Run test](https://kyuubi.readthedocs.io/en/latest/develop_tools/testing.html#running-tests) locally before make a pull request

Closes #1193 from cxzl25/KYUUBI-1176-followup.

Closes #1176

72753ae [sychen] change config version

Authored-by: sychen <sychen@trip.com>
Signed-off-by: ulysses-you <ulyssesyou@apache.org>
(cherry picked from commit 464fdf4)
Signed-off-by: ulysses-you <ulyssesyou@apache.org>
@pan3793 pan3793 modified the milestones: v1.3.1, v1.4.0 Oct 12, 2021
@pan3793
Copy link
Member

pan3793 commented Oct 12, 2021

Change milestone to 1.4.0, see #1221

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants