Giter Site home page Giter Site logo

tikv / tikv Goto Github PK

View Code? Open in Web Editor NEW
14.5K 308.0 2.1K 102.71 MB

Distributed transactional key-value database, originally created to complement TiDB

Home Page: https://tikv.org

License: Apache License 2.0

Rust 97.36% Makefile 0.07% Shell 0.06% Python 1.65% Dockerfile 0.02% C 0.03% Perl 0.81%
distributed-transactions raft rust key-value tikv consensus rocksdb tidb cncf hacktoberfest

tikv's Introduction

tikv_logo

Build Status Coverage Status CII Best Practices

TiKV is an open-source, distributed, and transactional key-value database. Unlike other traditional NoSQL systems, TiKV not only provides classical key-value APIs, but also transactional APIs with ACID compliance. Built in Rust and powered by Raft, TiKV was originally created by PingCAP to complement TiDB, a distributed HTAP database compatible with the MySQL protocol.

The design of TiKV ('Ti' stands for titanium) is inspired by some great distributed systems from Google, such as BigTable, Spanner, and Percolator, and some of the latest achievements in academia in recent years, such as the Raft consensus algorithm.

If you're interested in contributing to TiKV, or want to build it from source, see CONTRIBUTING.md.

cncf_logo cncf_logo

TiKV is a graduated project of the Cloud Native Computing Foundation (CNCF). If you are an organization that wants to help shape the evolution of technologies that are container-packaged, dynamically-scheduled and microservices-oriented, consider joining the CNCF. For details about who's involved and how TiKV plays a role, read the CNCF announcement.


With the implementation of the Raft consensus algorithm in Rust and consensus state stored in RocksDB, TiKV guarantees data consistency. Placement Driver (PD), which is introduced to implement auto-sharding, enables automatic data migration. The transaction model is similar to Google's Percolator with some performance improvements. TiKV also provides snapshot isolation (SI), snapshot isolation with lock (SQL: SELECT ... FOR UPDATE), and externally consistent reads and writes in distributed transactions.

TiKV has the following key features:

  • Geo-Replication

    TiKV uses Raft and the Placement Driver to support Geo-Replication.

  • Horizontal scalability

    With PD and carefully designed Raft groups, TiKV excels in horizontal scalability and can easily scale to 100+ TBs of data.

  • Consistent distributed transactions

    Similar to Google's Spanner, TiKV supports externally-consistent distributed transactions.

  • Coprocessor support

    Similar to HBase, TiKV implements a coprocessor framework to support distributed computing.

  • Cooperates with TiDB

    Thanks to the internal optimization, TiKV and TiDB can work together to be a compelling database solution with high horizontal scalability, externally-consistent transactions, support for RDBMS, and NoSQL design patterns.

Governance

See Governance.

Documentation

For instructions on deployment, configuration, and maintenance of TiKV,see TiKV documentation on our website. For more details on concepts and designs behind TiKV, see Deep Dive TiKV.

Note:

We have migrated our documentation from the TiKV's wiki page to the official website. The original Wiki page is discontinued. If you have any suggestions or issues regarding documentation, offer your feedback here.

TiKV adopters

You can view the list of TiKV Adopters.

TiKV software stack

The TiKV software stack

  • Placement Driver: PD is the cluster manager of TiKV, which periodically checks replication constraints to balance load and data automatically.
  • Store: There is a RocksDB within each Store and it stores data into the local disk.
  • Region: Region is the basic unit of Key-Value data movement. Each Region is replicated to multiple Nodes. These multiple replicas form a Raft group.
  • Node: A physical node in the cluster. Within each node, there are one or more Stores. Within each Store, there are many Regions.

When a node starts, the metadata of the Node, Store and Region are recorded into PD. The status of each Region and Store is reported to PD regularly.

Quick start

Deploy a playground with TiUP

The most quickest to try out TiKV with TiDB is using TiUP, a component manager for TiDB.

You can see this page for a step by step tutorial.

Deploy a playground with binary

TiKV is able to run separately with PD, which is the minimal deployment required.

  1. Download and extract binaries.
