• Stars
    star
    268
  • Rank 148,066 (Top 3 %)
  • Language
    Go
  • License
    Apache License 2.0
  • Created over 5 years ago
  • Updated 23 days ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Go client for TiKV

TiKV Go Client

TiKV Go Client provides support for interacting with the TiKV server in the form of a Go library.

Stability Active Go Reference

Unit Test Integration Test Compatibility Test

Package versions

There are 2 major versions of the client-go package.

  • v2 is the latest stable version. This version was extracted from pingcap/tidb and it includes new TiKV features like Follower Read, 1PC, Async Commit. The development of this version is on the master branch. The documentation for this version is below.

  • v1 is the previous stable version and is only maintained for bug fixes. You can read the documentation here.

Usage/Examples

  # valid versions be like @latest, @e5f932ae270887550b0cd221343dbd6b870b6c8f, @v2.0.0, @v2.0.1...
  go get github.com/tikv/client-go/v2@COMMIT_HASH_OR_TAG_VERSION

Explanation of related concepts and sample code can be found in the Client-Go Wiki. There are also executable examples in examples directory.

Contributing to client-go

Pull Requests and issues are welcomed. Please check CONTRIBUTING.md.

Developing

Running Tests

Note: All the following tests are included in the CI and you can submit a Pull Request directly to hand over the work.

To run unit tests, use following command

go test ./...

To run code linter, make sure golangci-lint is installed. Then use following command

golangci-lint run

integration_tests can run against a real TiKV cluster. Here is an example:

./pd-server &
sleep 5
./tikv-server &
sleep 10
cd integration_tests
go test --with-tikv

Test with TiDB

It is a common task to update client-go and then test it with TiDB.

If you only need to test locally, you can directly use the modified client-go on the same host by replacing:

go mod edit -replace=github.com/tikv/client-go/v2=/path/to/client-go

If you want to push your TiDB code to GitHub for running CI or for code review, you need to change the client-go used by TiDB to your developing branch using the following steps:

go get -d github.com/GITHUB_USERNAME/client-go/v2@DEV_BRANCH
# Output:
# go get: github.com/GITHUB_USERNAME/client-go/v2@none updating to
#         github.com/GITHUB_USERNAME/client-go/[email protected]: parsing go.mod:
#         module declares its path as: github.com/tikv/client-go/v2
#                 but was required as: github.com/GITHUB_USERNAME/client-go/v2
go mod edit -replace=github.com/tikv/client-go/v2=github.com/GITHUB_USERNAME/client-go/[email protected]
go mod download github.com/tikv/client-go/v2

Used By

client-go is used by the following projects:

  • TiDB: TiDB is an open source distributed HTAP database compatible with the MySQL protocol
  • BR: A command-line tool for distributed backup and restoration of the TiDB cluster data
  • TiCDC: Change data capture for TiDB
  • go-ycsb: A Go port of Yahoo! Cloud Serving Benchmark (YCSB)
  • JuiceFS: JuiceFS is a distributed POSIX file system built on top of Redis and S3
  • tcli: A CLI tool for TiKV, for human being :)

License

Apache License 2.0

More Repositories

1

tikv

Distributed transactional key-value database, originally created to complement TiDB
Rust
14,548
star
2

raft-rs

Raft distributed consensus algorithm implemented in Rust.
Rust
2,785
star
3

grpc-rs

The gRPC library for Rust built on C Core library and futures
Rust
1,775
star
4

pprof-rs

A Rust CPU profiler implemented with the help of backtrace-rs
Rust
1,198
star
5

pd

Placement driver for TiKV
Go
1,022
star
6

rust-prometheus

Prometheus instrumentation library for Rust applications
Rust
1,017
star
7

agatedb

A persistent key-value storage in rust.
Rust
793
star
8

minitrace-rust

Extremely fast tracing library for Rust
Rust
659
star
9

raft-engine

A persistent storage engine for Multi-Raft log
Rust
521
star
10

titan

A RocksDB plugin for key-value separation, inspired by WiscKey.
C++
466
star
11

client-rust

Rust Client for TiKV.
Rust
368
star
12

fail-rs

Fail points for rust
Rust
322
star
13

minstant

Performant time measuring in Rust
Rust
151
star
14

yatp

Yet another thread pool in rust for both callbacks or futures.
Rust
129
star
15

client-java

TiKV Java Client
Java
106
star
16

deep-dive-tikv

How do we build a distributed, transactional key-value database - TiKV?
HTML
97
star
17

rfcs

RFCs for changes to TiKV and its ecosystem
76
star
18

auto-tikv

Tool to tune TiKV with ML method
Python
66
star
19

sig-transaction

Resources for the transaction SIG
61
star
20

async-speed-limit

Asynchronously speed-limiting multiple byte streams
Rust
53
star
21

minitrace-go

A high-performance timeline tracing library for Golang, used by TiDB
Go
45
star
22

community

TiKV community content
43
star
23

client-c

The C++ TiKV client used by TiFlash.
C++
41
star
24

crc64fast

SIMD accelerated CRC-64-ECMA computation
Rust
40
star
25

migration

Migration tools for TiKV, e.g. online bulk load.
Go
34
star
26

tikv-dev-guide

The TiKV development/contribution guide
34
star
27

client-py

Rust
26
star
28

importer

tikv-importer is a front-end to help ingesting large number of KV pairs into a TiKV cluster
Rust
20
star
29

website

Website for tikv.org
HTML
19
star
30

tikv-operator

Go
19
star
31

protobuf-build

Rust
17
star
32

client-cpp

TiKV Client for C++
Rust
15
star
33

client-node

Rust
11
star
34

mur3

Rust implementation of MurmurHash3.
Rust
10
star
35

copr-test

Go
9
star
36

mock-tikv

A mocked TiKV server for testing clients that written in different languages.
Go
6
star
37

slog-global

Global loggers for slog-rs. Similar to slog-scope but more simple.
Rust
5
star
38

match-template

match-template is a procedural macro that generates repeated match arms by pattern.
Rust
5
star
39

jepsen-test

Clojure
5
star
40

terraform-tikv-bench

An Orcestrated TiKV benchmark. Not for production deployment.
HCL
4
star
41

skiplist-rs

Rust
4
star
42

client-validator

Provide functional checks for tikv client implementations in different languages.
Go
3
star
43

tracing-active-tree

Rust
3
star
44

tlaplus-specs

TiKV TLA+ specifications
TLA
3
star