Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ thrift = "0.23"
byteorder = "1.5"
chrono = "0.4"
log = "0.4"
# SO_RCVTIMEO/SO_SNDTIMEO + SO_KEEPALIVE on the blocking TcpStream.
socket2 = "0.5"
# thrift 0.23 allows any uuid 1.x; 1.21+ raises MSRV to Rust 1.85.
uuid = "=1.20.0"
rustls = { version = "0.23", default-features = false, features = ["ring", "std", "tls12"], optional = true }
Expand Down
23 changes: 23 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,29 @@ cargo run --example table_session
cargo run --example session_pool
```

## Timeouts & liveness

`connect_timeout` bounds the TCP connect per endpoint attempt. `socket_timeout`
(default 60 s) bounds **every blocking socket read/write after that** — the TLS
handshake, every RPC read, and the best-effort `closeSession` sent when a
session is dropped — so a peer that accepts the connection and then goes silent
cannot hang the client forever. Set it to `None` to restore the old unbounded
blocking behaviour (zero is treated the same as `None`).

```rust
let config = SessionConfig {
connect_timeout: std::time::Duration::from_secs(10),
socket_timeout: Some(std::time::Duration::from_secs(30)),
..Default::default()
};
// or: TableSession::builder().connect_timeout(..).socket_timeout(..)
```

On a transport-level failure with `enable_auto_reconnect` (default `true`) the
session reconnects and retries the operation once; without auto-reconnect the
connection is marked broken and pools discard the session instead of handing it
out again.

## TLS & RPC compression

**RPC compression** (IoTDB's term for the Thrift *compact protocol*) is a plain config flag:
Expand Down
19 changes: 19 additions & 0 deletions README_ZH.md
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,25 @@ cargo run --example table_session
cargo run --example session_pool
```

## 超时与连接活性

`connect_timeout` 限定每个端点的 TCP 建连时长。`socket_timeout`(默认 60 s)限定建连之后的
**每一次阻塞式 socket 读写**——包括 TLS 握手、所有 RPC 读取,以及会话销毁时发送的尽力而为
`closeSession`——因此"接受连接后保持沉默"的对端不会再让客户端无限阻塞。设为 `None`
可恢复旧的无限阻塞行为(0 与 `None` 等价)。

```rust
let config = SessionConfig {
connect_timeout: std::time::Duration::from_secs(10),
socket_timeout: Some(std::time::Duration::from_secs(30)),
..Default::default()
};
// 或:TableSession::builder().connect_timeout(..).socket_timeout(..)
```

传输层失败时,若 `enable_auto_reconnect`(默认 `true`)开启,会话会重连并重试该操作一次;
未开启自动重连时,连接会被标记为已损坏,连接池将丢弃该会话而不是再次发放。

## TLS 与 RPC 压缩

**RPC 压缩**(IoTDB 术语,实为 Thrift *compact 协议*)只是一个配置开关:
Expand Down
Loading
Loading