$ export TIKV_VERSION=v4.0.12
$ export GOOS=darwin  # only {darwin, linux} are supported
$ export GOARCH=amd64 # only {amd64, arm64} are supported
$ curl -O  https://tiup-mirrors.pingcap.com/tikv-$TIKV_VERSION-$GOOS-$GOARCH.tar.gz
$ curl -O  https://tiup-mirrors.pingcap.com/pd-$TIKV_VERSION-$GOOS-$GOARCH.tar.gz
$ tar -xzf tikv-$TIKV_VERSION-$GOOS-$GOARCH.tar.gz
$ tar -xzf pd-$TIKV_VERSION-$GOOS-$GOARCH.tar.gz
  1. Start PD instance.
$ ./pd-server --name=pd --data-dir=/tmp/pd/data --client-urls="http://127.0.0.1:2379" --peer-urls="http://127.0.0.1:2380" --initial-cluster="pd=http://127.0.0.1:2380" --log-file=/tmp/pd/log/pd.log
  1. Start TiKV instance.
$ ./tikv-server --pd-endpoints="127.0.0.1:2379" --addr="127.0.0.1:20160" --data-dir=/tmp/tikv/data --log-file=/tmp/tikv/log/tikv.log
  1. Install TiKV Client(Python) and verify the deployment, required Python 3.5+.
$ pip3 install -i https://test.pypi.org/simple/ tikv-client
from tikv_client import RawClient

client = RawClient.connect("127.0.0.1:2379")

client.put(b'foo', b'bar')
print(client.get(b'foo')) # b'bar'

client.put(b'foo', b'baz')
print(client.get(b'foo')) # b'baz'

Deploy a cluster with TiUP

You can see this manual of production-like cluster deployment presented by @c4pt0r.

Build from source

See CONTRIBUTING.md.

Client drivers

If you want to try the Go client, see Go Client.

Security

Security audit

A third-party security auditing was performed by Cure53. See the full report here.

Reporting Security Vulnerabilities

To report a security vulnerability, please send an email to TiKV-security group.

See Security for the process and policy followed by the TiKV project.

Communication

Communication within the TiKV community abides by TiKV Code of Conduct. Here is an excerpt:

In the interest of fostering an open and welcoming environment, we as contributors and maintainers pledge to making participation in our project and our community a harassment-free experience for everyone, regardless of age, body size, disability, ethnicity, sex characteristics, gender identity and expression, level of experience, education, socio-economic status, nationality, personal appearance, race, religion, or sexual identity and orientation.

Social Media

Slack

Join the TiKV community on Slack - Sign up and join channels on TiKV topics that interest you.

License

TiKV is under the Apache 2.0 license. See the LICENSE file for details.

Acknowledgments

  • Thanks etcd for providing some great open source tools.
  • Thanks RocksDB for their powerful storage engines.
  • Thanks rust-clippy. We do love the great project.

tikv's People

Contributors

5kbpers avatar andremouche avatar breezewish avatar brson avatar busyjay avatar connor1996 avatar disksing avatar gengliqi avatar glorv avatar hhkbp2 avatar hicqu avatar huachaohuang avatar hunterlxt avatar jmpotato avatar little-wallace avatar lonng avatar morefreeze avatar myonkeminta avatar ngaut avatar ninglin-p avatar overvenus avatar siddontang avatar spadea-tang avatar sticnarf avatar tabokie avatar tonyxuqqi avatar yiwu-arbug avatar youjiali1995 avatar yujuncen avatar zhangjinpeng87 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

tikv's Issues

Call stale callback

When leadership changes, some pending command may never get called. We should handle this to make client failed more quickly and avoid timeout in tests.

Client CLI?

Hi,

I could not find the client CLI either in pingcap/tikv or in pingcap/ticlient.

Is there any plan for the client CLI?

I think CLI is useful when a user wants to verify whether he/she successfully deployed TiKV cluster before deploying TiDB.

It should be also useful for interactive debugging purpose.

compiler error

