-
Notifications
You must be signed in to change notification settings - Fork 9.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
what is used for about ttl in session? #6736
Comments
It's a lease wrapper that refreshes a lease until it is closed. It is blocking because the session that holds the lock is still alive and refreshing the underlying lease. |
@heyitsanthony ok, it looks like I understand not correct. But is there anything to make session release the lock when timeout? |
@heyitsanthony |
It's a distributed lock-- if there's no TTL / an infinite TTL and the lock holder crashes, the system can't make forward progress because the lock will never be released. |
@heyitsanthony Sorry, I am confused now. |
No. It's for liveness checking. If the lock owner does not refresh its session lease within 1s (e.g., the process crashed), etcd will revoke the lease and the next waiter can claim the lock. If the lock owner keeps refreshing its session lease, it will not lose the lock. |
ok, understand it. |
What is ttl in session used for? I thought it is the timeout for lock.
But I create a locker by
concurrency.NewLocker
withconcurrency.WithTTL
, andLock
, sleep for some time over the ttl, and create another locker locked on the same key, but it blocked.Do I understand not correct?
The text was updated successfully, but these errors were encountered: