Commit Graph

495 Commits

Author SHA1 Message Date
Armon Dadgar 5b6ce2ca4a consul: Setup ACLs and timers after initial barrier 2014-12-12 21:42:24 -08:00
Armon Dadgar f25566931f consul: Make sessionTimersLock a plain mutex 2014-12-12 19:17:35 -08:00
Armon Dadgar 9b897d1134 consul: Ignore zero ttl on session 2014-12-12 19:17:04 -08:00
Armon Dadgar 990ad02f83 consul: Minor cleanups 2014-12-12 15:43:34 -08:00
Armon Dadgar 8dbfe7c9a8 Merge pull request #524 from amalaviy/session_ttl
Consul Session TTLs
2014-12-12 14:42:25 -08:00
Atin Malaviya 073020f6be Add invalidateSession test 2014-12-11 06:09:53 -05:00
Atin Malaviya 5a76929ba4 Fixed clearSessionTimer, created invalidateSession, added invalid TTL test 2014-12-11 05:34:31 -05:00
Atin Malaviya 7ece29c3e0 Took out usage of snapshot SessionListTTL 2014-12-10 21:37:06 -05:00
Atin Malaviya 2de09dc2e7 Took out StateSnapshot SessionListTTL also 2014-12-10 20:53:05 -05:00
Atin Malaviya 8369b77204 Clean up code based on feedback from armon 2014-12-10 20:49:06 -05:00
Atin Malaviya a1afc07f54 Added more tests 2014-12-10 16:43:15 -05:00
Atin Malaviya c992c18ef0 Added more tests. Also added return of 404 if the session id to renew is not found 2014-12-10 10:02:23 -05:00
Atin Malaviya b623af776b Consul Session TTLs
The design of the session TTLs is based on the Google Chubby approach
(http://research.google.com/archive/chubby-osdi06.pdf). The Session
struct has an additional TTL field now. This attaches an implicit
heartbeat based failure detector. Tracking of heartbeats is done by
the current leader and not persisted via the Raft log. The implication
of this is during a leader failover, we do not retain the last
heartbeat times.

Similar to Chubby, the TTL represents a lower-bound. Consul promises
not to terminate a session before the TTL has expired, but is allowed
to extend the expiration past it. This enables us to reset the TTL on
a leader failover. The TTL is also extended when the client does a
heartbeat. Like Chubby, this means a TTL is extended on creation,
heartbeat or failover.

Additionally, because we must account for time requests are in transit
and the relative rates of clocks on the clients and servers, Consul
will take the conservative approach of internally multiplying the TTL
by 2x. This helps to compensate for network latency and clock skew
without violating the contract.

Reference: https://docs.google.com/document/d/1Y5-pahLkUaA7Kz4SBU_mehKiyt9yaaUGcBTMZR7lToY/edit?usp=sharing
2014-12-07 12:38:22 -05:00
Ali Abbas a542df954f cleanup and simplify 2014-12-06 13:08:35 +01:00
Ali Abbas 40979b1159 * use defer to avoid tracking lock
* simplify control flow
2014-12-06 12:32:18 +01:00
Chavez 5f4281f98f consul: Server leave test fix 2014-12-05 11:22:54 -08:00
Chavez c6b3cae106 consul: Fix failing globalRPC test 2014-12-05 10:36:37 -08:00
Veres Lajos 850d5bdc32 typofixes - https://github.com/vlajos/misspell_fixer 2014-12-04 23:25:06 +00:00
Armon Dadgar 402d580863 consul: Check that ACL also allows registration 2014-11-30 21:10:42 -07:00
Armon Dadgar d74f79b3fa consul: Enforce service registration ACLs 2014-11-30 21:05:15 -07:00
Ali Abbas 818fc22c9f * Fix race condition on read/write of shutdown bool variable of server and connection pool.
* In connection pool, there is no guarantee that .reap() cannot execute the same time as .Shutdown() is called. It also did not benefit to eval shutdown when a select is run on the shutdown channel.
* In server, same principle applies to handleConsulConn. Since we also have a shutdown channel, it makes more to use this than to loop on a bool variable.
2014-11-26 10:39:25 +01:00
Ali Abbas 73504a01e9 cleanup unreachable code 2014-11-25 19:54:30 +01:00
Atin Malaviya d7e09d57ba Set empty Behavior setting into SessionKeysRelease and flag error for unrecognized values 2014-11-20 19:16:07 -05:00
Atin Malaviya 3aabda02b3 Clean up tests, use switch to default session.Behavior value if unspecified, unrecognized 2014-11-20 14:29:18 -05:00
Atin Malaviya aa0cecd04e Ephemeral Nodes for via Session behavior settings.
Added a "delete" behavior for session invalidation, in addition to
the default "release" behavior. On session invalidation, the sessions
Behavior field is checked and if it is set to "delete", all nodes owned
by the session are deleted. If it is "release", then just the locks
are released as default.
2014-11-20 11:34:45 -05:00
Ryan Uber 4cd89a9113 Rebase against upstream 2014-11-19 16:45:49 -08:00
Ryan Uber 3b2ab70c4d consul: clean up comments, fix globalRPC tests 2014-11-19 16:37:40 -08:00
Ryan Uber 4a8249db00 consul: fix obscure bug when launching goroutines from for loop 2014-11-19 16:37:40 -08:00
Ryan Uber 2661bbfa27 consul: more tests, remove unused KeyManager() method 2014-11-19 16:37:40 -08:00
Ryan Uber fcacee723b consul: simplify keyring operations 2014-11-19 16:36:19 -08:00
Ryan Uber 66ad81ef13 consul: add test for internal keyring rpc endpoint 2014-11-19 16:36:19 -08:00
Ryan Uber 344b63b9db consul: simplify keyring operations 2014-11-19 16:36:19 -08:00
Ryan Uber b3f251de9c command/keyring: clean up tests 2014-11-19 16:36:18 -08:00
Ryan Uber d02afd42fb agent: -encrypt appends to keyring if one exists 2014-11-19 16:36:01 -08:00
Ryan Uber 295f876923 command/agent: fix up gossip encryption indicator 2014-11-19 16:35:37 -08:00
Ryan Uber 7f85c708dc agent: squash some more common keyring semantics 2014-11-19 16:34:18 -08:00
Ryan Uber 4e8f53fa5d consul: detach executeKeyringOp() from *Internal 2014-11-19 16:34:18 -08:00
Ryan Uber db0084ccd0 consul: use keyring operation type to cut out duplicated logic 2014-11-19 16:34:18 -08:00
Ryan Uber 057c22db10 consul: generalize multi-DC RPC call broadcasts 2014-11-19 16:34:18 -08:00
Ryan Uber 001a579d47 command/keyring: cleanup 2014-11-19 16:34:18 -08:00
Ryan Uber cb795199d1 consul: test rpc errors returned from remote datacenters 2014-11-19 16:34:18 -08:00
Ryan Uber a1943afddc consul: make forwarding to multiple datacenters parallel 2014-11-19 16:34:18 -08:00
Ryan Uber d7edc1c51c consul: break rpc forwarding and response ingestion out of internal endpoints 2014-11-19 16:34:18 -08:00
Ryan Uber 1ec111bbfc consul: kill unused struct fields 2014-11-19 16:34:17 -08:00
Ryan Uber f6b5fc8c08 consul: cross-dc key rotation works 2014-11-19 16:34:17 -08:00
Ryan Uber f9b5b15a6b consul: use a function for ingesting responses 2014-11-19 16:34:17 -08:00
Ryan Uber 71e9715c54 consul: restructuring 2014-11-19 16:34:17 -08:00
Ryan Uber a551a6e4a0 consul: refactor keyring, repeat RPC calls to all DC's 2014-11-19 16:34:17 -08:00
Ryan Uber 2e92e19760 agent: refactor keyring loader 2014-11-19 16:31:06 -08:00
Ryan Uber 43a60f1424 command: basic rpc works for keys command 2014-11-19 16:30:21 -08:00