kyuubi/docs/deployment
Fu Chen 393d32a30c
[KYUUBI #3615] Retry opening the engine when encountering a special error
### _Why are the changes needed?_

to close #3615

steps to reproduce

1. start kyuubi server
2. connect to the kyuubi server with client beeline and run query `select 1`
3. force kill the spark application
4. connect to the kyuubi server with another client **A** immediately

```
Error: org.apache.kyuubi.KyuubiSQLException: Error operating LaunchEngine: org.apache.thrift.transport.TTransportException: java.net.ConnectException: Connection refused (Connection refused)
        at org.apache.thrift.transport.TSocket.open(TSocket.java:226)
        at org.apache.thrift.transport.TSaslTransport.open(TSaslTransport.java:266)
        at org.apache.thrift.transport.TSaslClientTransport.open(TSaslClientTransport.java:37)
        at org.apache.kyuubi.client.KyuubiSyncThriftClient$.createTProtocol(KyuubiSyncThriftClient.scala:466)
        at org.apache.kyuubi.client.KyuubiSyncThriftClient$.createClient(KyuubiSyncThriftClient.scala:482)
        at org.apache.kyuubi.session.KyuubiSessionImpl.$anonfun$openEngineSession$1(KyuubiSessionImpl.scala:128)
        at org.apache.kyuubi.session.KyuubiSessionImpl.$anonfun$openEngineSession$1$adapted(KyuubiSessionImpl.scala:113)
        at org.apache.kyuubi.ha.client.DiscoveryClientProvider$.withDiscoveryClient(DiscoveryClientProvider.scala:36)
        at org.apache.kyuubi.session.KyuubiSessionImpl.openEngineSession(KyuubiSessionImpl.scala:113)
        at org.apache.kyuubi.operation.LaunchEngine.$anonfun$runInternal$2(LaunchEngine.scala:60)
        at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
        at java.util.concurrent.FutureTask.run(FutureTask.java:266)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
        at java.lang.Thread.run(Thread.java:748)
Caused by: java.net.ConnectException: Connection refused (Connection refused)
        at java.net.PlainSocketImpl.socketConnect(Native Method)
        at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:350)
        at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:206)
        at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:188)
        at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392)
        at java.net.Socket.connect(Socket.java:589)
        at org.aache.thrift.transport.TSocket.open(TSocket.java:221)
        ... 14 more (state=,code=0)
```

If the engine exits without calling the shutdown hook, the ZNODE with EPHEMERAL_SEQUENTIAL mode will be deleted upon the client's disconnect, and note that the engine will be marked as disconnected after `kyuubi.zookeeper.embedded.max.session.timeout` (the default value is 1 minutes)

This PR retries opening the engine when encountering a specialty exception (java.net.ConnectException). Before this PR, client **A** will throw an exception, after this PR, client **A** will work properly.

### _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

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

Closes #3618 from cfmcgrady/kyuubi-3615.

Closes #3615

96acd66b [Fu Chen] address comment
a1395a60 [Fu Chen] fix style
870216d1 [Fu Chen] Retry opening the engine when encountering a special error

Authored-by: Fu Chen <cfmcgrady@gmail.com>
Signed-off-by: Cheng Pan <chengpan@apache.org>
2022-10-20 14:31:35 +08:00
..
spark [KYUUBI #2751] [DOC] Replace sphinx_rtd_theme with sphinx_book_theme 2022-05-27 02:22:36 +08:00
engine_lifecycle.md [KYUUBI #2751] [DOC] Replace sphinx_rtd_theme with sphinx_book_theme 2022-05-27 02:22:36 +08:00
engine_on_kubernetes.md [KYUUBI #2751] [DOC] Replace sphinx_rtd_theme with sphinx_book_theme 2022-05-27 02:22:36 +08:00
engine_on_yarn.md [KYUUBI #2751] [DOC] Replace sphinx_rtd_theme with sphinx_book_theme 2022-05-27 02:22:36 +08:00
engine_share_level.md [KYUUBI #2751] [DOC] Replace sphinx_rtd_theme with sphinx_book_theme 2022-05-27 02:22:36 +08:00
high_availability_guide.md [KYUUBI #2751] [DOC] Replace sphinx_rtd_theme with sphinx_book_theme 2022-05-27 02:22:36 +08:00
hive_metastore.md [KYUUBI #2751] [DOC] Replace sphinx_rtd_theme with sphinx_book_theme 2022-05-27 02:22:36 +08:00
index.rst [KYUUBI #3449] Change default server info provider to ENGINE 2022-09-14 10:32:53 +08:00
kyuubi_on_kubernetes.md [KYUUBI #3502] [DOCS] Fix typo and use beeline provided by Kyuubi 2022-09-16 19:41:04 +08:00
migration-guide.md [KYUUBI #3449] Change default server info provider to ENGINE 2022-09-14 10:32:53 +08:00
settings.md [KYUUBI #3615] Retry opening the engine when encountering a special error 2022-10-20 14:31:35 +08:00