Skip to content

Commit 191cea0

Browse files
[close #610] [to #590] add docs for api v2 and tls reload (#611) (#614)
Co-authored-by: iosmanthus <dengliming@pingcap.com>
1 parent 64beacf commit 191cea0

File tree

2 files changed

+58
-1
lines changed

2 files changed

+58
-1
lines changed

docs/src/administration/configuration.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,14 @@ The following includes ThreadPool related parameters, which can be passed in thr
8888
- a PKCS#8 private key file in PEM format. e.g. /home/tidb/client-key.pem.
8989
- default: null
9090

91+
#### tikv.tls.reload_interval
92+
- The interval in seconds to poll the change of TLS context, if a change is detected, the TLS context will be rebuilded.
93+
- default: `"10s"`, `"0s"` means disable TLS context reload.
94+
95+
#### tikv.conn.recycle_time
96+
- After a TLS context reloading, the old connections will be forced to shutdown after `tikv.conn.recycle_time` to prevent channel leak.
97+
- default: `"60s"`.
98+
9199
#### tikv.rawkv.read_timeout_in_ms
92100
- RawKV read timeout in milliseconds. This parameter controls the timeout of `get` `getKeyTTL`.
93101
- default: 2000 (2 seconds)

docs/src/examples/rawkv.md

Lines changed: 50 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,4 +48,53 @@ public class Main {
4848
session.close();
4949
}
5050
}
51-
```
51+
```
52+
53+
54+
## API V2
55+
With TiKV version >= 6.1.0, we release a new feature called "TiKV API V2" which provides a new raw key-value storage format allowing the coexistence of RawKV and TxnKV. Please refer to [v6.10 release notes](https://docs.pingcap.com/tidb/stable/release-6.1.0#ease-of-use) for detail.
56+
57+
To enable the API V2 mode, users need to specify the API version of the client.
58+
59+
```java
60+
// import ...
61+
import org.tikv.common.TiConfiguration.ApiVersion;
62+
63+
public class Main {
64+
public static void main() {
65+
TiConfiguration conf = TiConfiguration.createRawDefault("127.0.0.1:2379");
66+
conf.setApiVersion(ApiVersion.V2);
67+
try(TiSession session = TiSession.create(conf)) {
68+
try(RawKVClient client = session.createRawClient()) {
69+
// The client will read and write date in the format of API V2, which is
70+
// transparent to the users.
71+
client.put(ByteString.copyFromUtf8("hello"), ByteString.copyFromUtf8("world"));
72+
// other client operations.
73+
}
74+
}
75+
}
76+
}
77+
```
78+
79+
### Compatibility
80+
81+
The V2 Client should not access the cluster other than V2, this requires users to [enable the API V2](https://docs.pingcap.com/tidb/stable/tikv-configuration-file#api-version-new-in-v610) for the cluster:
82+
83+
```toml
84+
[storage]
85+
# The V2 cluster must enable ttl for RawKV explicitly
86+
enable-ttl = true
87+
api-version = 2
88+
```
89+
90+
If V2 client accesses a V1 cluster or V1 cluster accesses a V2 cluster, the requests will be denied by the cluster. You can check the compatibility via the following matrix.
91+
92+
93+
| | V1 Server | V1TTL Server | V2 Server |
94+
| --------------------- | --------- | ------------ | --------- |
95+
| V1 RawClient | Raw | Raw | Error |
96+
| V1 RawClient with TTL | Error | Raw | Error |
97+
| V1 TxnClient | Txn | Error | Error |
98+
| V1 TiDB | TiDB Data | Error | TiDB Data |
99+
| V2 RawClient | Error | Error | Raw |
100+
| V2 TxnClient | Error | Error | Txn |

0 commit comments

Comments
 (0)