Commit Graph

124 Commits

Author SHA1 Message Date
ekexium 1c6815abaf refactor: address comments
Signed-off-by: ekexium <ekexium@gmail.com>
2021-04-20 17:15:36 +08:00
Nick Cameron 5fb1dc071a
Merge branch 'master' into atomic 2021-04-20 20:50:03 +12:00
ekexium 570b9f9a32 refactor: introduce an atomic mode for raw client
Signed-off-by: ekexium <ekexium@gmail.com>
2021-04-20 16:40:46 +08:00
ekexium 6e02f61a2f Merge remote-tracking branch 'upstream/master' into atomic
Signed-off-by: ekexium <ekexium@gmail.com>
2021-04-20 15:18:20 +08:00
ekexium 9ceac82fb8 Merge remote-tracking branch 'upstream/master' into buffer-mutex
Signed-off-by: ekexium <ekexium@gmail.com>
2021-04-20 14:43:42 +08:00
ekexium f91708d907 test: add a simple test for atomic operations
Signed-off-by: ekexium <ekexium@gmail.com>
2021-04-14 18:48:38 +08:00
ekexium 800c668773 Merge remote-tracking branch 'upstream/master' into buffer-mutex
Signed-off-by: ekexium <ekexium@gmail.com>
2021-04-14 14:47:31 +08:00
ekexium b317ab73cb Merge remote-tracking branch 'upstream/master' into unify-locking 2021-04-14 14:37:40 +08:00
Nick Cameron e8a9175adb Fix two bugs with insert and delete
Fixes #234

Signed-off-by: Nick Cameron <nrc@ncameron.org>
2021-04-14 11:40:34 +12:00
ekexium d3e5ffbde1 feat: make get_for_update work for optimistic txns
Signed-off-by: ekexium <ekexium@gmail.com>
2021-04-12 15:58:48 +08:00
ekexium 8ba16a085a fix: remove the Mutex in Buffer
Signed-off-by: ekexium <ekexium@gmail.com>
2021-04-09 18:21:38 +08:00
ekexium 6f6834a428 test: read fewer keys in txn_write_million to satisfy grpc message size limit
Signed-off-by: ekexium <ekexium@gmail.com>
2021-04-07 17:33:20 +08:00
ekexium 4120b76455 style: resolve comments
Signed-off-by: ekexium <ekexium@gmail.com>
2021-03-18 14:28:43 +08:00
ekexium d789cc650b Merge remote-tracking branch 'upstream/master' into batch-get-for-update
Signed-off-by: ekexium <ekexium@gmail.com>
2021-03-15 18:48:43 +08:00
ekexium 24af21c3b9 test: don't test 1pc until we fix it
Signed-off-by: ekexium <ekexium@gmail.com>
2021-03-15 18:34:56 +08:00
ekexium 260bcd70cd test: test multi-region batch_get_for_update
Signed-off-by: ekexium <ekexium@gmail.com>
2021-03-15 16:15:33 +08:00
ekexium a3f814ab1f feat: fix batch_get_for_update
Signed-off-by: ekexium <ekexium@gmail.com>
2021-03-12 15:58:47 +08:00
Zijie Lu 486a4b2e14
Automatic heartbeat (#236)
* Remove retry_response_stream

Signed-off-by: Nick Cameron <nrc@ncameron.org>

* Move store-related functions from request to store

Signed-off-by: Nick Cameron <nrc@ncameron.org>

* Be a little more consistent with the types in request ctor functions

Signed-off-by: Nick Cameron <nrc@ncameron.org>

* Add request ctor functions taking high-level types

Signed-off-by: Nick Cameron <nrc@ncameron.org>

* Refactor the command-abstraction into a composable plan abstraction

Signed-off-by: Nick Cameron <nrc@ncameron.org>

* Support sending heartbeats automatically

Signed-off-by: Zijie Lu <wslzj40@gmail.com>

* nitpick

Signed-off-by: Zijie Lu <wslzj40@gmail.com>

* Add heartbeat check

Signed-off-by: Zijie Lu <wslzj40@gmail.com>

* Fix use

Signed-off-by: Zijie Lu <wslzj40@gmail.com>

* fix

Signed-off-by: Zijie Lu <wslzj40@gmail.com>

* fix complie errors

Signed-off-by: Zijie Lu <wslzj40@gmail.com>

* Address review comments

Signed-off-by: Nick Cameron <nrc@ncameron.org>

* remove heartbeat plan and use spawn

Signed-off-by: Zijie Lu <wslzj40@gmail.com>

* Fix build errors and replace RwLock

Signed-off-by: Zijie Lu <wslzj40@gmail.com>

* Address review comments

Signed-off-by: Nick Cameron <nrc@ncameron.org>

* Add unit test

Signed-off-by: Zijie Lu <wslzj40@gmail.com>

* nitpick

Signed-off-by: Zijie Lu <wslzj40@gmail.com>

* nitpick

Signed-off-by: Zijie Lu <wslzj40@gmail.com>

* Fix deadlock and unit tests

Signed-off-by: Zijie Lu <wslzj40@gmail.com>

* Add test for optimistic_heart

Signed-off-by: Zijie Lu <wslzj40@gmail.com>

* Add mod.rs for tests

Signed-off-by: Zijie Lu <wslzj40@gmail.com>

* Fix failpoint tests

Signed-off-by: Zijie Lu <wslzj40@gmail.com>

* Address review comments

Signed-off-by: Zijie Lu <wslzj40@gmail.com>

* Address review comments

Signed-off-by: Zijie Lu <wslzj40@gmail.com>

* Address review comments

Signed-off-by: Zijie Lu <wslzj40@gmail.com>

* Fix tests

Signed-off-by: Zijie Lu <wslzj40@gmail.com>

* Fix clippy errors

Signed-off-by: Zijie Lu <wslzj40@gmail.com>

* Address review comments

Signed-off-by: Zijie Lu <wslzj40@gmail.com>

* Remove bg_worker

Signed-off-by: Andy Lok <andylokandy@hotmail.com>

* Fix test

Signed-off-by: Zijie Lu <wslzj40@gmail.com>

* rename to failpoint_tests

Signed-off-by: Zijie Lu <wslzj40@gmail.com>

* Update transaction.rs

* Update transaction.rs

Signed-off-by: Andy Lok <andylokandy@hotmail.com>

Co-authored-by: Nick Cameron <nrc@ncameron.org>
Co-authored-by: Andy Lok <andylokandy@hotmail.com>
2021-03-11 11:01:36 +13:00
Nick Cameron 9a5fd1d8c9 Address review comments
Signed-off-by: Nick Cameron <nrc@ncameron.org>
2021-02-25 15:59:40 +13:00
Nick Cameron 8cb8dd666a Refactor the command-abstraction into a composable plan abstraction
Signed-off-by: Nick Cameron <nrc@ncameron.org>
2021-02-17 13:06:07 +13:00
Ziyi Yan 59919f9007 test: add an integration test for duplicate keys insertion and delete-your-writes
Signed-off-by: Ziyi Yan <ziyi.yan@foxmail.com>
2021-02-11 23:05:17 +08:00
ekexium 89ac804705
Fix several bugs in pessimistic transaction (#218)
* enable pessimistic_lock req to return values

Signed-off-by: ekexium <ekexium@gmail.com>

* refactor Mutation: Lock should be able to cache values

Signed-off-by: ekexium <ekexium@gmail.com>

* fix: read and lock operations should not override each other

Signed-off-by: ekexium <ekexium@gmail.com>

* rewrite get_for_update: make semantics similar to TiDB

Signed-off-by: ekexium <ekexium@gmail.com>

* fix: correctly set for_update_ts for pessimistic rollback request

Signed-off-by: ekexium <ekexium@gmail.com>

* fix: allow update_cache to 'update' existing keys, but check the values

Signed-off-by: ekexium <ekexium@gmail.com>

* test: add test for pessimistic rollback

Signed-off-by: ekexium <ekexium@gmail.com>

* doc: add some doc for get_for_update

Signed-off-by: ekexium <ekexium@gmail.com>

* fix: make batch_for_update private

Signed-off-by: ekexium <ekexium@gmail.com>

* resolve comments

Signed-off-by: ekexium <ekexium@gmail.com>

* ci: sleep a while to wait for PD

Signed-off-by: ekexium <ekexium@gmail.com>

* feat: lock_keys is available for both optimistic and pessimistic txns

Signed-off-by: ekexium <ekexium@gmail.com>

* refactor: rename ReadLockCached to CachedAndLocked

Signed-off-by: ekexium <ekexium@gmail.com>

* revert changes to `batch_get_for_update`

Signed-off-by: ekexium <ekexium@gmail.com>

* test: ignore unstable mock-tikv test

Signed-off-by: ekexium <ekexium@gmail.com>

* refactor: rename `ReadLockCached` to `Locked`

Signed-off-by: ekexium <ekexium@gmail.com>

* test: do not use Fallible

Signed-off-by: ekexium <ekexium@gmail.com>

* doc: update readme format

Signed-off-by: ekexium <ekexium@gmail.com>

Co-authored-by: Nick Cameron <nrc@ncameron.org>
2021-01-14 16:56:28 +08:00
Nick Cameron e7d46911ef txn: implement heart beat
Signed-off-by: Nick Cameron <nrc@ncameron.org>
2021-01-13 15:02:40 +13:00
ekexium 0de0163b29 add an option to control the behavior when txns get dropped
Signed-off-by: ekexium <ekexium@gmail.com>
2021-01-11 11:59:13 +08:00
ekexium 2a709116a6 update rand to 0.8
Signed-off-by: ekexium <ekexium@gmail.com>
2021-01-06 15:53:57 +08:00
Nick Cameron 3a29cb39a4 Address reviewer comments
Signed-off-by: Nick Cameron <nrc@ncameron.org>
2021-01-06 08:55:09 +13:00
Nick Cameron b46022b7db Some renaming (and adds one method)
Signed-off-by: Nick Cameron <nrc@ncameron.org>
2021-01-05 14:48:57 +13:00
ekexium da63451caf fix integration tests
Signed-off-by: ekexium <ekexium@gmail.com>
2020-12-24 15:20:00 +08:00
Nick Cameron 9dcf298d87 Implement prewrite for async commit and 1pc
Signed-off-by: Nick Cameron <nrc@ncameron.org>
2020-12-04 21:25:04 +13:00
Andy Lok 9cb904a499 split scan() into scan() and scan_keys()
Signed-off-by: Andy Lok <andylokandy@hotmail.com>
2020-11-24 17:45:11 +08:00
Andy Lok 1857ed2f83 Resturcture take2
Signed-off-by: Andy Lok <andylokandy@hotmail.com>
2020-11-23 21:48:41 +08:00
ekexium 6b3996ee76 fix: snapshot don't panic on drop
Signed-off-by: ekexium <ekexium@gmail.com>
2020-11-12 14:25:56 +08:00
Nick Cameron 89bf4c6c53 Use pub exports of common types
Signed-off-by: Nick Cameron <nrc@ncameron.org>
2020-10-29 10:24:23 +13:00
ekexium 9ca9aa79c6
GC: initial implementation (#182)
Signed-off-by: ekexium <ekexium@gmail.com>
2020-10-13 16:22:56 +08:00
Nick Cameron d9935c2936
Merge pull request #179 from ekexium/fix-raw-scan-limit
Fix limit problem in raw_scan and unbouned problem in batch_scan
2020-10-13 09:31:56 +13:00
ekexium 7c584fbb80
Merge branch 'master' into fix-txn-batch-scan 2020-10-12 11:55:21 +08:00
ekexium 319ec52545 fix typo
Signed-off-by: ekexium <ekexium@gmail.com>
2020-10-12 11:53:54 +08:00
ekexium 10b6f44b45 format code
Signed-off-by: ekexium <ekexium@gmail.com>
2020-09-29 18:17:49 +08:00
ekexium cd9c87e24b fix Some(empty) == unbouned problem in group_ranges_by_region
Signed-off-by: ekexium <ekexium@gmail.com>
2020-09-29 15:57:52 +08:00
ekexium bcd18b3e53 fix limit of raw_scan
Signed-off-by: ekexium <ekexium@gmail.com>
2020-09-29 15:20:42 +08:00
George Teo ad8ef075af
Add codec for encoding region for transaction client (#162)
Add codec for encoding region for transaction client. Fix some other bugs.

Signed-off-by: George Teo <george.c.teo@gmail.com>
Co-authored-by: ekexium <ekexium@gmail.com>
2020-09-29 14:05:39 +08:00
ekexium ca160b8fa8
Merge branch 'master' into fix-txn-batch-scan 2020-09-23 16:07:51 +08:00
ekexium 1c383ae2e1 fix txn.batch_get() signature; now it returns Iter<KvPair>, and skips non-existent entries
Signed-off-by: ekexium <ekexium@gmail.com>
2020-09-23 16:02:53 +08:00
ekexium e2c74dcdba fix integration tests
Signed-off-by: ekexium <ekexium@gmail.com>
2020-09-23 14:24:39 +08:00
Nick Cameron dd542e0f39
Merge branch 'master' into rename 2020-09-23 16:59:34 +12:00
ekexium fae7ac85f4 add serial txn bank transfer test
Signed-off-by: ekexium <ekexium@gmail.com>
2020-09-23 10:19:48 +08:00
ekexium 67b52a998c integration tests: add raw client test
Signed-off-by: ekexium <ekexium@gmail.com>
2020-09-22 16:15:01 +08:00
ekexium 475fe54194 rename txn.set to txn.put
Signed-off-by: ekexium <ekexium@gmail.com>
2020-09-22 10:50:17 +08:00
ekexium 93182159d9 raw bank transfer test
Signed-off-by: ekexium <ekexium@gmail.com>
2020-09-17 16:23:21 +08:00
ekexium 194acb633c mock tikv: remove unnecessary clones; delete requests won't return errors
Signed-off-by: ekexium <ekexium@gmail.com>
2020-09-14 14:33:06 +08:00
ekexium 1bf9374939 mock tikv: distinguish between empty value and non-exsit keys; same behavior with TiKV
Signed-off-by: ekexium <ekexium@gmail.com>
2020-09-14 12:17:24 +08:00
ekexium ca017b1bb7 change semantics of raw_batch_delete; iterate once
Signed-off-by: ekexium <ekexium@gmail.com>
2020-09-11 14:41:49 +08:00
ekexium 26e1a566e3 add a mock PD
Signed-off-by: ekexium <ekexium@gmail.com>
2020-09-09 15:21:15 +08:00
ekexium d7bded1fbf
Extract low-level store and pd crates. (#157)
Signed-off-by: ekexium <ekexium@gmail.com>
2020-07-16 11:41:57 +08:00
Yilin Chen 91aaedff2b
update dependencies and fix ci
Signed-off-by: Yilin Chen <sticnarf@gmail.com>
2020-03-19 12:17:46 +08:00
Ana Hobden 8d2c784c88
update nightly (#124)
* update nightly

Signed-off-by: Ana Hobden <operator@hoverbear.org>

* Resolve clippy

Signed-off-by: Ana Hobden <operator@hoverbear.org>

* Fix integration tests

Signed-off-by: Ana Hobden <operator@hoverbear.org>

* Reflect comments

Signed-off-by: Ana Hobden <operator@hoverbear.org>

* fmt

Signed-off-by: Ana Hobden <operator@hoverbear.org>
2019-11-21 18:04:15 -08:00
Yilin Chen 4c6ab294ef
Update and delete in integration tests
Signed-off-by: Yilin Chen <sticnarf@gmail.com>
2019-09-25 13:02:35 +08:00
Yilin Chen 3ab4252e1d
Remove dummy_impl_has_locks macro
Signed-off-by: Yilin Chen <sticnarf@gmail.com>
2019-09-23 11:47:49 +08:00
Yilin Chen 1083aef8b4
Add integration tests
Signed-off-by: Yilin Chen <sticnarf@gmail.com>
2019-09-23 11:30:21 +08:00
Yilin Chen b15d8ab935
Fix doctests
Signed-off-by: Yilin Chen <sticnarf@gmail.com>
2019-08-30 12:35:14 +08:00
Yilin Chen f093c64f21
Upgrade toolchain and dependencies.
CI errors should be fixed and feature gates are removed.

Signed-off-by: Yilin Chen <sticnarf@gmail.com>
2019-08-26 11:45:04 +08:00
Nick Cameron 8165adf1f9 Refactor into a request-style API (#87)
* Refactor the raw API to be command-oriented

Signed-off-by: Nick Cameron <nrc@ncameron.org>

* WIP: provide mocks and use them for tests

Signed-off-by: Nick Cameron <nrc@ncameron.org>
2019-08-09 07:53:55 -07:00
Yilin Chen e652a6aeb4 Add a new TSO implementation
Signed-off-by: Yilin Chen <sticnarf@gmail.com>
2019-08-01 02:05:24 +08:00
Yilin Chen 94f080e269 Add integration tests for get TS
Signed-off-by: Yilin Chen <sticnarf@gmail.com>
2019-07-31 13:53:57 +08:00
Ana Hobden 1815a3bf54
Add proptest support (#68)
* Add proptest support

Signed-off-by: Ana Hobden <operator@hoverbear.org>

* fmt

Signed-off-by: Ana Hobden <operator@hoverbear.org>

* Make proptest feature more consistent

Signed-off-by: Ana Hobden <operator@hoverbear.org>

* Fixes #69

Signed-off-by: Ana Hobden <operator@hoverbear.org>

* fmt

Signed-off-by: Ana Hobden <operator@hoverbear.org>
2019-07-04 17:35:11 -07:00
Nick Cameron 5d6175a1c0 Address some CI issues
Signed-off-by: Nick Cameron <nrc@ncameron.org>
2019-06-24 13:53:16 +12:00
Nick Cameron 98108bf1fe Rename Client::new to connect (#64)
Signed-off-by: Nick Cameron <nrc@ncameron.org>
2019-06-04 15:55:41 -07:00
Nick Cameron bb044e6a83 Use .await syntax
Signed-off-by: Nick Cameron <nrc@ncameron.org>
2019-05-30 10:20:03 +12:00
Nick Cameron 6353dbcfe3 Migrate to futures 0.3
Signed-off-by: Nick Cameron <nrc@ncameron.org>
2019-05-30 10:20:03 +12:00
Nick Cameron 8defd7769b Bring license headers inline with TiKV
Signed-off-by: Nick Cameron <nrc@ncameron.org>
2019-05-10 13:48:44 +12:00
Ana Hobden 8941e2a84c Fix integration test.
Signed-off-by: Ana Hobden <operator@hoverbear.org>
2019-02-25 12:34:33 -08:00
Ana Hobden 72f4a176a4
Refine CI (#22)
* Refine CI

Signed-off-by: Ana Hobden <operator@hoverbear.org>

* Debug

Signed-off-by: Ana Hobden <operator@hoverbear.org>

* debug

Signed-off-by: Ana Hobden <operator@hoverbear.org>

* Update windows path

Signed-off-by: Ana Hobden <operator@hoverbear.org>

* Correct switchdaemon

Signed-off-by: Ana Hobden <operator@hoverbear.org>

* Nocapture

Signed-off-by: Ana Hobden <operator@hoverbear.org>

* Merge before and script

Signed-off-by: Ana Hobden <operator@hoverbear.org>

* Try removing the travis cargo build cache

Signed-off-by: Brian Anderson <andersrb@gmail.com>
Signed-off-by: Ana Hobden <operator@hoverbear.org>

* Install protoc

Signed-off-by: Ana Hobden <operator@hoverbear.org>

* Add some dependencies

Signed-off-by: Ana Hobden <operator@hoverbear.org>

* Try to get windows to detect environment properly

Signed-off-by: Ana Hobden <operator@hoverbear.org>

* Sudo is disabled on linux

Signed-off-by: Ana Hobden <operator@hoverbear.org>

* Add updated ubuntu package

Signed-off-by: Ana Hobden <operator@hoverbear.org>

* Note why windows is disabled

Signed-off-by: Ana Hobden <operator@hoverbear.org>

* Correct pkg name

Signed-off-by: Ana Hobden <operator@hoverbear.org>

* Add mac dependencies

Signed-off-by: Ana Hobden <operator@hoverbear.org>

* Resolve lint

Signed-off-by: Ana Hobden <operator@hoverbear.org>

* Allow unused code in select places

Signed-off-by: Ana Hobden <operator@hoverbear.org>

* fmt

Signed-off-by: Ana Hobden <operator@hoverbear.org>

* Use raft 0.5.0 branch

Signed-off-by: Ana Hobden <operator@hoverbear.org>

* Remove AppVeyor, don't need it.

Signed-off-by: Ana Hobden <operator@hoverbear.org>
2019-02-25 11:50:57 -08:00
Xiaoguang Sun c47b92bab4 Change raw::Client::get to return Option<Value> (#24)
Signed-off-by: Xiaoguang Sun <sunxiaoguang@zhihu.com>
2019-01-20 21:49:50 -08:00
Xiaoguang Sun ba8675409d The initial version of Raw KV implementation (#14)
* Initial version of Raw Kv client

Note: raw::Client::batch_scan is not implemented yet.

Signed-off-by: Xiaoguang Sun <sunxiaoguang@zhihu.com>

* Document most public code.

Signed-off-by: Ana Hobden <operator@hoverbear.org>

* Reduce pub surface

Signed-off-by: Ana Hobden <operator@hoverbear.org>

* fmt/lint

Signed-off-by: Ana Hobden <operator@hoverbear.org>

* Add cf to concrete builder types

Signed-off-by: Xiaoguang Sun <sunxiaoguang@zhihu.com>

* Fixed some comments and confusing name

Signed-off-by: Xiaoguang Sun <sunxiaoguang@zhihu.com>

* Change Request from struct to enum

Signed-off-by: Xiaoguang Sun <sunxiaoguang@zhihu.com>

* Change tso_tx/rx channel to bounded

Signed-off-by: Xiaoguang Sun <sunxiaoguang@zhihu.com>

* Fix format issues and improve implementations

Signed-off-by: Xiaoguang Sun <sunxiaoguang@zhihu.com>

* Change to dyn trait syntax

Signed-off-by: Xiaoguang Sun <sunxiaoguang@zhihu.com>

* inline some functions

Signed-off-by: Ana Hobden <operator@hoverbear.org>

* Better note on KvPair

Signed-off-by: Ana Hobden <operator@hoverbear.org>

* Use 3 PDs in raw example

Signed-off-by: Ana Hobden <operator@hoverbear.org>

* Clarify documentation

Signed-off-by: Ana Hobden <operator@hoverbear.org>

* Get CI green

Signed-off-by: Ana Hobden <operator@hoverbear.org>

* Remove not useful PrivateKey type

Signed-off-by: Xiaoguang Sun <sunxiaoguang@zhihu.com>

* Change CUSTOM_CF to "default" in examples/raw.rs

Signed-off-by: Xiaoguang Sun <sunxiaoguang@zhihu.com>
2019-01-13 14:03:21 -08:00