feat(tikv): add keyspace API V2 support#1
Open
IANTHEREAL wants to merge 4 commits into
Open
Conversation
When `?keyspace=<name>` is present in the TiKV meta URL, the client uses API V2 with the specified keyspace. This enables per-tenant metadata isolation on shared TiKV clusters. Usage: tikv://pd:2379?keyspace=jfs_t_tenant1 tikv://pd:2379?keyspace=jfs_t_tenant1&ca=/tls/ca.crt&cert=/tls/tls.crt&key=/tls/tls.key Without `?keyspace=`, behavior is unchanged (default keyspace, API V1). Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Used after TiKV BR clone to prevent slice ID collision between original and cloned volumes. offset=0 reads the current counter, offset>0 atomically increments and returns the new value. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-authored-by: Ubuntu <ubuntu@ip-172-31-55-110.us-west-2.compute.internal>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Add
?keyspace=<name>URL parameter support for TiKV metadata backend. When present, the client uses TiKV API V2 with per-keyspace isolation.This enables the FS V3.5 per-tenant volume architecture where each tenant's JuiceFS metadata is isolated in its own TiKV keyspace.
Usage
Change
11 lines in
pkg/meta/tkv_tikv.go— passestxnkv.WithKeyspace()+txnkv.WithAPIVersion(V2)totxnkv.NewClient()when keyspace parameter is present.Test plan
juicefs format tikv://pd:2379?keyspace=test_ks ...creates volume in isolated keyspacejuicefs mount tikv://pd:2379?keyspace=test_ks ...mounts successfully?keyspace=, existing behavior unchangedca=,cert=,key=) + keyspace, both work together🤖 Generated with Claude Code