Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
ab58755
implement the complete keyspace feature (#439)
andylokandy Dec 27, 2023
27d97e6
Add ttl for raw client (#324)
andylokandy Dec 28, 2023
9b9807d
Adding a reverse scan API for raw client (#441)
rahulrane50 Feb 21, 2024
e2cd82d
chore: fix clippy error for rust 1.78 (#453)
pingyu Jun 2, 2024
c3729f8
pd: handle get members with error (#452)
pingyu Jun 2, 2024
46ea873
Resolving the TLS url issue (#459)
limbooverlambda Jun 27, 2024
87d822c
Fix batch_put ttl issue (#457)
limbooverlambda Jul 1, 2024
0a2036f
fix check errors (#460)
pingyu Aug 12, 2024
30d080e
[skip ci] Update OWNERS file (#461)
ti-chi-bot Aug 20, 2024
e199fbf
adding retryable to scan (#456)
limbooverlambda Aug 22, 2024
a0875d2
OWNERS: Auto Sync OWNERS files from community membership (#464)
ti-chi-bot Sep 9, 2024
87c8214
OWNERS: Auto Sync OWNERS files from community membership (#465)
ti-chi-bot Sep 9, 2024
3750259
OWNERS: Auto Sync OWNERS files from community membership (#466)
ti-chi-bot Oct 14, 2024
53fe5a6
OWNERS: Auto Sync OWNERS files from community membership (#473)
ti-chi-bot Feb 14, 2025
7eeeba0
chore: Upgrade to rust 1.84.1 (#477)
pingyu Mar 17, 2025
754aede
tests: Improve integration tests (#481)
pingyu Mar 24, 2025
0f38ebc
plan: Handle no leader and invalidate store region (#484)
pingyu May 22, 2025
da9ff4d
split batches for RawKV batch put / delete requests (#501)
lance6716 Aug 25, 2025
976789c
Update client initialization in README (#503)
bkane-msft Aug 29, 2025
d999d89
OWNERS: Auto Sync OWNERS files from community membership (#507)
ti-chi-bot Dec 19, 2025
01c2911
tests: Fix flaky integration tests (#510)
pingyu Jan 5, 2026
121972b
fix: replace panic unwrap with error check in cluster.rs (#504) (#508)
SaathwikDasari Jan 5, 2026
658f3a9
transaction: Fix addition overflow of scan_and_fetch (#515)
pingyu Jan 14, 2026
de41653
*: Support API v2 no prefix (#518)
pingyu Jan 19, 2026
9a043b0
transaction: Resolve locks using "kv_resolve_lock" interface and hand…
pingyu Jan 20, 2026
fdb6270
store: Make "grpc_max_decoding_message_size" configurable & Enable gR…
pingyu Jan 20, 2026
805ac53
transaction: Handle commit_ts expired error (#521)
pingyu Jan 20, 2026
ff4e35a
keyspace: Remove the "apiv2-no-prefix" feature (#522)
pingyu Jan 20, 2026
a36de9f
transaction: Add "scan_locks" & "resolve_locks" interface for transac…
pingyu Jan 21, 2026
4ddcf28
*: Re-export protobuf types (LockInfo, Error, and KeyError) (#526)
pingyu Jan 22, 2026
3238881
support file based transaction
pingyu Mar 19, 2024
362193c
req debug log
pingyu Jul 29, 2025
ec653d1
fmt
pingyu Jan 25, 2026
c95cb98
remove max
pingyu Jan 25, 2026
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
24 changes: 20 additions & 4 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ jobs:
name: unit test
env:
CARGO_INCREMENTAL: 0
NEXTEST_PROFILE: ci
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
Expand All @@ -52,8 +53,15 @@ jobs:

integration-test:
name: integration test
strategy:
fail-fast: false
matrix:
case: ["integration-test-txn", "integration-test-raw"]
env:
CARGO_INCREMENTAL: 0
NEXTEST_PROFILE: ci
TIKV_VERSION: v8.5.5
RUST_LOG: info
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
Expand All @@ -69,14 +77,22 @@ jobs:
- name: start tiup playground
run: |
# use latest stable version
~/.tiup/bin/tiup install tikv pd
~/.tiup/bin/tiup playground --mode tikv-slim --kv 3 --without-monitor --kv.config config/tikv.toml --pd.config config/pd.toml &
~/.tiup/bin/tiup install tikv:${{ env.TIKV_VERSION }} pd:${{ env.TIKV_VERSION }}
~/.tiup/bin/tiup playground ${{ env.TIKV_VERSION }} --mode tikv-slim --kv 3 --tag cluster --without-monitor --kv.config config/tikv.toml --pd.config config/pd.toml &
while :; do
echo "waiting cluster to be ready"
[[ "$(curl -I http://127.0.0.1:2379/pd/api/v1/regions 2>/dev/null | head -n 1 | cut -d$' ' -f2)" -ne "405" ]] || break
sleep 1
done
- name: Install latest nextest release
uses: taiki-e/install-action@nextest
- name: integration test
run: MULTI_REGION=1 make integration-test
- name: Integration test
run: MULTI_REGION=1 make ${{ matrix.case }}
- name: Upload logs
if: failure()
uses: actions/upload-artifact@v4
with:
name: cluster-logs
path: |
~/.tiup/data/cluster/tikv*/*.log
~/.tiup/data/cluster/pd*/*.log
14 changes: 7 additions & 7 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "tikv-client"
version = "0.3.0"
version = "0.4.0"
keywords = ["TiKV", "KV", "distributed-systems"]
license = "Apache-2.0"
authors = ["The TiKV Project Authors"]
Expand Down Expand Up @@ -41,22 +41,22 @@ regex = "1"
semver = "1.0"
serde = "1.0"
serde_derive = "1.0"
serde_json = "1"
take_mut = "0.2.2"
thiserror = "1"
tokio = { version = "1", features = ["sync", "rt-multi-thread", "macros"] }
tonic = { version = "0.10", features = ["tls"] }
tonic = { version = "0.10", features = ["tls", "gzip"] }

[dev-dependencies]
clap = "2"
env_logger = "0.10"
fail = { version = "0.4", features = ["failpoints"] }
proptest = "1"
proptest-derive = "0.3"
reqwest = { version = "0.11", default-features = false, features = [
"native-tls-vendored",
] }
proptest-derive = "0.5.1"
reqwest = { version = "0.11", features = ["json", "native-tls-vendored"] }
rstest = "0.18.2"
serde_json = "1"
serial_test = "0.5.0"
simple_logger = "1"
tempfile = "3.6"
tokio = { version = "1", features = ["sync", "rt-multi-thread", "macros"] }

Expand Down
21 changes: 14 additions & 7 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,13 +1,17 @@
export RUSTFLAGS=-Dwarnings

.PHONY: default check unit-test integration-tests test doc docker-pd docker-kv docker all
.PHONY: default check unit-test generate integration-tests integration-tests-txn integration-tests-raw test doc docker-pd docker-kv docker all

export PD_ADDRS ?= 127.0.0.1:2379
export MULTI_REGION ?= 1

ALL_FEATURES := integration-tests

INTEGRATION_TEST_ARGS := --features "integration-tests"
NEXTEST_ARGS := --config-file $(shell pwd)/config/nextest.toml

INTEGRATION_TEST_ARGS := --features "integration-tests" --test-threads 1

RUN_INTEGRATION_TEST := cargo nextest run ${NEXTEST_ARGS} --all ${INTEGRATION_TEST_ARGS}

default: check

Expand All @@ -20,12 +24,15 @@ check: generate
cargo clippy --all-targets --features "${ALL_FEATURES}" -- -D clippy::all

unit-test: generate
cargo nextest run --all --no-default-features
cargo nextest run ${NEXTEST_ARGS} --all --no-default-features

integration-test: integration-test-txn integration-test-raw

integration-test-txn: generate
$(RUN_INTEGRATION_TEST) txn_

integration-test: generate
cargo test txn_ --all ${INTEGRATION_TEST_ARGS} -- --nocapture
cargo test raw_ --all ${INTEGRATION_TEST_ARGS} -- --nocapture
cargo test misc_ --all ${INTEGRATION_TEST_ARGS} -- --nocapture
integration-test-raw: generate
$(RUN_INTEGRATION_TEST) raw_

test: unit-test integration-test

Expand Down
8 changes: 8 additions & 0 deletions OWNERS
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# See the OWNERS docs at https://www.kubernetes.dev/docs/guide/owners/#owners
# The members of 'sig-community-*' are synced from memberships defined in repository: https://github.com/tikv/community.
filters:
.*:
approvers:
- sig-community-approvers
reviewers:
- sig-community-reviewers
84 changes: 84 additions & 0 deletions OWNERS_ALIASES
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
# See the OWNERS docs at https://www.kubernetes.dev/docs/guide/owners/#owners_aliases
# The members of 'sig-community-*' are synced from memberships defined in repository: https://github.com/tikv/community.
aliases:
sig-community-reviewers:
- 3AceShowHand
- 3pointer
- CalvinNeo
- Fullstop000
- HuSharp
- Jibbow
- JmPotato
- Leavrth
- Mossaka
- MrCroxx
- Rustin170506
- Xuanwo
- ethercflow
- fredchenbj
- gozssky
- haojinming
- hbisheng
- hhwyt
- jayzhan211
- lcwangchao
- lhy1024
- longfangsong
- lzmhhh123
- mittalrishabh
- nolouch
- rleungx
- tier-cap
- wjhuang2016
- wshwsh12
sig-community-approvers:
- 5kbpers
- AndreMouche
- BusyJay
- Connor1996
- Little-Wallace
- LykxSassinator
- MyonKeminta
- NingLin-P
- SpadeA-Tang
- TennyZhuang
- YuJuncen
- andylokandy
- breezewish
- brson
- bufferflies
- cfzjywxk
- coocood
- crazycs520
- disksing
- ekexium
- gengliqi
- glorv
- hicqu
- hunterlxt
- imtbkcat
- innerr
- iosmanthus
- jackysp
- kennytm
- liuzix
- lonng
- lysu
- marsishandsome
- niedhui
- nrc
- overvenus
- pingyu
- skyzh
- sticnarf
- sunxiaoguang
- tabokie
- tonyxuqqi
- v01dstar
- yiwu-arbug
- you06
- youjiali1995
- zhangjinpeng87
- zhongzc
- zhouqiang-cl
- zyguan
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ The TiKV client is a Rust library (crate). To use this crate in your project, ad

```toml
[dependencies]
tikv-client = "0.3"
tikv-client = "0.4"
```

### Prerequisites
Expand All @@ -33,7 +33,7 @@ Raw mode:
```rust
use tikv_client::RawClient;

let client = RawClient::new(vec!["127.0.0.1:2379"], None).await?;
let client = RawClient::new(vec!["127.0.0.1:2379"]).await?;
client.put("key".to_owned(), "value".to_owned()).await?;
let value = client.get("key".to_owned()).await?;
```
Expand All @@ -43,7 +43,7 @@ Transactional mode:
```rust
use tikv_client::TransactionClient;

let txn_client = TransactionClient::new(vec!["127.0.0.1:2379"], None).await?;
let txn_client = TransactionClient::new(vec!["127.0.0.1:2379"]).await?;
let mut txn = txn_client.begin_optimistic().await?;
txn.put("key".to_owned(), "value".to_owned()).await?;
let value = txn.get("key".to_owned()).await?;
Expand Down
8 changes: 8 additions & 0 deletions config/nextest.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
[profile.ci]
retries = 0
fail-fast = false
slow-timeout = { period = "60s", terminate-after = 10 } # Timeout 10m. TODO: speed up the slow tests.
failure-output = "final"

[profile.ci.junit]
path = "junit.xml"
8 changes: 8 additions & 0 deletions config/tikv.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,11 @@ max-open-files = 10000

[raftdb]
max-open-files = 10000

[storage]
api-version = 2
enable-ttl = true
reserve-space = "0MiB"

[server]
grpc-compression-type = "gzip"
4 changes: 3 additions & 1 deletion examples/pessimistic.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,9 @@ async fn main() {
Config::default().with_security(ca, cert, key)
} else {
Config::default()
};
}
// This example uses the default keyspace, so api-v2 must be enabled on the server.
.with_default_keyspace();

// init
let client = Client::new_with_config(args.pd, config)
Expand Down
8 changes: 6 additions & 2 deletions examples/raw.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,9 @@ async fn main() -> Result<()> {
Config::default().with_security(ca, cert, key)
} else {
Config::default()
};
}
// This example uses the default keyspace, so api-v2 must be enabled on the server.
.with_default_keyspace();

// When we first create a client we receive a `Connect` structure which must be resolved before
// the client is actually connected and usable.
Expand Down Expand Up @@ -136,6 +138,8 @@ async fn main() -> Result<()> {
);
println!("Scanning batch scan from {batch_scan_keys:?} gives: {vals:?}");

// Cleanly exit.
// Delete all keys in the whole range.
client.delete_range("".to_owned().."".to_owned()).await?;

Ok(())
}
4 changes: 3 additions & 1 deletion examples/transaction.rs
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,9 @@ async fn main() {
Config::default().with_security(ca, cert, key)
} else {
Config::default()
};
}
// This example uses the default keyspace, so api-v2 must be enabled on the server.
.with_default_keyspace();

let txn = Client::new_with_config(args.pd, config)
.await
Expand Down
2 changes: 1 addition & 1 deletion proto-build/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,4 @@ edition = "2021"

[dependencies]
glob = "0.3"
tonic-build = { version = "0.10", features = ["cleanup-markdown"] }
tonic-build = { version = "0.10", features = ["cleanup-markdown"] }
47 changes: 47 additions & 0 deletions proto/autoid.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
syntax = "proto3";
package autoid;

import "gogoproto/gogo.proto";
import "rustproto.proto";

option (gogoproto.sizer_all) = true;
option (gogoproto.marshaler_all) = true;
option (gogoproto.unmarshaler_all) = true;
option (rustproto.lite_runtime_all) = true;

option java_package = "org.tikv.kvproto";

message AutoIDRequest {
int64 dbID = 1;
int64 tblID = 2;
bool isUnsigned = 3;
uint64 n = 4;
int64 increment = 5;
int64 offset = 6;
uint32 keyspaceID = 7;
}

message AutoIDResponse {
int64 min = 1;
int64 max = 2;

bytes errmsg = 3;
}

message RebaseRequest {
int64 dbID = 1;
int64 tblID = 2;
bool isUnsigned = 3;
int64 base = 4;
bool force = 5;
}

message RebaseResponse {
bytes errmsg = 1;
}

service AutoIDAlloc {
rpc AllocAutoID(AutoIDRequest) returns (AutoIDResponse) {}
rpc Rebase(RebaseRequest) returns (RebaseResponse) {}
}

Loading