Commit Graph

48 Commits (5dc98c50d7461688e1f468f3276ff96d374e4636)

Author SHA1 Message Date
Gyuho Lee 1caaa9ed4a test: test update for Go 1.12.5 and related changes
Update to Go 1.12.5 testing. Remove deprecated unused and gosimple
pacakges, and mask staticcheck 1006. Also, fix unconvert errors related
to unnecessary type conversions and following staticcheck errors:
- remove redundant return statements
- use for range instead of for select
- use time.Since instead of time.Now().Sub
- omit comparison to bool constant
- replace T.Fatal and T.Fatalf in tests with T.Error and T.Fatalf respectively because the goroutine calls T.Fatal must be called in the same goroutine as the test
- fix error strings that should not be capitalized
- use sort.Strings(...) instead of sort.Sort(sort.StringSlice(...))
- use he status code of Canceled instead of grpc.ErrClientConnClosing which is deprecated
- use use status.Errorf instead of grpc.Errorf which is deprecated

Related #10528 #10438
2019-06-05 17:02:05 -04:00
Gyuho Lee 34bd797e67 *: revert module import paths
Signed-off-by: Gyuho Lee <leegyuho@amazon.com>
2019-05-28 15:39:35 -07:00
shivaramr 9150bf52d6 go modules: Fix module path version to include version number 2019-04-26 15:29:50 -07:00
nolouch e20b9d9e16 lease: fix deadlock with renew lease when the checkpointor is set
Signed-off-by: nolouch <nolouch@gmail.com>
2019-02-24 19:53:09 +08:00
Gyuho Lee d37f1521b7 *: update import paths to "go.etcd.io/etcd"
Signed-off-by: Gyuho Lee <leegyuho@amazon.com>
2018-08-28 17:47:55 -07:00
Joe Betz d1de41efe1
lease: Add unit and integration tests for lease checkpointing 2018-07-23 16:12:42 -07:00
Joe Betz bbe2d777b1
lease: Add LessorConfig and wire zap logger into Lessor 2018-07-17 13:10:34 -07:00
Iwasaki Yudai db21941d1d *: enforce max lease TTL with 9,000,000,000 seconds
math.MaxInt64 / time.Second is 9,223,372,036. 9,000,000,000 is easier to
remember/document.
2018-03-08 10:17:12 -08:00
Gyuho Lee 8a518b01c4 *: revert "internal/mvcc" change
Signed-off-by: Gyuho Lee <gyuhox@gmail.com>
2018-02-26 17:11:40 -08:00
Gyuho Lee dd2f3b0de8 *: revert "internal/lease" change
Signed-off-by: Gyuho Lee <gyuhox@gmail.com>
2018-02-26 17:11:40 -08:00
Gyuho Lee 349a377a67 *: move "lease" to "internal/lease"
Signed-off-by: Gyuho Lee <gyuhox@gmail.com>
2018-01-26 11:09:29 -08:00
Gyuho Lee 21d4307982 lease: use sort.Strings instead of StringSlice
Signed-off-by: Gyuho Lee <gyuhox@gmail.com>
2017-12-04 14:10:14 -08:00
lorneli 28a22075ca lease: test minLeaseTTL limit
Test whether lease's ttl is set to minLeaseTTL when passing a ttl
smaller than minLeaseTTL to Grant function.
2017-09-12 20:24:27 +08:00
Gyu-Ho Lee 099fbde809 lease: add 'Leases' method
Signed-off-by: Gyu-Ho Lee <gyuhox@gmail.com>
2017-08-14 14:18:53 -07:00
Gyu-Ho Lee 8d41820741 lease: stop lessors after tests
Signed-off-by: Gyu-Ho Lee <gyuhox@gmail.com>
2017-06-30 10:13:36 -07:00
Anthony Romano c38c00f7c3 lessor: extend leases on promote if expires will be rate limited
Instead of unconditionally randomizing, extend leases on promotion
if too many leases expire within the same time span. If the server
has few leases or spread out expires, there will be no extension.
2017-06-22 11:25:34 -07:00
Gyu-Ho Lee 5bba05703c lease: randomize expiry on initial refresh call
Randomize the very first expiry on lease recovery
to prevent recovered leases from expiring all at
the same time.

Address https://github.com/coreos/etcd/issues/8096.

Signed-off-by: Gyu-Ho Lee <gyuhox@gmail.com>
2017-06-15 12:57:49 -07:00
Anthony Romano 42d56d5ef7 lease: acquire BatchTx lock in fakeDeleter
Revoke expects the BatchTx lock to be held when holding the TxnDeleter
because it updates the lease bucket. The tests don't hold the lock so
it may race with the backend commit loop.

