Skip to content
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

feature: txn on lease expiry #8842

Closed
heyitsanthony opened this issue Nov 8, 2017 · 2 comments
Closed

feature: txn on lease expiry #8842

heyitsanthony opened this issue Nov 8, 2017 · 2 comments

Comments

@heyitsanthony
Copy link
Contributor

This came up in relation to etcd-io/zetcd#88

When an ephemeral node is deleted in ZooKeeper, the node's parent directory's Pzxid (last modified child revision) and CVersion (number of changes to children) fields are bumped. However, since zetcd relies on etcd leases for ephemeral node deletion, there is no way to update these fields atomically when the lease is lost and the node is deleted. Working around this with a single lease per zketcd server and emulating per-connection TTLs is infeasible since sessions may have both a short TTL and a long TTL; the server's lease would either be too short or too long.

A possible solution is to extend mvccpb.KeyValue to include a lease transaction:

message KeyValue {                                      
  ...
  int64 lease = 6;
  bytes lease_txn = 7;                                                                                    
} 

The lease_txn field holds a serialization of etcdserverpb.TxnRequest ; it is an opaque bytes type to avoid circular dependency between mvccpb and etcdserverpb. If the key's lease expires, the key's lease is set to 0 (for cases where deleting the key is undesirable) and lease_txn is committed. If lease_txn is nil, the key is deleted like it is now, which is a special case of the proposed lease_txn behavior.

@wenjiaswe
Copy link
Contributor

cc @jpbetz

@stale
Copy link

stale bot commented Apr 7, 2020

This issue has been automatically marked as stale because it has not had recent activity. It will be closed after 21 days if no further activity occurs. Thank you for your contributions.

@stale stale bot added the stale label Apr 7, 2020
@stale stale bot closed this as completed Apr 28, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

No branches or pull requests

3 participants