Bhargav Ravuri
2feec4fe68
comments: fix comments as per goword in go test files
...
Comments fixed as per goword in go test files that shell
function go_srcs_in_module lists as per changes on #14827
Helps in #14827
Signed-off-by: Bhargav Ravuri <bhargav.ravuri@infracloud.io>
2022-11-23 23:05:42 +05:30
Andrew Sims
f656fa0f49
add missing copyright headers
...
Signed-off-by: Andrew Sims <andrew.cameron.sims@gmail.com>
2022-11-23 19:13:43 +11:00
Marek Siarkowicz
f96957adba
tests: Add compact failpoints
...
Signed-off-by: Marek Siarkowicz <siarkowicz@google.com>
2022-11-15 14:59:03 +01:00
Cenk Alti
580a86ebe5
server: add more context to panic message
...
Signed-off-by: Cenk Alti <cenkalti@gmail.com>
2022-10-31 20:29:15 -04:00
Benjamin Wang
d15a9d0edc
Merge pull request #14457 from jbml/hashbyrev_compact_main
...
etcdserver: fix corruption check when server has just been compacted
2022-10-13 15:17:38 +08:00
Benjamin Wang
abef537a90
Merge pull request #14515 from spongecaptain/btree-generics
...
upate:use google/btree in the genric way
2022-09-27 16:44:13 +08:00
wathenjiang
319db38b0a
update: add benchmark test
...
benchmark result:
(1) master branch
$ go test -bench='BenchmarkIndexPut$' -count=5
goos: darwin
goarch: amd64
pkg: go.etcd.io/etcd/server/v3/storage/mvcc
cpu: Intel(R) Core(TM) i7-9750H CPU @ 2.60GHz
BenchmarkIndexPut-12 1000000 2591 ns/op
BenchmarkIndexPut-12 1000000 2531 ns/op
BenchmarkIndexPut-12 1000000 2536 ns/op
BenchmarkIndexPut-12 1000000 2546 ns/op
BenchmarkIndexPut-12 1000000 2538 ns/op
PASS
ok go.etcd.io/etcd/server/v3/storage/mvcc 167.439s
$ go test -bench='BenchmarkIndexGet$' -count=5
goos: darwin
goarch: amd64
pkg: go.etcd.io/etcd/server/v3/storage/mvcc
cpu: Intel(R) Core(TM) i7-9750H CPU @ 2.60GHz
BenchmarkIndexGet-12 1000000 2021 ns/op
BenchmarkIndexGet-12 1000000 2029 ns/op
BenchmarkIndexGet-12 1000000 2044 ns/op
BenchmarkIndexGet-12 1000000 1973 ns/op
BenchmarkIndexGet-12 1000000 2027 ns/op
PASS
ok go.etcd.io/etcd/server/v3/storage/mvcc 177.815s
(2) google/btree in the generic way
$ go test -bench='BenchmarkIndexPut$' -count=5
goos: darwin
goarch: amd64
pkg: go.etcd.io/etcd/server/v3/storage/mvcc
cpu: Intel(R) Core(TM) i7-9750H CPU @ 2.60GHz
BenchmarkIndexPut-12 1000000 2477 ns/op
BenchmarkIndexPut-12 1000000 2380 ns/op
BenchmarkIndexPut-12 1000000 2360 ns/op
BenchmarkIndexPut-12 1000000 2396 ns/op
BenchmarkIndexPut-12 1000000 2382 ns/op
PASS
ok go.etcd.io/etcd/server/v3/storage/mvcc 165.841s
$ go test -bench='BenchmarkIndexGet$' -count=5
goos: darwin
goarch: amd64
pkg: go.etcd.io/etcd/server/v3/storage/mvcc
cpu: Intel(R) Core(TM) i7-9750H CPU @ 2.60GHz
BenchmarkIndexGet-12 1000000 1985 ns/op
BenchmarkIndexGet-12 1000000 1914 ns/op
BenchmarkIndexGet-12 1000000 1900 ns/op
BenchmarkIndexGet-12 1000000 1905 ns/op
BenchmarkIndexGet-12 1000000 1894 ns/op
PASS
ok go.etcd.io/etcd/server/v3/storage/mvcc 177.573s
Signed-off-by: wathenjiang <wathenjiang@tencent.com>
2022-09-27 14:33:02 +08:00
Spongecaptain
c53dfc7c5b
upate:use google/btree in the genric way
...
Signed-off-by: wathenjiang <wathenjiang@tencent.com>
2022-09-27 10:16:15 +08:00
Kafuu Chino
f1d4935e91
*: avoid closing a watch with ID 0 incorrectly
...
Signed-off-by: Kafuu Chino <KafuuChinoQ@gmail.com>
add test
2022-09-26 20:30:33 +08:00
Jeremy Leach
cc1e245368
etcdserver: fix corruption check when server has just been compacted
...
When a key-value store corruption check happens immediately after a
compaction, the revision at which the key-value store hash is computed,
is the compacted revision itself.
In that case, the hash computation logic was incorrect because it
returned an ErrCompacted error; this error should instead be returned when
the revision at which the key-value store is hashed, is strictly lower
than the compacted revision.
Fixes #14325
Signed-off-by: Jeremy Leach <44558776+jbml@users.noreply.github.com>
2022-09-24 22:20:26 +10:00
Benjamin Wang
7f10dccbaf
Bump go 1.19: update all the dependencies and go.sum files
...
1. run ./scripts/fix.sh;
2. cd tools/mod; gofmt -w . & go mod tidy;
Signed-off-by: Benjamin Wang <wachao@vmware.com>
2022-09-22 08:47:46 +08:00
demoManito
72cf0cc04a
etcd: modify declaring empty slices
...
declare an empty slice to var s []int replace s :=[]int{}, https://github.com/golang/go/wiki/CodeReviewComments#declaring-empty-slices
Signed-off-by: demoManito <1430482733@qq.com>
2022-09-16 14:41:14 +08:00
lovehhf
3b585e94fc
mvcc: Remove unused revisions and change comment rev to modified
...
Signed-off-by: Hongfei Huang <853885165@qq.com>
2022-09-14 23:36:54 +08:00
Abirdcfly
08a9d1da07
chore: remove duplicate word in comments
...
Signed-off-by: Abirdcfly <fp544037857@gmail.com>
2022-08-27 13:39:48 +08:00
Bogdan Kanivets
43bb9d5c22
server: don't panic in readonly serializable txn
...
Problem: We pass grpc context down to applier in readonly serializable txn.
This context can be cancelled for example due to timeout.
This will trigger panic inside applyTxn
Solution: Only panic for transactions with write operations
fixes https://github.com/etcd-io/etcd/issues/14110
Signed-off-by: Bogdan Kanivets <bkanivets@apple.com>
2022-08-09 00:46:50 -07:00
Marek Siarkowicz
6697fca97d
server: Implement compaction hash checking
...
Signed-off-by: Marek Siarkowicz <siarkowicz@google.com>
2022-07-26 09:31:14 +02:00
Marek Siarkowicz
264498258b
tests: Move CorruptBBolt to testutil
...
Signed-off-by: Marek Siarkowicz <siarkowicz@google.com>
2022-07-25 13:59:30 +02:00
wayblink
428d21f5eb
mvcc:add ut for Revisions/CountRevisions and remove RangeSince as it is not used
...
Signed-off-by: wayblink <wayasxxx@gmail.com>
2022-06-21 11:41:44 +08:00
SimFG
d83925e357
schedule: Provide logs when the fifo job panic happens
...
To make the fifo scheduler better debuggability.
Signed-off-by: SimFG <1142838399@qq.com>
2022-06-15 20:58:17 +08:00
Marek Siarkowicz
9612fc1194
tests: Unify TestCompactionHash and extend it to also Delete keys and Defrag
...
Signed-off-by: Marek Siarkowicz <siarkowicz@google.com>
2022-06-13 18:20:19 +02:00
Marek Siarkowicz
0e739da9a4
server: Cache compaction hash for HashByRev API
...
Signed-off-by: Marek Siarkowicz <siarkowicz@google.com>
2022-06-13 18:20:18 +02:00
Marek Siarkowicz
2b090e86a6
server: Extract hasher to separate interface
...
Signed-off-by: Marek Siarkowicz <siarkowicz@google.com>
2022-06-13 18:20:18 +02:00
Marek Siarkowicz
80828b593a
server: Remove duplicated compaction revision
...
Signed-off-by: Marek Siarkowicz <siarkowicz@google.com>
2022-06-13 18:20:18 +02:00
Marek Siarkowicz
34a02ba621
server: Return revision range that hash was calcualted for
...
Signed-off-by: Marek Siarkowicz <siarkowicz@google.com>
2022-06-13 18:20:17 +02:00
Marek Siarkowicz
76d3c527ae
server: Store real rv range in hasher
...
Signed-off-by: Marek Siarkowicz <siarkowicz@google.com>
2022-06-13 18:19:26 +02:00
Marek Siarkowicz
8f7b053480
server: Move adjusting revision to hasher
...
Signed-off-by: Marek Siarkowicz <siarkowicz@google.com>
2022-06-13 18:19:26 +02:00
Marek Siarkowicz
19941654fe
server: Pass revision as int
...
Signed-off-by: Marek Siarkowicz <siarkowicz@google.com>
2022-06-13 18:19:26 +02:00
Marek Siarkowicz
887e53e61a
server: Calculate hash during compaction
...
Signed-off-by: Marek Siarkowicz <siarkowicz@google.com>
2022-06-13 18:19:26 +02:00
Marek Siarkowicz
7381c81a7e
server: Fix range in mock not returning same number of keys and values
...
Signed-off-by: Marek Siarkowicz <siarkowicz@google.com>
2022-06-13 18:19:26 +02:00
Marek Siarkowicz
08a43178fa
server: Move reading KV index inside scheduleCompaction function
...
Makes it easier to test hash match between scheduleCompaction and
HashByRev.
Signed-off-by: Marek Siarkowicz <siarkowicz@google.com>
2022-06-13 18:19:26 +02:00
Marek Siarkowicz
638ca1006a
server: Return error from scheduleCompaction
...
Signed-off-by: Marek Siarkowicz <siarkowicz@google.com>
2022-06-13 18:19:26 +02:00
Marek Siarkowicz
0f90359c4b
server: Refactor hasher
...
Signed-off-by: Marek Siarkowicz <siarkowicz@google.com>
2022-06-13 18:19:25 +02:00
Marek Siarkowicz
e62c358793
server: Extract kvHash struct
...
Signed-off-by: Marek Siarkowicz <siarkowicz@google.com>
2022-06-13 18:19:25 +02:00
Marek Siarkowicz
fcaf76dbca
server: Move unsafeHashByRev to new hash.go file
...
Signed-off-by: Marek Siarkowicz <siarkowicz@google.com>
2022-06-13 18:19:25 +02:00
Marek Siarkowicz
0984878ae7
server: Extract unsafeHashByRev function
...
Signed-off-by: Marek Siarkowicz <siarkowicz@google.com>
2022-06-13 18:19:25 +02:00
Marek Siarkowicz
39c6935c65
server: Test HashByRev values to make sure they don't change
...
Signed-off-by: Marek Siarkowicz <siarkowicz@google.com>
2022-06-13 18:19:25 +02:00
Marek Siarkowicz
7c35dadc25
server: Extract corruption detection to dedicated struct
...
Signed-off-by: Marek Siarkowicz <siarkowicz@google.com>
2022-06-13 18:19:24 +02:00
SimFG
b295cebc05
mvcc: improve the use of locks in index.go
...
To make the meaning of the RangeSince function in treeIndex clearer.
2022-06-09 20:35:02 +08:00
ahrtr
a3650db574
use readTx in (*store).restore
2022-04-08 15:45:05 +08:00
ahrtr
e155e50886
rename LockWithoutHook to LockOutsideApply and add LockInsideApply
2022-04-07 05:35:13 +08:00
ahrtr
bfd5170f66
add a txPostLockHook into the backend
...
Previously the SetConsistentIndex() is called during the apply workflow,
but it's outside the db transaction. If a commit happens between SetConsistentIndex
and the following apply workflow, and etcd crashes for whatever reason right
after the commit, then etcd commits an incomplete transaction to db.
Eventually etcd runs into the data inconsistency issue.
In this commit, we move the SetConsistentIndex into a txPostLockHook, so
it will be executed inside the transaction lock.
2022-04-07 05:35:13 +08:00
Marek Siarkowicz
ad03f2076a
Merge pull request #13886 from serathius/backend-logger
...
tests: Pass logger to backend
2022-04-05 16:35:07 +02:00
Marek Siarkowicz
73fc864247
tests: Pass logger to backend
2022-04-05 15:53:38 +02:00
Marek Siarkowicz
1d3517020b
server: Add verification of whether lock was called within out outside of apply
2022-04-05 15:34:45 +02:00
Marek Siarkowicz
804fddf921
tests: Use zaptest.NewLogger in tests
2022-04-04 13:03:15 +02:00
ahrtr
9b3b383366
the file server/storage/mvcc/util.go isn't used at all, so removing it
2022-03-31 10:14:46 +08:00
kkkkun
124bc1ebbc
mvcc: clean up duplicate metrics name
2022-03-01 18:00:07 +08:00
kkkkun
0ecd4de923
delete duplicate metrics rangeCounterDebug
2022-02-28 16:22:40 +08:00
AdamKorcz
029c354316
server/storage/mvcc: fix oss-fuzz issue 44449
2022-02-11 10:57:02 +00:00
Piotr Tabor
14a661e643
Merge pull request #13601 from lixd/op-put-lease
...
mvcc: add a fast return at put method
2022-01-19 14:47:26 +01:00