Fixes #7662
2017-04-04 20:52:23 -07:00
Anthony Romano 5e4b008106 *: base initial mmap size on quota size 2017-03-17 15:38:49 -07:00
Anthony Romano 2f1542c06d *: use filepath.Join for files 2017-03-16 07:46:06 -07:00
Anthony Romano f0c184b3a2 lease: support mvcc txn 2017-03-08 20:54:15 -08:00
Gyu-Ho Lee 6f0723f23f lease: guard 'Lease.itemSet' from concurrent writes
Fix https://github.com/coreos/etcd/issues/7448.

Affected if etcd builds with Go 1.8+.

Signed-off-by: Gyu-Ho Lee <gyuhox@gmail.com>
2017-03-08 11:01:42 -08:00
Gyu-Ho Lee 3d75395875 *: remove never-unused vars, minor lint fix
Signed-off-by: Gyu-Ho Lee <gyuhox@gmail.com>
2017-03-06 14:59:12 -08:00
fanmin shi e7f4010cca lease: Use monotonic time in lease
lease uses monotimer to calculate its expiration. In this way, changing system time won't affect in lease expiration.

FIX #6700
2016-11-29 12:31:00 -08:00
Gyu-Ho Lee 5adca4a720 lease, leasehttp: add TTL() method
Fix https://github.com/coreos/etcd/issues/6595.
2016-10-06 11:24:09 -07:00
Xiang Li f0469f7f25 Merge pull request #6570 from xiang90/lease_expire
Fix lease expire
2016-10-05 15:49:45 -07:00
Xiang Li 279c103517 lease: fix lease expire and add a test 2016-10-05 14:41:47 -07:00
Gyu-Ho Lee 4871a4a5f3 lease: remove redundant get method 2016-09-30 10:27:27 -07:00
Xiang Li 4d59b6f52c lease: delete kvs in a txn 2016-08-04 10:06:46 -07:00
Anthony Romano bf71497537 etcdserver, lease: tie lease min ttl to election timeout 2016-08-02 13:06:57 -07:00
Anthony Romano ea21b8ee1f lessor: fix go vet, goword warnings, and unreliable test 2016-06-17 13:37:25 -07:00
Gyu-Ho Lee ef44f71da9 *: update LICENSE header 2016-05-12 20:51:48 -07:00
Anthony Romano b7ac758969 *: rename storage package to mvcc 2016-04-25 15:25:51 -07:00
Xiang Li e9a0a103e5 *: refresh the lease TTL correctly when a leader is elected.
The new leader needs to refresh with an extened TTL to gracefully handle
the potential concurrent leader issue. Clients might still send keep alive
to old leader until the old leader itself gives up leadership at most after
an election timeout.
2016-03-15 22:40:03 -07:00
Xiang Li bfa5e310a9 *: detach keys from leases
1. deatch when a key is removed
2. deatch when the key's lease changes
3. potentially deatch when restroing a tombstone key
2016-02-11 15:31:25 -08:00
Anthony Romano 20461ab11a *: fix many typos 2016-01-31 21:42:39 -08:00
Anthony Romano 9113a27bde lease: grant consistent lease IDs
When raft broadcasts a Grant to all nodes, all nodes must
agree on the same lease ID. Otherwise, attaching a key to
a lease will fail since the lease ID is node-dependent.
2016-01-22 09:43:39 -08:00
Xiang Li 59bf83c7f4 *: now lease keepAlive works on leader 2016-01-09 22:12:02 -08:00
Xiang Li f01c8188f8 *: rename lease.DeleteableRange to lease.RangeDeleter 2016-01-09 11:01:58 -08:00
Xiang Li f5753f2f51 *: support lease Attach
Now we can attach keys to leases. And revoking the lease removes all
the attached keys of that lease.
2016-01-09 11:01:58 -08:00
Xiang Li 12912501bd lease: remove minExpiry and add helper funcs 2016-01-08 14:29:33 -08:00
Xiang Li 2566699a48 *: revoke expired leases 2016-01-08 13:37:58 -08:00
Xiang Li d9ca929a33 *: add support for lease create and revoke
Basic support for lease operations like create and revoke.
We still need to:
1. attach keys to leases in KV implmentation if lease field is set
2. leader periodically removes expired leases
3. leader serves keepAlive requests and follower forwards keepAlive
requests to leader.
2016-01-07 16:39:39 -08:00
Xiang Li 9156e54f1f lease: recovery leases from backend 2016-01-05 11:21:11 -08:00
Xiang Li 09b420f08c *: move leaseID typedef to lease pkg 2016-01-05 10:18:17 -08:00
Xiang Li 25f82b25f7 lease: modify API and persist lease to disk 2016-01-05 10:09:42 -08:00
Xiang Li bf3bc0ed6b lease: delete items when the lease is revoked.
Add minimum KV interface and implmement the deleting mechanism for
revoking lease.
2015-11-11 13:21:12 -08:00
Xiang Li bf70b5127a lease: initial lessor impl 2015-11-08 11:28:50 -08:00