951 Commits

Author SHA1 Message Date
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
01e85be159 server: Cover corruptionMonitor with tests
Get 100% coverage on InitialCheck and PeriodicCheck functions to avoid
any mistakes.

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
Marek Siarkowicz
70fbc0b3e7 server: Extract triggerCorruptAlarm to function
Signed-off-by: Marek Siarkowicz <siarkowicz@google.com>
2022-06-13 18:04:24 +02:00
Marek Siarkowicz
31cd4e7c2d
Merge pull request #14084 from SimFG/mvcc-range-since
mvcc: improve the use of locks in index.go
2022-06-09 15:39:18 +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
Marek Siarkowicz
72a84ddbcf server: Fix broken code during merge 2022-06-09 13:34:33 +02:00
Benjamin Wang
5a7df03592
Merge pull request #14080 from ahrtr/lease_revoke_lock
Fix potential deadlock between Revoke and (Grant or Checkpoint)
2022-06-09 16:52:36 +08:00
Sahdev Zala
d9e5460ca8
Merge pull request #13829 from qsyqian/feature/skip_compact_when_rev_not_change
skip compact when rev not change at period compact mode
2022-06-08 22:54:39 -04:00
Dirc
ba405f64c1
Update link to tuning page 2022-06-08 10:16:04 +02:00
ahrtr
dabf6978cc Fix potential deadlock between Revoke and (Grant or Checkpoint) 2022-06-07 18:45:43 +08:00
ahrtr
1d482bfc08 Move the local variable cps into the loop so that it will not continue to schedule checkpoints after it steps down the leader 2022-05-29 05:08:41 +08:00
Benjamin Wang
ce77d83ee6
Merge pull request #14067 from ahrtr/lease_revoke
Fix the race condition between goroutine and channel on the same leases to be revoked
2022-05-29 05:04:26 +08:00
ahrtr
6e9397d171 move lease related code into a separate file lease.go 2022-05-27 20:22:29 +08:00
ahrtr
25deb436af fix the race condition between goroutine and channel on the same leases to be revoked 2022-05-25 16:44:41 +08:00
Piotr Tabor
41ff2370e9 Remove unused code and apply code-quality suggestions. 2022-05-20 14:42:39 +02:00
Piotr Tabor
85b18c9b3e Rename WrapApply to Apply. 2022-05-20 14:32:04 +02:00
Piotr Tabor
87b80f16ca Fixing missing comment on the dispatch() function. 2022-05-20 14:32:04 +02:00
Piotr Tabor
42c6e08f22 Rename the txn, so as not to be the same as the package name. 2022-05-20 14:32:04 +02:00
Piotr Tabor
0da0cf4795 expose UberApplier as interface (not as implementation struct). 2022-05-20 14:32:04 +02:00
Piotr Tabor
5097b33ab9 Rename etcdserver/etcderrors package to etcdserver/errors. 2022-05-20 14:32:04 +02:00
Piotr Tabor
63b2f63cc1 Rename package alising "apply2" -> apply. 2022-05-20 14:32:04 +02:00
Piotr Tabor
c62f01e5fe Move CheckTxnAuth to txn. 2022-05-20 14:32:04 +02:00
Piotr Tabor
c78bf655a7 Simplify imports and improve comments. 2022-05-20 14:32:04 +02:00
Piotr Tabor
4e04770bac Apply encapsulation: Cleanup metrics reporting.
Side effect: applySec(0.4s) used to be reported as 0s, now it's correctly 0.4s.
2022-05-20 14:32:04 +02:00
Piotr Tabor
47a771871b Move apply to its own package (no dependency on etcdserver). 2022-05-20 14:32:04 +02:00
Piotr Tabor
fc6a6c3c27 Move etcdserver/errors.go to sepatate package to avoid cyclic dependencies. 2022-05-20 14:32:04 +02:00
Piotr Tabor
e2ae9b1d13 Move server/etcdserver/txn.go to new package: server/etcdserver/txn 2022-05-20 14:32:04 +02:00
Piotr Tabor
b073129d03 Applier does not depend on EtcdServer any longer.
All the depencies are explicily passed to the UberApplier factory method.
2022-05-20 14:32:04 +02:00
Piotr Tabor
651de5a057 Rename EtcdServer.Id with EtcdServer.MemberId.
It was misleading and error prone vs. ClusterId.
2022-05-20 14:32:04 +02:00
Piotr Tabor
f348134edd Marge applierV3Internal into applierV3 interface 2022-05-20 14:32:04 +02:00
Piotr Tabor
b7ad746bfe Encapsulating applier logic: UberApplier coordinates all appliers for server
This PR:
 - moves wrapping of appliers (due to Alarms) out of server.go into uber_applier.go
 - clearly devides the application logic into: chain of:
     a) 'WrapApply' (generic logic across all the methods)
     b) dispatcher (translation of Apply into specific method like 'Put')
     c) chain of 'wrappers' of the specific methods (like Put).
 - when we do recovery (restore from snapshot) we create new instance of appliers.

The purpose is to make sure we control all the depencies of the apply process, i.e.
we can supply e.g. special instance of 'backend' to the application logic.
2022-05-20 14:32:04 +02:00
Piotr Tabor
cdf9869d70 Encapsulation of applier logic: Move Txn related code out of applier.go.
The PR removes calls to applierV3base logic from server.go that is NOT part of 'application'.
The original idea was that read-only transaction and Range call shared logic with Apply,
so they can call appliers directly (but bypassing all 'corrupt', 'quota' and 'auth' wrappers).

This PR moves all the logic to a separate file (that later can become package on its own).
2022-05-20 14:32:04 +02:00
ahrtr
b32ac1f67b fix a typo: print the correct error info 2022-05-19 07:19:44 +08:00
ahrtr
1e6163ba27 remove v2 http proxy in 3.6 2022-05-13 17:44:58 +08:00
Christian Provenzano
c1e58ee91f server: Don't register director interrupt handler 2022-05-11 21:21:06 -04:00
Christian Provenzano
b5b466088d server: Move director interrupt handler to method 2022-05-11 20:41:10 -04:00
Christian Provenzano
655d171eca server: Add director interrupt handler
Director's goroutine would not be properly stopped in a non-test
scenario. Handler stops it when process is interrupted.
2022-05-11 18:19:22 -04:00
Christian Provenzano
70a7674e20 server: Director can be stopped
Goroutine for new directors would live past director scope. Tests
could occassionally fail if this goroutine had log events after
test execution should have ended.
2022-05-10 23:36:14 -04:00
ahrtr
e7f8bf7c44 enhance the /version endpoint to add storageVersion 2022-05-06 20:29:42 +08:00
Marek Siarkowicz
d58f971895 tests: Use zaptest.NewLogger in places we missed 2022-05-06 12:23:20 +02:00
Marek Siarkowicz
f09da32f9d
Merge pull request #13655 from serathius/health
Cleanup healthcheck code after V2 removal
2022-05-06 12:08:36 +02:00
Marek Siarkowicz
26f42e7a9e server: Apply review comments and split basic handler 2022-05-05 09:52:14 +02:00
Marek Siarkowicz
fb361e43f0 server: Split code for debug and version endpoints 2022-05-05 09:52:14 +02:00