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

ETCD - Filter out locks from query results #40

Merged
merged 1 commit into from
Mar 7, 2022

Conversation

celian-garcia
Copy link
Member

According to the ETCD concurrency code directly https://github.com/etcd-io/etcd/blob/8ac44ffa5fcccc7928876be4682c07f50b5e3b7e/client/v3/concurrency/mutex.go#L114

The value of the lock seems to be "" empty string.

Thus I would like to filter empty values, hoping that it will prevent us from having this kind of issue in query all :

error decoding the value associated with the key '<queried-key>/<one-real-element>/3477f3fdab5002b': unexpected end of JSON input

@celian-garcia
Copy link
Member Author

It is probably not a good idea to check for the value to determinate if we encounter a lock or not. Despite the fact that I'm pretty sure that a lock value is empty string, one can simply set a real object with the empty string and would like to query it.

Probably a better approach would be to use leasing instead. Like if the object contains a lease, then it shouldn't be part of the result, but is there a case where we'd like to retrieve a real object (not a lock) with a lease inside ? I think not.

Another solution would be to not fail on Unmarshal issues, and continue. This is actually the better for me as currently we have a critical failure. You can currently make everything fail with that command etcdctl put <query key>/0 "". Because 0 will appears lexically at first result, and the first result being not parsable, it will fail and not make the rest

Signed-off-by: Célian Garcia <celian.garcia@amadeus.com>
@Nexucis
Copy link
Member

Nexucis commented Mar 7, 2022

thanks for the fix, totally make sense.

@Nexucis Nexucis merged commit 2de21e1 into perses:main Mar 7, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants