12 Commits

Author SHA1 Message Date
Ulexus
85301dbc4e Add mod/lock timeout.
Added timeout goroutine to stop waiting on lock after timeout
expiration.

This necessitated reworking the flow of the acquire handler.  createNode
now _only_ creates the node; it no longer waits on the lock itself.
getLockIndex (perhaps this is poorly named) extracts out the lock
checking routine so that it can be used by "get" and "watch", both.
get() was added to instantaneously attempt to acquire a lock with no
waiting.

If a lock fails to acquire, for whatever reason, an error is returned,
resulting in a code 500 to the client.
2014-03-26 10:39:48 -06:00
Ben Johnson
dde2b71850 fix(mod/lock): correct watch index to remove cpu load
The waitIndex was being pulled from the wrong node in the lock parent which caused the watch to be returned immediately. This caused a continuous set of calls while a client was waiting for a lock.
2014-02-26 17:26:25 -07:00
Ben Johnson
137f87c414 Merge branch 'mod-lock-fixes' of https://github.com/nabeken/etcd into nabeken-mod-lock-fixes
Conflicts:
	mod/lock/v2/acquire_handler.go
2014-02-10 08:05:57 -07:00
Brandon Philips
13b6c1e684 chore(*): make everything use goven
for i in github.com/BurntSushi/toml github.com/coreos/go-etcd/etcd github.com/coreos/go-log/log github.com/gorilla/context github.com/rcrowley/go-metrics bitbucket.org/kardianos/osext github.com/coreos/go-systemd/journal github.com/coreos/raft code.google.com/p/goprotobuf/proto ; do goven  -copy -rewrite $i; done
2014-02-01 23:44:18 -08:00
Brandon Philips
ea8a353545 chore(*): gofmt everything 2014-02-01 23:44:10 -08:00
TANABE Ken-ichi
1273875a00 fix(mod/lock): Use CreatedIndex in the first node to watch
ModifiedIndex in the lock directory is not incremented and the event
store has only 1000 histories for now.

Acquiring a lock is not queued while (index - ModifiedIndex) > 1000 and
prevIndex exists.
2014-01-22 20:00:15 +09:00
TANABE Ken-ichi
4c2942f9f9 fix(mod/lock): Use dedicated channel to shutdown goroutine properly
If closeChan is available and stopWatchChan was closed by defer
select selects a single channel randomly. This causes a panic sending to closed
channel.
2014-01-22 19:42:07 +09:00
Ben Johnson
cde184fdbf Fix mod/lock and mod/leader return error codes. 2014-01-14 07:57:30 -07:00
Ben Johnson
61227d7477 mod/leader 2013-12-13 15:25:03 -07:00
Ben Johnson
4bec461db1 Refactor mod/lock. 2013-12-08 15:26:58 -07:00
Ben Johnson
5d865e321c Merge branch 'master' of https://github.com/coreos/etcd into mod-lock
Conflicts:
	server/v2/tests/delete_handler_test.go
	server/v2/tests/get_handler_test.go
	server/v2/tests/post_handler_test.go
	server/v2/tests/put_handler_test.go
	third_party/github.com/coreos/go-etcd/etcd/requests.go
2013-12-04 22:36:53 -07:00
Ben Johnson
e76b7d1e8b Add mod/lock version. 2013-12-04 22:24:04 -07:00