From 8f034c26b33af57e06aafbfd051dd7318e9a2771 Mon Sep 17 00:00:00 2001 From: Ping Yu Date: Tue, 20 Jan 2026 21:20:28 +0800 Subject: [PATCH 1/3] keyspace: Remove the "apiv2-no-prefix" feature Signed-off-by: Ping Yu --- Cargo.toml | 1 - Makefile | 4 ++-- src/request/keyspace.rs | 8 ++------ src/transaction/client.rs | 1 - 4 files changed, 4 insertions(+), 10 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 8d6cd57d..c66ba1fc 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -14,7 +14,6 @@ prometheus = ["prometheus/push", "prometheus/process"] # Enable integration tests with a running TiKV and PD instance. # Use $PD_ADDRS, comma separated, to set the addresses the tests use. integration-tests = [] -apiv2-no-prefix = [] [lib] name = "tikv_client" diff --git a/Makefile b/Makefile index 6e22ead3..ef3fd397 100644 --- a/Makefile +++ b/Makefile @@ -5,11 +5,11 @@ export RUSTFLAGS=-Dwarnings export PD_ADDRS ?= 127.0.0.1:2379 export MULTI_REGION ?= 1 -ALL_FEATURES := integration-tests apiv2-no-prefix +ALL_FEATURES := integration-tests NEXTEST_ARGS := --config-file $(shell pwd)/config/nextest.toml -INTEGRATION_TEST_ARGS := --features "integration-tests apiv2-no-prefix" --test-threads 1 +INTEGRATION_TEST_ARGS := --features "integration-tests" --test-threads 1 RUN_INTEGRATION_TEST := cargo nextest run ${NEXTEST_ARGS} --all ${INTEGRATION_TEST_ARGS} diff --git a/src/request/keyspace.rs b/src/request/keyspace.rs index 94fd5f76..7c9c121a 100644 --- a/src/request/keyspace.rs +++ b/src/request/keyspace.rs @@ -12,7 +12,8 @@ pub const RAW_KEY_PREFIX: u8 = b'r'; pub const TXN_KEY_PREFIX: u8 = b'x'; pub const KEYSPACE_PREFIX_LEN: usize = 4; -#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize)] +#[derive(Debug, Clone, Copy, PartialEq, Eq)] +#[non_exhaustive] pub enum Keyspace { Disable, Enable { @@ -23,7 +24,6 @@ pub enum Keyspace { /// This mode is intended for **server-side embedding** use cases (e.g. embedding this client in /// `tikv-server`) where keys are already in API V2 "logical key bytes" form and must be passed /// through unchanged. - #[cfg(feature = "apiv2-no-prefix")] ApiV2NoPrefix, } @@ -38,7 +38,6 @@ impl Keyspace { match self { Keyspace::Disable => kvrpcpb::ApiVersion::V1, Keyspace::Enable { .. } => kvrpcpb::ApiVersion::V2, - #[cfg(feature = "apiv2-no-prefix")] Keyspace::ApiV2NoPrefix => kvrpcpb::ApiVersion::V2, } } @@ -293,7 +292,6 @@ mod tests { assert_eq!(key.truncate_keyspace(keyspace), expected_key); } - #[cfg(feature = "apiv2-no-prefix")] #[test] fn test_apiv2_no_prefix_api_version() { assert_eq!( @@ -302,7 +300,6 @@ mod tests { ); } - #[cfg(feature = "apiv2-no-prefix")] #[test] fn test_apiv2_no_prefix_encode_is_noop() { let keyspace = Keyspace::ApiV2NoPrefix; @@ -325,7 +322,6 @@ mod tests { ); } - #[cfg(feature = "apiv2-no-prefix")] #[test] fn test_apiv2_no_prefix_truncate_is_noop() { let keyspace = Keyspace::ApiV2NoPrefix; diff --git a/src/transaction/client.rs b/src/transaction/client.rs index 22873b0c..e28d452a 100644 --- a/src/transaction/client.rs +++ b/src/transaction/client.rs @@ -125,7 +125,6 @@ impl Client { /// keyspace/key-mode prefix, with a custom configuration. /// /// This is intended for **server-side embedding** use cases. `config.keyspace` must be unset. - #[cfg(feature = "apiv2-no-prefix")] pub async fn new_with_config_api_v2_no_prefix>( pd_endpoints: Vec, config: Config, From cf73b7f2fae24ff0e81fffaadb4b4d0330f5a428 Mon Sep 17 00:00:00 2001 From: Ping Yu Date: Tue, 20 Jan 2026 21:37:00 +0800 Subject: [PATCH 2/3] fix docs Signed-off-by: Ping Yu --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 3841cf63..7e5e6d9a 100644 --- a/README.md +++ b/README.md @@ -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 From 8bd04b170e561023a9c91f6d2ea2e1fb2928ca5a Mon Sep 17 00:00:00 2001 From: Ping Yu Date: Tue, 20 Jan 2026 21:45:50 +0800 Subject: [PATCH 3/3] revert derive removal Signed-off-by: Ping Yu --- src/request/keyspace.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/request/keyspace.rs b/src/request/keyspace.rs index 7c9c121a..35ad4e64 100644 --- a/src/request/keyspace.rs +++ b/src/request/keyspace.rs @@ -12,7 +12,7 @@ pub const RAW_KEY_PREFIX: u8 = b'r'; pub const TXN_KEY_PREFIX: u8 = b'x'; pub const KEYSPACE_PREFIX_LEN: usize = 4; -#[derive(Debug, Clone, Copy, PartialEq, Eq)] +#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize)] #[non_exhaustive] pub enum Keyspace { Disable,