-
Notifications
You must be signed in to change notification settings - Fork 214
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
-a only support up to 10 versions #51
Comments
The root of the issue here is that we store the version as a string, and when we ask DDB to sort by range key (version), it does so lexicographically (which is a reasonable thing to do), when we want it sorted numerically. My knee-jerk response is that we should change the table schema to store versions as numbers instead of as strings. That would be a breaking change and require that everyone recreate their DDB table. We could make it easy by having a The alternative would be to fetch all the versions for a given secret, and then do the sort locally. The big downside here is that as people have wither lots of secret versions, or larger secrets, this operation will consume more read capacity. Both options have downsides. Requiring a table migration is a pain once, but avoids a bunch of pain in the future. Doing the sort locally means you dont have to migrate the table, but you pay a penalty on every operation forever. I'm a fan of doing a simple migration command and moving What do other people think? |
Changing From a cursory glance at the versioning code, I think there might be another alternative. Could you modify the autoversioning (line 468) to left-pad integer strings so that they are of a fixed size large enough to accommodate a common value of I'm also curious to know if any credstash users actually are using custom, non-numerical versioning schemes. If nobody is doing that, then I'm +1 to migration to numbers. |
Assuming dynamo sorts what dom proposes properly, that seems to be the best all-around fix. Given that this is a version value that credstash is maintaining, creating an arbitrary rule that has the side effect of correct behavior seems permissible. One caveat would be that if credstash ever got ported to a different datastore, sort results might be different. |
I had thought about left-padding, but couldn't figure out how far to go. |
Just fyi, I am seeing this in version 1.6 as well. We don't use custom, non-numerical versioning and would be fine with doing a migration. |
Is this bug fixed? We are looking at deploying credstash here at work, so this issue is of some interest. |
@michel-slm there is a PR open with a fix. I want us to add some clarification to the README about how auto-versions will work after the patch. The patch should get merged in in the next few days |
With 1.7 release, 'credstash put foo bar -a' only support up to 10 versions.
After that 'credstash put foo bar -a' always update the value of 10th version,
and 'credstash get foo' always return the value of the 9th version.
The text was updated successfully, but these errors were encountered: