You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@kyuubi.apache.org by GitBox <gi...@apache.org> on 2022/04/24 10:18:09 UTC

[GitHub] [incubator-kyuubi] lightning-L opened a new pull request, #2459: [KYUUBI #1936][FOLLOWUP] stop updating credentials when credentials a…

lightning-L opened a new pull request, #2459:
URL: https://github.com/apache/incubator-kyuubi/pull/2459

   …re expired
   
   <!--
   Thanks for sending a pull request!
   
   Here are some tips for you:
     1. If this is your first time, please read our contributor guidelines: https://kyuubi.readthedocs.io/en/latest/community/contributions.html
     2. If the PR is related to an issue in https://github.com/apache/incubator-kyuubi/issues, add '[KYUUBI #XXXX]' in your PR title, e.g., '[KYUUBI #XXXX] Your PR title ...'.
     3. If the PR is unfinished, add '[WIP]' in your PR title, e.g., '[WIP][KYUUBI #XXXX] Your PR title ...'.
   -->
   
   ### _Why are the changes needed?_
   <!--
   Please clarify why the changes are needed. For instance,
     1. If you add a feature, you can talk about the use case of it.
     2. If you fix a bug, you can clarify why it is a bug.
   -->
   
   
   ### _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.apache.org/docs/latest/develop_tools/testing.html#running-tests) locally before make a pull request
   - [ ] 
   
   


-- 
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: notifications-unsubscribe@kyuubi.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@kyuubi.apache.org
For additional commands, e-mail: notifications-help@kyuubi.apache.org


[GitHub] [incubator-kyuubi] codecov-commenter commented on pull request #2459: [KYUUBI #1936][FOLLOWUP] stop updating credentials when credentials are expired