[samuel@localhost tikv]$ make
cargo build --features dev
Compiling rustc-serialize v0.3.19
Compiling getopts v0.2.14
Compiling slab v0.1.3
Compiling log v0.3.6
Compiling winapi-build v0.1.1
Compiling kernel32-sys v0.2.2
Compiling protobuf v1.0.18 (https://github.com/stepancheg/rust-protobuf.git#a917d77d)
Compiling libc v0.2.10
Compiling rand v0.3.14
Compiling uuid v0.1.18
Compiling tempdir v0.3.4
Compiling bitflags v0.3.3
Compiling nix v0.5.0-pre (https://github.com/carllerche/nix-rust?rev=c4257f8a76#c4257f8a)
Compiling quine-mc_cluskey v0.2.2
Compiling winapi v0.2.6
Compiling libc v0.1.12
Compiling byteorder v0.4.2
Compiling tipb v0.0.1 (https://github.com/pingcap/tipb.git#3df1b085)
Compiling unicode-normalization v0.1.2
Compiling threadpool v1.0.0
Compiling kvproto v0.0.1 (https://github.com/pingcap/kvproto#dcb7cad2)
Compiling regex-syntax v0.3.1
Compiling nom v1.2.2
Compiling bytes v0.3.0
Compiling cfg-if v0.1.0
Compiling semver v0.2.3
Compiling librocksdb_sys v0.1.0 (https://github.com/ngaut/rust-rocksdb.git#015e65bb)
Compiling rocksdb v0.3.0 (https://github.com/ngaut/rust-rocksdb.git#015e65bb)
Compiling bytes v0.3.0 (https://github.com/carllerche/bytes#12dfc417)
Compiling time v0.1.35
Compiling quick-error v0.2.2
Compiling toml v0.1.28
Compiling clippy v0.0.63
/home/samuel/.cargo/registry/src/github.com-88ac128001ac3a9a/clippy-0.0.63/src/utils/hir.rs:335:13: 335:39 error: this pattern has 3 fields, but the corresponding variant has 4 fields [E0023]
/home/samuel/.cargo/registry/src/github.com-88ac128001ac3a9a/clippy-0.0.63/src/utils/hir.rs:335 ExprClosure(cap, , ref b) => {
^~~~~~~~~~~~~~~~~~~~~~~~~~
/home/samuel/.cargo/registry/src/github.com-88ac128001ac3a9a/clippy-0.0.63/src/utils/hir.rs:335:13: 335:39 help: run rustc --explain E0023 to see a detailed explanation
/home/samuel/.cargo/registry/src/github.com-88ac128001ac3a9a/clippy-0.0.63/src/utils/hir.rs:336:43: 336:54 error: mismatched types:
expected fn(_, _, _) -> _,
foundfn(rustc::hir::CaptureClause, syntax::ptr::Prustc::hir::FnDecl, syntax::ptr::Prustc::hir::Block, syntax::codemap::Span) -> rustc::hir::Expr_ {rustc::hir::ExprClosure}(incorrect number of function parameters) [E0308]
/home/samuel/.cargo/registry/src/github.com-88ac128001ac3a9a/clippy-0.0.63/src/utils/hir.rs:336 let c: fn(
, , ) -> _ = ExprClosure;
^~~~~~~~~~~
/home/samuel/.cargo/registry/src/github.com-88ac128001ac3a9a/clippy-0.0.63/src/utils/hir.rs:336:43: 336:54 help: runrustc --explain E0308to see a detailed explanation
/home/samuel/.cargo/registry/src/github.com-88ac128001ac3a9a/clippy-0.0.63/src/block_in_if_condition.rs:46:16: 46:44 error: this pattern has 3 fields, but the corresponding variant has 4 fields [E0023]
/home/samuel/.cargo/registry/src/github.com-88ac128001ac3a9a/clippy-0.0.63/src/block_in_if_condition.rs:46 if let ExprClosure(
, , ref block) = expr.node {
^~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/samuel/.cargo/registry/src/github.com-88ac128001ac3a9a/clippy-0.0.63/src/block_in_if_condition.rs:46:16: 46:44 help: runrustc --explain E0023to see a detailed explanation
/home/samuel/.cargo/registry/src/github.com-88ac128001ac3a9a/clippy-0.0.63/src/eta_reduction.rs:43:12: 43:45 error: this pattern has 3 fields, but the corresponding variant has 4 fields [E0023]
/home/samuel/.cargo/registry/src/github.com-88ac128001ac3a9a/clippy-0.0.63/src/eta_reduction.rs:43 if let ExprClosure(
, ref decl, ref blk) = expr.node {
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/samuel/.cargo/registry/src/github.com-88ac128001ac3a9a/clippy-0.0.63/src/eta_reduction.rs:43:12: 43:45 help: runrustc --explain E0023to see a detailed explanation
/home/samuel/.cargo/registry/src/github.com-88ac128001ac3a9a/clippy-0.0.63/src/map_clone.rs:29:21: 29:54 error: this pattern has 3 fields, but the corresponding variant has 4 fields [E0023]
/home/samuel/.cargo/registry/src/github.com-88ac128001ac3a9a/clippy-0.0.63/src/map_clone.rs:29 ExprClosure(
, ref decl, ref blk) => {
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/samuel/.cargo/registry/src/github.com-88ac128001ac3a9a/clippy-0.0.63/src/map_clone.rs:29:21: 29:54 help: runrustc --explain E0023to see a detailed explanation
/home/samuel/.cargo/registry/src/github.com-88ac128001ac3a9a/clippy-0.0.63/src/misc_early.rs:131:24: 131:65 error: this pattern has 3 fields, but the corresponding variant has 4 fields [E0023]
/home/samuel/.cargo/registry/src/github.com-88ac128001ac3a9a/clippy-0.0.63/src/misc_early.rs:131 if let ExprKind::Closure(, ref decl, ref block) = closure.node {
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/samuel/.cargo/registry/src/github.com-88ac128001ac3a9a/clippy-0.0.63/src/misc_early.rs:131:24: 131:65 help: runrustc --explain E0023to see a detailed explanation
/home/samuel/.cargo/registry/src/github.com-88ac128001ac3a9a/clippy-0.0.63/src/misc_early.rs:153:21: 153:45 error: this pattern has 3 fields, but the corresponding variant has 4 fields [E0023]
/home/samuel/.cargo/registry/src/github.com-88ac128001ac3a9a/clippy-0.0.63/src/misc_early.rs:153 let ExprKind::Closure(
,,) = t.node,
^~~~~~~~~~~~~~~~~~~~~~~~
/home/samuel/.cargo/registry/src/github.com-88ac128001ac3a9a/clippy-0.0.63/src/misc_early.rs:153:21: 153:45 note: in this expansion of if_let_chain! (defined in /home/samuel/.cargo/registry/src/github.com-88ac128001ac3a9a/clippy-0.0.63/src/utils/mod.rs)
/home/samuel/.cargo/registry/src/github.com-88ac128001ac3a9a/clippy-0.0.63/src/misc_early.rs:153:21: 153:45 note: in this expansion of if_let_chain! (defined in /home/samuel/.cargo/registry/src/github.com-88ac128001ac3a9a/clippy-0.0.63/src/utils/mod.rs)
/home/samuel/.cargo/registry/src/github.com-88ac128001ac3a9a/clippy-0.0.63/src/misc_early.rs:153:21: 153:45 note: in this expansion of if_let_chain! (defined in /home/samuel/.cargo/registry/src/github.com-88ac128001ac3a9a/clippy-0.0.63/src/utils/mod.rs)
/home/samuel/.cargo/registry/src/github.com-88ac128001ac3a9a/clippy-0.0.63/src/misc_early.rs:153:21: 153:45 help: runrustc --explain E0023to see a detailed explanation
error: aborting due to 7 previous errors
error: Could not compileclippy.

To learn more, run the command again with --verbose.

use hyper mio

This is the detailed first step for #522. Using hyper + mio is a very huge project, and I will send multi PRs step by step.

  • Introduce hyper + mio, add a web framework, this won't affect current logic.
  • Support http server handler + transport, this won't affect current logic.
  • Using http instead of current network mode. Of course, we should change tikv + ticlient at same time.
  • Remove old code, like server.rs, etc.., and rename http files to proper name.

Split may fail in some peers when others finish too early.

When finish applying split, new peer may start campaign after election timeout (or when it finish split if it's leader), which will send a RequestVote to other peers. If later nodes have not finished split yet, they will create an empty peer and vote for the former. Then they start splitting, but will fail due to initial state check.

support pd server lists

@disksing

Now we only pass one pd server address, but we should use a list like addr1,addr2,addr3 instead.

If the client connects a pd which is not a leader, the pd now will close it immediately (later we may return a NotLeader error).

The client will use the address list one by one, try to connect, if connected, we can think the server is the leader now.

If the leader crashed, the client will try to find another leader. Attention here, the pd will use some time (maybe 5s later depending on its configuration) to select the leader again.

simulator for teasing out race conditions, fault injection

For building a robust distributed stateful system, it's a great idea to employ some more sophisticated distributed systems testing techniques, like running instances in a simulator that deterministically induces various interleavings of failures, and comparing resulting state to ensure various desired invariants have held. I started down that path a bit with this: https://github.com/disasters/rasputin/blob/master/test/cluster.rs which I used for getting rasputin's consensus mechanism a bit more robust. I would strongly recommend doing something similar by:

  1. genericizing any sources of time, so that they can be passed in by the simulator (see how rasputin has a generic clock)
  2. making the transport layer generic so that you can plug several instances into a test harness that simulates network failures
  3. implementing quickcheck's Arbitrary for the simulator such that it generates sequences of failure conditions interleaved with mutation commands, delays, and creating properties that test certain recovery semantics. If you're interested in examples of using quickcheck to generate sequences of operations that are then checked against, check out this example from the crdts crate

test cases enhancement

  • snapshot overlap
  • split brain

snapshot overlap

Region 1 has peer A B C and A is leader. Region 1 split became Region 1 and Region 2.
Region 2 has peer D E F and D is leader, which use the same store with A B C.
C don't know split operation is committed due to network latency yet

Suppose we have those message sequence:
D heartbeat message came to store...
F is created using D's snapshot...
peer C get the delayed split message...
C apply split operation and overwrite F
F lose data?

split brain

Peer A B C, and C partition with A B.
add Peer D E F to cluster, then remove A B
now D E F is the new cluster
C network recover and send message to A B
C A B became a cluster...
they both serve for the same region, i.e split brain

disable compact log when sending snapshot.

Let's consider following case:

First add two peers in raft region a, 1, 2, 1 is leader, then add 3.
1 may send snapshot to 3, but unlucky, after 3 finishes applying snapshot, 1 has already done a compact log, so 1 and 3 have gap logs, 1 will send snapshot again, but if 1 did compact log before 3 applying snapshot, loop again.

So we should disable compacting log when doing snapshot. After leader guarantee that all peers catch up it, we can allow compacting again.

@ngaut @BusyJay

Add prefix/namespace support to KV

Currently we can't run multiple tests concurrently because of isolation. We need an isolation mechanism.
So TiDB make use it like:

Open(DSN + prefix)

And we can reuse lots of tests.
TiDB may also use environment variable to define DSN.

update store meta to pd regularly.

Now we only update store meta to pd when raft server starts, we should update this regular later.

Pd will use these to check wether the store is alive and can make a decision on auto-balance, e,g, if a store has many regions or uses many disk spaces, pd may not choose it firstly for conf change add peer.

Use another connection to send snapshot

If snapshot is too large, it will block pending heartbeat, which may cause a new round of election. In the worst case, it will cause TiKV to stop responding for a long time, which may crash TiDB.

use same IO framework for kvserver and raftserver.

This is a very huge change, I will do it in following steps.

  • Extract a common server package.
  • First let raft server use it, check in test first.
  • Add storage and support kv command handling, check in test first.
  • Refactor RaftStorage, only use Node.
  • Put all in tikv-server.
  • Remove kvserver and raftserver/server mod.

re-add peer id

We want to simplify code before, but meet a bug and may meet other bugs later, so the best choice is to re-add the peer id again.

For #528

refactor to support HTTP/1.1 -> HTTP/2 -> gRPC.

We should do it step by step.

  • hyper + mio, here we just use HTTP/1.1, this will drop the performance, especially for raft message transmission. We will keep origin protobuf protocol and post it in http body, and we will support SSL too.
  • communicate pd with http. This needs pd to support HTTP too, of course, it is very easy in Go.
  • define our own middleware or use iron, iron now doesn't support hyper + mio, but it may easy to support it with a little work. In addition, it is not hard to implement ourself too.
  • restful, we just need a simple restful API: simple routing, passing data in url args or with post form instead of origin posting protobuf.
  • import solicit HTTP/2, we can wait hyper to do it but I guess we may do ourself first and send hyper the PR.
  • gRPC, we should wait https://github.com/stepancheg/rust-protobuf to support fully protobuf version 3, or find another way to do it.

@ngaut @BusyJay @disksing @tiancaiamao @qiuyesuifeng

Ignore handling ready exec_results after ChangePeer remove ourself.

Let's consider following case:

Three peer in raft, 1, 2, 3. 1 is leader.

Do ConfChange remove 3, 1 will first append to its log first, but 1 sends this log to 2 and 3 failed.
Then another command like CompactLog comes, 1 appends to logs too and then try to send again, at this time, these two logs are sent ok.

3 receives the logs and then applies, after applying ok, 3 will handle the execution result in on_ready_result, destroy itself, but for next CompactLog, a panic happens because now we have no peer for 3 in region_peers.

Because CompactLog doesn't check epoch, so we can check whether region_peers has this peer directly.
But for other admin logs, we should check epoch in applying. E,g, the first log is ChangePeer remove 3 for region 1 (1 -> 1 and 2), and the next log is Split region 1. We don't allow 3 to apply these logs. If allowed, 3 will save new region info in rocksdb, but we have no way to clean it because ConfChange removing 3 only clear region 1, not region 2.
To solve it, we should check both Version and ConfVersion epoch in admin commands except CompactLog.

@ngaut @BusyJay

Clean protobuf

  • 1. integrate ok or err of xxResponse to one field(ResultType)
  • 2. move protobuf to repo kvproto
  • 3. add meta to each key of request
  • 4. use cleanup instead of clean up

rocksdb link err

Please answer these questions before submitting your issue. Thanks!

  1. What version of Rust are you using (rustc --version)?
    rustc 1.9.0-nightly (600dc3552 2016-04-04)

error: aborting due to previous error
Build failed, waiting for other jobs to finish...
error: linking with cc failed: exit code: 1
note: "cc" "-Wl,--as-needed" "-Wl,-z,noexecstack" "-m64" "-L" "/usr/local/lib/rustlib/x86_64-unknown-linux-gnu/lib" "/home/gate/rust_obj/tikv/target/debug/bench_tikv.0.o" "-o" "/home/gate/rust_obj/tikv/target/debug/bench_tikv" "-Wl,--gc-sections" "-pie" "-nodefaultlibs" "-L" "/home/gate/rust_obj/tikv/target/debug" "-L" "/home/gate/rust_obj/tikv/target/debug/deps" "-L" "/usr/local/lib/rustlib/x86_64-unknown-linux-gnu/lib" "-Wl,-Bstatic" "-Wl,-Bdynamic" "/home/gate/rust_obj/tikv/target/debug/libtikv.rlib" "/home/gate/rust_obj/tikv/target/debug/deps/libuuid-5650c0ca096e22f0.rlib" "/usr/local/lib/rustlib/x86_64-unknown-linux-gnu/lib/libtest-18402db3.rlib" "/usr/local/lib/rustlib/x86_64-unknown-linux-gnu/lib/libgetopts-18402db3.rlib" "/home/gate/rust_obj/tikv/target/debug/deps/libbyteorder-79579e11a5fc0173.rlib" "/home/gate/rust_obj/tikv/target/debug/deps/librocksdb-2cddebf65ff5868b.rlib" "/usr/local/lib/rustlib/x86_64-unknown-linux-gnu/lib/libterm-18402db3.rlib" "/home/gate/rust_obj/tikv/target/debug/deps/librustc_serialize-3bc953984ed46e7f.rlib" "/home/gate/rust_obj/tikv/target/debug/deps/libquick_error-9f95c6fba19f9325.rlib" "/home/gate/rust_obj/tikv/target/debug/deps/libbytes-c70b3e48eb9564b3.rlib" "/home/gate/rust_obj/tikv/target/debug/deps/libtempdir-2cdf7b3a831e6ac5.rlib" "/home/gate/rust_obj/tikv/target/debug/deps/librand-c724acb3942597d1.rlib" "/home/gate/rust_obj/tikv/target/debug/deps/libmio-4dc84855cf75d5a3.rlib" "/home/gate/rust_obj/tikv/target/debug/deps/libbytes-2fbbdda5bbde5111.rlib" "/home/gate/rust_obj/tikv/target/debug/deps/libnet2-559ba40c19f23b6a.rlib" "/home/gate/rust_obj/tikv/target/debug/deps/libwinapi-42bc588a308ea664.rlib" "/home/gate/rust_obj/tikv/target/debug/deps/libkernel32-95c0b0ef43f70ab2.rlib" "/home/gate/rust_obj/tikv/target/debug/deps/libtime-71756e48b8b5b73b.rlib" "/home/gate/rust_obj/tikv/target/debug/deps/liblibc-00ad8a4a4c184a2d.rlib" "/home/gate/rust_obj/tikv/target/debug/deps/liblog-342ffb7444a9471d.rlib" "/home/gate/rust_obj/tikv/target/debug/deps/libnix-05000afe46152771.rlib" "/home/gate/rust_obj/tikv/target/debug/deps/liblibc-5eb0f3d71076a4bc.rlib" "/home/gate/rust_obj/tikv/target/debug/deps/libslab-22c48cf3d25bac5c.rlib" "/home/gate/rust_obj/tikv/target/debug/deps/libmiow-ba6e9462e2153813.rlib" "/home/gate/rust_obj/tikv/target/debug/deps/libbitflags-d06009685951cc56.rlib" "/home/gate/rust_obj/tikv/target/debug/deps/libws2_32-2f1486c4a679970f.rlib" "/home/gate/rust_obj/tikv/target/debug/deps/libcfg_if-0a8d2242d60f8925.rlib" "/home/gate/rust_obj/tikv/target/debug/deps/libkvproto-c7b8aa136eedb5a0.rlib" "/home/gate/rust_obj/tikv/target/debug/deps/libprotobuf-40f78cc16fda400f.rlib" "/usr/local/lib/rustlib/x86_64-unknown-linux-gnu/lib/libstd-18402db3.rlib" "/usr/local/lib/rustlib/x86_64-unknown-linux-gnu/lib/libcollections-18402db3.rlib" "/usr/local/lib/rustlib/x86_64-unknown-linux-gnu/lib/librustc_unicode-18402db3.rlib" "/usr/local/lib/rustlib/x86_64-unknown-linux-gnu/lib/librand-18402db3.rlib" "/usr/local/lib/rustlib/x86_64-unknown-linux-gnu/lib/liballoc-18402db3.rlib" "/usr/local/lib/rustlib/x86_64-unknown-linux-gnu/lib/liballoc_jemalloc-18402db3.rlib" "/usr/local/lib/rustlib/x86_64-unknown-linux-gnu/lib/liblibc-18402db3.rlib" "/usr/local/lib/rustlib/x86_64-unknown-linux-gnu/lib/libcore-18402db3.rlib" "-l" "rocksdb" "-l" "c" "-l" "m" "-l" "dl" "-l" "pthread" "-l" "gcc_s" "-l" "pthread" "-l" "c" "-l" "m" "-l" "rt" "-l" "compiler-rt"
note: /usr/bin/ld: /usr/local/lib/librocksdb.a(c.o): relocation R_X86_64_32S against `_ZTVZ42rocksdb_slicetransform_create_fixed_prefixE7Wrapper' can not be used when making a shared object; recompile with -fPIC
/usr/local/lib/librocksdb.a: error adding symbols: 错误的值
collect2: error: ld returned 1 exit status

Ensure compatibility with TiDB

  • Pass tidb/store/store_test.go
  • Pass isolation test.
  • Run tidb/interpreter.
  • Pass tidb-test/tidb_test
  • Pass tidb-test/mysql_test
  • Pass tidb-test/go-sql-test
  • Pass tidb-test/gorm_test
  • Pass tidb-test/xorm_test
  • Pass tidb-test/ddl_test

What does `Coprocessor support` mean?

I failed to understand what does this mean by reading the readme doc.

Coprocessor support
TiKV will be accessable and any application can develop on TiKV. 

We tend to provide a simple deployment solution soon after.

Can anyone explain this?

support config file and command flag to start kvserver

Using a config file to start kv server, like ./kv-server --config default.toml, the config file format is toml. If no config file supplied, we will use the default configuration.

We should supply some command flags to control some vars, like server listening address, raft listening addr, log level, etc. We will use these flags even we use config file at the same time.

  • support config file
  • support more command flag

Proto: Add region identifier to kvrpc request

Because we need to route the mutation/get action to specified region, we either search all region locally or just use the search result pd already did. Former will add some cooperation cost between thread and will have to deal with the cache invalidation problem.

So I prefer to add region identifier to kvrpc request message and pass it directly to engine trait. And batch actions should be divided into groups by the region too.

@siddontang @ngaut @morefreeze

mysql-test InvalidDataType

Please answer these questions before submitting your issue. Thanks!

  1. What version of Rust are you using (rustc --version)?
    rustc 1.10.0-nightly (576229fea 2016-04-15)

  2. What operating system and processor architecture are you using?
    Mac OS

  3. What did you do?
    If possible, provide a recipe for reproducing the error.
    A complete runnable program is good.

    git checkout tidb/morefreeze/port-tikv
    start etcd, pd, tikv
    cd mysql_test && ./run-tests.sh
    About 10 seconds.

  4. What did you expect to see?
    Eliminate errors.

  5. What did you see instead?

    • 2016/05/05 20:19:28 main.go:478: [fatal] run test [groupby] err: run "select * from t where c1 = null group by c1;" at line 78 err other error: unknown error InvalidDataType("can\'t convert Null to bool")
    • 2016/05/05 20:28:20 main.go:478: [fatal] run test [index] err: run "select c1 from t where c1 >= "00:00:00";" at line 25 err other error: unknown error InvalidDataType("unsupported data type7of [7, 128, 0, 0, 0, 0, 0, 0, 0, 3, 128, 0, 0, 0, 0, 0, 0, 1]")
    • 2016/05/06 17:11:57 main.go:478: [fatal] run test [index] err: run "select c1 from t where c1 >= -0.0120;" at line 31 err other error: unknown error InvalidDataType("unsupported data type6of [6, 24, 128, 0, 0, 0, 0, 0, 0, 0, 49, 50, 0, 0, 0, 0, 0, 0, 249, 3, 128, 0, 0, 0, 0, 0, 0, 1]")
    • 2016/05/06 17:25:12 main.go:478: [fatal] run test [sqllogic] err: run "select * from tab1 where col1 != null;" at line 24 err other error: unknown error InvalidDataType("unsupported data type5of [5, 192, 22, 102, 102, 96, 0, 0, 0]")
    • 2016/05/16 20:11:22 main.go:475: [fatal] run test [sqllogic] err: run "select * from tab1 where col1 != null;" at line 24 err, we need: select * from tab1 where col1 != null; pk col0 col1 col2 col3 col4 col5 select * from tab1 where co but got: select * from tab1 where col1 != null; pk col0 col1 col2 col3 col4 col5 0 6 5.6 jtqxx 9 5.19 qvgba
    • 2016/05/16 20:01:15 main.go:475: [fatal] run test [groupby] err: run "select * from t where c1 = null group by c1;" at line 78 err, we need: select * from t where c1 = null group by c1; c1 select but got: select * from t where c1 = null group by c1; c1 1 2 3

reject stale request vote raft message

Let's consider following case:

3 peers in raft for 1, 2, 3. 1 is leader.

  • stop node 3
  • ConfChange remove node 3
  • re-start node 3

After conf change, 1 and 2 have no info for 3 and won't communicate it at all, but 3 still knows 1 and 2.
So 3 will start a new election and then sends RequestVote to 1 and 2 with a bigger term, 1 and 2 will step down to follower and then start a new election again.

3 won't damage data, but will disturb raft group frequently, so we should reject this message.

In on_raft_message, we can check if the msg is RequestVote and the epoch is stale, we can discard it directly.

@ngaut @BusyJay

Docking PD compatibility with TiDB

  • Pass tidb/store/store_test.go
  • Pass isolation test.
  • Run tidb/interpreter.
  • Pass tidb-test/tidb_test
  • Pass tidb-test/mysql_test
  • Pass tidb-test/go-sql-test
  • Pass tidb-test/gorm_test
  • Pass tidb-test/xorm_test
  • Pass tidb-test/ddl_test

Make failed because of clipper 0.0.61 version

I use rustc 1.7.0 (a5d1e7a59 2016-02-29) and CentOS 7.1 x86_64 formake build.

When I ran make command in the repository, got errors and make failed.

/root/.cargo/registry/src/github.com-88ac128001ac3a9a/clippy-0.0.61/src/booleans.rs:60:57: 60:58 error: expected one of `.`, `;`, `}`, or an operator, found `?`
/root/.cargo/registry/src/github.com-88ac128001ac3a9a/clippy-0.0.61/src/booleans.rs:60                     v = self.extract(op, &[lhs, rhs], v)?;
                                                                                                                                               ^
error: aborting due to previous error
Build failed, waiting for other jobs to finish...
Could not compile `clippy`.

Then I tried clippy other version 0.0.60 and 0.0.50 and all failed.

Add Prev() interface

Sometimes we need to scan index in descend order. So we need a Prev() in TiKV.

fix resource temporary unavailable in ci

Now we meet resource temporary unavailable frequently in ci, it seems that we set a read timeout in socket and read nothing after timeout.
This may happen when we send to a stale leader, the stale leader can't commit the log and apply it, so it won't return the response.

We should find a way to handle this. maybe if leader lost, calling all command Callback or checking timeout error in test and then re-try again.

@ngaut @BusyJay

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.