I found that client-go still uses TiDB mockstore and some codes for testing, like https://github.com/tikv/client-go/blob/master/integration_tests/util_test.go#L50
From my side, TiKV is the underlying component of TiDB, so it is very strange to let the TiKV client depend on TiDB's code, even in the test, and I also don't think we must rely on the TiDB's logic to test the TiKV client.
Another risk is that if we heavily use TiDB's mockstore, and client-go's origin mockstore may then lack maintenance. I tried to use client-go's own store instead of TiDB's mockstore below
@@ -83,7 +83,7 @@ type testLockSuite struct {
}
func (s *testLockSuite) SetupTest() {
- s.store = tikv.StoreProbe{KVStore: NewTestUniStore(s.T())}
+ s.store = tikv.StoreProbe{KVStore: NewTestStore(s.T())}
}
But failed with the following message:
--- FAIL: TestLock/TestBatchResolveLocks (0.00s)
lock_test.go:563:
Error Trace: /Users/tangliu/eng/client-go/integration_tests/lock_test.go:563
Error: Expected nil, but got: not exist
Test: TestLock/TestBatchResolveLocks
lock_test.go:564:
Error Trace: /Users/tangliu/eng/client-go/integration_tests/lock_test.go:564
Error: Should be true
Test: TestLock/TestBatchResolveLocks
lock_test.go:566:
Error Trace: /Users/tangliu/eng/client-go/integration_tests/lock_test.go:566
Error: Expected nil, but got: not exist
Test: TestLock/TestBatchResolveLocks
lock_test.go:567:
Error Trace: /Users/tangliu/eng/client-go/integration_tests/lock_test.go:567
Error: Should be true
Test: TestLock/TestBatchResolveLocks
I didn't investigate deeply, but my guess is that the mockstore in client-go doesn't support lock TTL very well.
I know removing TiDB's dependency is a very hard work, but we need to consider it now. Let's follow some good engineering practices from now on.
Another thing is now we already have a mockstore in client-go, can we simplify the mockstore code in TiDB too (maybe let TiDB mostly use client-go's code). I still worry that later we may still focus on changing the code in TiDB instead of client-go, especially when we develop Transaction features.
/cc @zhangjinpeng1987 @kevin-xianliu
I found that now with V2 API, we will calculate the keyspace every time
func (c *codecV2) GetKeyspaceID() KeyspaceID {
prefix := append([]byte{}, c.prefix...)
prefix[0] = 0
return KeyspaceID(binary.BigEndian.Uint32(prefix))
}
https://github.com/tikv/client-go/blob/master/internal/apicodec/codec_v2.go#L99
Why do we do this? seem that we can cache the value of KeyspaceID in the codecV2 structure directly.
@sunxiaoguang
update tidb version (#419)
Signed-off-by: lemonhx lemonhx@lemonhx.tech
Support setting assertions and receiving assertion errors for Prewrite requests (#311)
Signed-off-by: lysu sulifx@gmail.com Signed-off-by: MyonKeminta MyonKeminta@users.noreply.github.com
Signed-off-by: MyonKeminta MyonKeminta@users.noreply.github.com
Signed-off-by: MyonKeminta MyonKeminta@users.noreply.github.com
Signed-off-by: MyonKeminta MyonKeminta@users.noreply.github.com
Signed-off-by: MyonKeminta MyonKeminta@users.noreply.github.com
Signed-off-by: MyonKeminta MyonKeminta@users.noreply.github.com
Signed-off-by: MyonKeminta MyonKeminta@users.noreply.github.com
Signed-off-by: MyonKeminta MyonKeminta@users.noreply.github.com
Signed-off-by: MyonKeminta MyonKeminta@users.noreply.github.com
Signed-off-by: MyonKeminta MyonKeminta@users.noreply.github.com
Signed-off-by: MyonKeminta MyonKeminta@users.noreply.github.com
Signed-off-by: MyonKeminta MyonKeminta@users.noreply.github.com
Signed-off-by: MyonKeminta MyonKeminta@users.noreply.github.com
Signed-off-by: MyonKeminta MyonKeminta@users.noreply.github.com
Signed-off-by: MyonKeminta MyonKeminta@users.noreply.github.com
Signed-off-by: MyonKeminta MyonKeminta@users.noreply.github.com
Signed-off-by: MyonKeminta MyonKeminta@users.noreply.github.com
Signed-off-by: MyonKeminta MyonKeminta@users.noreply.github.com
Signed-off-by: ekexium ekexium@gmail.com
Signed-off-by: MyonKeminta MyonKeminta@users.noreply.github.com
Signed-off-by: MyonKeminta MyonKeminta@users.noreply.github.com
Signed-off-by: MyonKeminta MyonKeminta@users.noreply.github.com
Signed-off-by: MyonKeminta MyonKeminta@users.noreply.github.com
Signed-off-by: MyonKeminta MyonKeminta@users.noreply.github.com
Signed-off-by: MyonKeminta MyonKeminta@users.noreply.github.com
Signed-off-by: MyonKeminta MyonKeminta@users.noreply.github.com
Signed-off-by: MyonKeminta MyonKeminta@users.noreply.github.com
Signed-off-by: MyonKeminta MyonKeminta@users.noreply.github.com
Signed-off-by: MyonKeminta MyonKeminta@users.noreply.github.com
Signed-off-by: MyonKeminta MyonKeminta@users.noreply.github.com
Signed-off-by: MyonKeminta MyonKeminta@users.noreply.github.com
Signed-off-by: MyonKeminta MyonKeminta@users.noreply.github.com
Signed-off-by: MyonKeminta MyonKeminta@users.noreply.github.com
Signed-off-by: MyonKeminta MyonKeminta@users.noreply.github.com
Signed-off-by: MyonKeminta MyonKeminta@users.noreply.github.com
Co-authored-by: lysu sulifx@gmail.com Co-authored-by: MyonKeminta MyonKeminta@users.noreply.github.com Co-authored-by: ekexium ekexium@gmail.com
txnkv: add shortcut to get global timestamp (#395)
Signed-off-by: disksing i@disksing.com
*: update etcd client to v3.5.2 (#423)
Signed-off-by: disksing i@disksing.com
integration: update tidb to master branch (#426)
Signed-off-by: disksing i@disksing.com
region_cache: more comments and minor refactor (#427)
Signed-off-by: youjiali1995 zlwgx1023@gmail.com
txnkv: fix the issue that deleteRange cannot use nil as endkey (#429)
Signed-off-by: disksing i@disksing.com
*: update readme (#430)
Signed-off-by: disksing i@disksing.com
Add a columnFamily feature for client-go when use rawput in tikv (#425)
Signed-off-by: joccau zak.zhao@pingcap.com
integration: use less tidb code (#431)
Signed-off-by: disksing i@disksing.com
integration: replace some unistore with mockstore (#432)
Signed-off-by: disksing i@disksing.com
Fix incorrect LockNoWait value (#435)
Signed-off-by: Yilin Chen sticnarf@gmail.com
Add options parameters in API CompareAndSwap (#433)
Signed-off-by: joccau zak.zhao@pingcap.com
integration: try not to skip tests when run with tikv (#445)
Signed-off-by: disksing i@disksing.com
mockstore: fix assertion (#446)
Signed-off-by: disksing i@disksing.com
txn: support read-consistency read with tso checking (#447)
Signed-off-by: cfzjywxk lsswxrxr@163.com
region_cache: support buckets (#439)
Signed-off-by: youjiali1995 zlwgx1023@gmail.com
Update lock ttl when retry to pessimistic lock keys (#417)
Signed-off-by: longfangsong longfangsong@icloud.com
Return assertion failed error less prior to other kinds of errors (#448)
Signed-off-by: MyonKeminta MyonKeminta@users.noreply.github.com
fix the comment of TimeDetail (#451)
Signed-off-by: ekexium ekexium@gmail.com