[KYUUBI #1674] Uncache cached tables when session closed

<!--
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.
-->
As mentioned in SPARK-29911 , there may also be memory leaks in kyuubi.  #1674

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

- [X] Add screenshots for manual tests if appropriate
![微信截图_20220104145456](https://user-images.githubusercontent.com/17894939/148021323-9f3e4268-ff54-4ad3-bb7e-2044d73ae154.png)
close session:
![微信截图_20220104145530](https://user-images.githubusercontent.com/17894939/148021331-2a816934-2c07-47dd-b939-01117f93bb5b.png)

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

Closes #1676 from wForget/KYUUBI-1674.

Closes #1674

e2bec4ec [Wang Zhen] [KYUUBI-1674] Uncache cached tables when session closed

Authored-by: Wang Zhen <wangzhen07@qiyi.com>
Signed-off-by: ulysses-you <ulyssesyou@apache.org>
This commit is contained in:
Wang Zhen 2022-01-04 15:48:05 +08:00 committed by ulysses-you
parent 4655cd8515
commit 47533100f6
No known key found for this signature in database
GPG Key ID: 4C500BC62D576766

View File

@ -69,6 +69,7 @@ class SparkSessionImpl(
sessionEvent.endTime = System.currentTimeMillis()
EventLoggingService.onEvent(sessionEvent)
super.close()
spark.sessionState.catalog.getTempViewNames().foreach(spark.catalog.uncacheTable(_))
sessionManager.operationManager.asInstanceOf[SparkSQLOperationManager].closeILoop(handle)
}