Posted by GitBox <gi...@apache.org>.
codecov-commenter commented on PR #2459:
URL: https://github.com/apache/incubator-kyuubi/pull/2459#issuecomment-1107818023

   # [Codecov](https://codecov.io/gh/apache/incubator-kyuubi/pull/2459?src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) Report
   > Merging [#2459](https://codecov.io/gh/apache/incubator-kyuubi/pull/2459?src=pr&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (6a7dbd4) into [master](https://codecov.io/gh/apache/incubator-kyuubi/commit/3ecdd42286d2b47b3c2b7b090f4041e8c52e5e99?el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (3ecdd42) will **increase** coverage by `0.02%`.
   > The diff coverage is `93.75%`.
   
   ```diff
   @@             Coverage Diff              @@
   ##             master    #2459      +/-   ##
   ============================================
   + Coverage     63.18%   63.20%   +0.02%     
     Complexity       69       69              
   ============================================
     Files           366      366              
     Lines         17442    17448       +6     
     Branches       2342     2341       -1     
   ============================================
   + Hits          11020    11028       +8     
   + Misses         5396     5395       -1     
   + Partials       1026     1025       -1     
   ```
   
   
   | [Impacted Files](https://codecov.io/gh/apache/incubator-kyuubi/pull/2459?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) | Coverage Δ | |
   |---|---|---|
   | [.../kyuubi/credentials/HadoopCredentialsManager.scala](https://codecov.io/gh/apache/incubator-kyuubi/pull/2459/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-a3l1dWJpLXNlcnZlci9zcmMvbWFpbi9zY2FsYS9vcmcvYXBhY2hlL2t5dXViaS9jcmVkZW50aWFscy9IYWRvb3BDcmVkZW50aWFsc01hbmFnZXIuc2NhbGE=) | `94.11% <93.33%> (+0.98%)` | :arrow_up: |
   | [...org/apache/kyuubi/credentials/CredentialsRef.scala](https://codecov.io/gh/apache/incubator-kyuubi/pull/2459/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-a3l1dWJpLXNlcnZlci9zcmMvbWFpbi9zY2FsYS9vcmcvYXBhY2hlL2t5dXViaS9jcmVkZW50aWFscy9DcmVkZW50aWFsc1JlZi5zY2FsYQ==) | `100.00% <100.00%> (ø)` | |
   | [...ache/kyuubi/operation/KyuubiOperationManager.scala](https://codecov.io/gh/apache/incubator-kyuubi/pull/2459/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-a3l1dWJpLXNlcnZlci9zcmMvbWFpbi9zY2FsYS9vcmcvYXBhY2hlL2t5dXViaS9vcGVyYXRpb24vS3l1dWJpT3BlcmF0aW9uTWFuYWdlci5zY2FsYQ==) | `94.44% <0.00%> (-1.86%)` | :arrow_down: |
   | [.../org/apache/kyuubi/operation/KyuubiOperation.scala](https://codecov.io/gh/apache/incubator-kyuubi/pull/2459/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-a3l1dWJpLXNlcnZlci9zcmMvbWFpbi9zY2FsYS9vcmcvYXBhY2hlL2t5dXViaS9vcGVyYXRpb24vS3l1dWJpT3BlcmF0aW9uLnNjYWxh) | `66.66% <0.00%> (-1.34%)` | :arrow_down: |
   | [...n/scala/org/apache/kyuubi/engine/ProcBuilder.scala](https://codecov.io/gh/apache/incubator-kyuubi/pull/2459/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-a3l1dWJpLXNlcnZlci9zcmMvbWFpbi9zY2FsYS9vcmcvYXBhY2hlL2t5dXViaS9lbmdpbmUvUHJvY0J1aWxkZXIuc2NhbGE=) | `80.74% <0.00%> (+0.62%)` | :arrow_up: |
   | [...rg/apache/kyuubi/engine/trino/TrinoStatement.scala](https://codecov.io/gh/apache/incubator-kyuubi/pull/2459/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-ZXh0ZXJuYWxzL2t5dXViaS10cmluby1lbmdpbmUvc3JjL21haW4vc2NhbGEvb3JnL2FwYWNoZS9reXV1YmkvZW5naW5lL3RyaW5vL1RyaW5vU3RhdGVtZW50LnNjYWxh) | `71.26% <0.00%> (+2.29%)` | :arrow_up: |
   
   ------
   
   [Continue to review full report at Codecov](https://codecov.io/gh/apache/incubator-kyuubi/pull/2459?src=pr&el=continue&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation).
   > **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)
   > `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
   > Powered by [Codecov](https://codecov.io/gh/apache/incubator-kyuubi/pull/2459?src=pr&el=footer&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation). Last update [3ecdd42...6a7dbd4](https://codecov.io/gh/apache/incubator-kyuubi/pull/2459?src=pr&el=lastupdated&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation).
   


-- 
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: notifications-unsubscribe@kyuubi.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@kyuubi.apache.org
For additional commands, e-mail: notifications-help@kyuubi.apache.org


[GitHub] [incubator-kyuubi] turboFei commented on pull request #2459: [KYUUBI #1936][FOLLOWUP] stop updating credentials when credentials are expired

Posted by GitBox <gi...@apache.org>.
turboFei commented on PR #2459:
URL: https://github.com/apache/incubator-kyuubi/pull/2459#issuecomment-1107820473

   cc @zhouyifan279 


-- 
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: notifications-unsubscribe@kyuubi.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@kyuubi.apache.org
For additional commands, e-mail: notifications-help@kyuubi.apache.org


[GitHub] [incubator-kyuubi] lightning-L commented on pull request #2459: [KYUUBI #1936][FOLLOWUP] stop updating credentials when credentials a…

Posted by GitBox <gi...@apache.org>.
lightning-L commented on PR #2459:
URL: https://github.com/apache/incubator-kyuubi/pull/2459#issuecomment-1107810912

   Sorry for the late commit.
   
   This is the follow-up for the comments in https://github.com/apache/incubator-kyuubi/pull/2210 
   ------
   But considering the following scenario, I think we should also check whether userRef in `userCredentialsRefMap` has been replaced by a new one .
   
   `userRef` was waiting for next renewal.
   `userRef` expired and was removed from `userCredentialsRefMap`
   A new `userRef` was created because of user visiting.
   Renewal of old userRef started again.
   If we do not check, both old and new userRef will renew periodically.
   
   modified the code and added test case for the scenario.


-- 
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: notifications-unsubscribe@kyuubi.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@kyuubi.apache.org
For additional commands, e-mail: notifications-help@kyuubi.apache.org


[GitHub] [incubator-kyuubi] turboFei commented on pull request #2459: [KYUUBI #1936][FOLLOWUP] Stop updating credentials when credentials are expired

Posted by GitBox <gi...@apache.org>.
turboFei commented on PR #2459:
URL: https://github.com/apache/incubator-kyuubi/pull/2459#issuecomment-1107844724

   thanks, merged to master


-- 
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: notifications-unsubscribe@kyuubi.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@kyuubi.apache.org
For additional commands, e-mail: notifications-help@kyuubi.apache.org


[GitHub] [incubator-kyuubi] turboFei closed pull request #2459: [KYUUBI #1936][FOLLOWUP] Stop updating credentials when credentials are expired

Posted by GitBox <gi...@apache.org>.
turboFei closed pull request #2459: [KYUUBI #1936][FOLLOWUP] Stop updating credentials when credentials are expired
URL: https://github.com/apache/incubator-kyuubi/pull/2459


-- 
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: notifications-unsubscribe@kyuubi.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@kyuubi.apache.org
For additional commands, e-mail: notifications-help@kyuubi.apache.org


[GitHub] [incubator-kyuubi] zhouyifan279 commented on pull request #2459: [KYUUBI #1936][FOLLOWUP] Stop updating credentials when credentials are expired

Posted by GitBox <gi...@apache.org>.
zhouyifan279 commented on PR #2459:
URL: https://github.com/apache/incubator-kyuubi/pull/2459#issuecomment-1107838258

   LGTM


-- 
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: notifications-unsubscribe@kyuubi.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@kyuubi.apache.org
For additional commands, e-mail: notifications-help@kyuubi.apache.org


[GitHub] [incubator-kyuubi] turboFei commented on a diff in pull request #2459: [KYUUBI #1936][FOLLOWUP] stop updating credentials when credentials are expired

Posted by GitBox <gi...@apache.org>.
turboFei commented on code in PR #2459:
URL: https://github.com/apache/incubator-kyuubi/pull/2459#discussion_r857112567


##########
kyuubi-server/src/test/scala/org/apache/kyuubi/credentials/HadoopCredentialsManagerSuite.scala:
##########
@@ -158,6 +158,49 @@ class HadoopCredentialsManagerSuite extends KyuubiFunSuite {
       eventually(timeout(9000.milliseconds), interval(100.milliseconds)) {
         assert(manager.userCredentialsRefMap.size == 0)
       }
+
+      // Wait for renewal task to stop
+      Thread.sleep(2000L)
+
+      // Check renewal schedule is stopped
+      assert(userRef.getEpoch >= 4)
+      val epoch = userRef.getEpoch
+      Thread.sleep(2000L)
+      assert(userRef.getEpoch == epoch)
+    }
+  }
+
+  test("stop old credential schedule when there is newer userRef in the map") {
+    val kyuubiConf = new KyuubiConf(false)
+      .set(KyuubiConf.CREDENTIALS_RENEWAL_INTERVAL, 1000L)
+      .set(KyuubiConf.CREDENTIALS_RENEWAL_RETRY_WAIT, 1000L)
+      .set(KyuubiConf.CREDENTIALS_CHECK_INTERVAL, 4000L)
+      .set(KyuubiConf.CREDENTIALS_IDLE_TIMEOUT, 5000L)
+
+    withStartedManager(kyuubiConf) { manager =>
+      // Trigger UserCredentialsRef's initialization
+      val userRef = manager.getOrCreateUserCredentialsRef(appUser)
+      assert(manager.userCredentialsRefMap.size == 1)
+
+      // Credentials are expired
+      eventually(timeout(9000.milliseconds), interval(100.milliseconds)) {
+        assert(manager.userCredentialsRefMap.size == 0)
+      }
+
+      // New userRef is created
+      val userRef_new = manager.getOrCreateUserCredentialsRef(appUser)

Review Comment:
   nit: userRef_new -> newUserRef



##########
kyuubi-server/src/test/scala/org/apache/kyuubi/credentials/HadoopCredentialsManagerSuite.scala:
##########
@@ -158,6 +158,49 @@ class HadoopCredentialsManagerSuite extends KyuubiFunSuite {
       eventually(timeout(9000.milliseconds), interval(100.milliseconds)) {
         assert(manager.userCredentialsRefMap.size == 0)
       }
+
+      // Wait for renewal task to stop
+      Thread.sleep(2000L)
+
+      // Check renewal schedule is stopped
+      assert(userRef.getEpoch >= 4)
+      val epoch = userRef.getEpoch
+      Thread.sleep(2000L)
+      assert(userRef.getEpoch == epoch)
+    }
+  }
+
+  test("stop old credential schedule when there is newer userRef in the map") {
+    val kyuubiConf = new KyuubiConf(false)
+      .set(KyuubiConf.CREDENTIALS_RENEWAL_INTERVAL, 1000L)
+      .set(KyuubiConf.CREDENTIALS_RENEWAL_RETRY_WAIT, 1000L)
+      .set(KyuubiConf.CREDENTIALS_CHECK_INTERVAL, 4000L)
+      .set(KyuubiConf.CREDENTIALS_IDLE_TIMEOUT, 5000L)
+
+    withStartedManager(kyuubiConf) { manager =>
+      // Trigger UserCredentialsRef's initialization
+      val userRef = manager.getOrCreateUserCredentialsRef(appUser)
+      assert(manager.userCredentialsRefMap.size == 1)
+
+      // Credentials are expired
+      eventually(timeout(9000.milliseconds), interval(100.milliseconds)) {
+        assert(manager.userCredentialsRefMap.size == 0)
+      }
+
+      // New userRef is created
+      val userRef_new = manager.getOrCreateUserCredentialsRef(appUser)
+      assert(manager.userCredentialsRefMap.size == 1)

Review Comment:
   I think you can move this part into original UT.



##########
kyuubi-server/src/test/scala/org/apache/kyuubi/credentials/HadoopCredentialsManagerSuite.scala:
##########
@@ -158,6 +158,49 @@ class HadoopCredentialsManagerSuite extends KyuubiFunSuite {
       eventually(timeout(9000.milliseconds), interval(100.milliseconds)) {
         assert(manager.userCredentialsRefMap.size == 0)

Review Comment:
   nit:
   ```    
     eventually(timeout(9000.milliseconds), interval(100.milliseconds)) {
           assert(manager.userCredentialsRefMap.size == 0)
           val epoch = userRef.getEpoch
           Thread.sleep(2000L)
           assert(userRef.getEpoch == epoch)
     }
   ```



-- 
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: notifications-unsubscribe@kyuubi.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@kyuubi.apache.org
For additional commands, e-mail: notifications-help@kyuubi.apache.org