-
Notifications
You must be signed in to change notification settings - Fork 519
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
sundog: use JSON output to allow non-String generated model types #430
Conversation
We should probably update Updog to |
This push adds a commit that changes updog to use |
81acf70
to
5f4a3f3
Compare
(oops; also pushed the work-in-progress migration commit, which I just removed.) |
This push adds a migration for the data type change of the seed. The data-store-version is bumped to 0.1, our first change. |
We couldn't use an integer for the bork-generated update seed because sundog was taking the output of generators and serializing it as a string. This lets the generator determine the type of the output by using JSON as an interchange format. Pluto and bork are updated to serialize their output appropriately. (Note: bork can't use a u64 because JSON can't encode a u64; u32 is granular enough for this purpose.)
0444641
to
6a98ee6
Compare
Had to rebase on develop to fix all of the paths that changed with #428. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good - it would be nice to try updating into this by eg. manually dd-ing this to the inactive side, putting the migration in the migration directory, and running updog update-apply --reboot
to see it survive.
6a98ee6
to
bbc8a66
Compare
This push addresses @sam-aws 's comment about not changing the seed value in backward migrations where we already found a string that's a valid u32. |
Done and successful! Updated description with testing details. |
|
use std::convert::TryFrom; | ||
|
||
/// We moved from String to u32 for the seed value generated by bork and used by updog. | ||
struct BorkSeedIntMigration; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we instead name the crate and this migration type consistently to be more descriptive than "borkseed", I think "bork-seed-int" is a much more descriptive and helpful name.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That short name (without the "-migration" suffix used for the binary) only shows up as a path component that follows 'migrations' so I chose to keep it short since its purpose was already obvious.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are there or do namespaces prevent conflicts?
I'm thinking about this along the lines of traditional db migrations where a short but descriptive name make its activities clearer.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we'll have a better idea when we have more than one. It's easy to change; migrations are referenced from the repo, so we can change them at any time.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
bbc8a66
to
3ee3f89
Compare
This push removes one line of the change where I had changed u64 to u32, but the u64 was unrelated to the seed value. Filed #447 for fixing that. |
We couldn't use an integer for the bork-generated update seed because sundog
was taking the output of generators and serializing it as a string. This lets
the generator determine the type of the output by using JSON as an interchange
format.
Pluto and bork are updated to serialize their output appropriately.
(Note: bork can't use a u64 because JSON can't encode a u64; u32 is granular
enough for this purpose.)
Fixes #260.
Testing done:
updog config still OK, and the data store value is now an integer:
sundog is happy:
migration testing done:
Normal forward migration - u32-compatible string to u32:
If we run again, it's a weird forward migration, already a u32-compatible number, but OK:
If we have some other string we'll get a clear error and failure:
Other types are reported as unsupported and fail:
Now the backward migrations.
Normal backward migration - u32 to string.
If we run again, it's a weird backward migration, already a u32-compatible number, but OK:
If we have some other string we'll get a clear error and failure:
Other types are reported as unsupported and fail:
Live instance testing:
Started an older AMI, yeeted my update into slot B, copied over the migration, signpost-flipped, and rebooted. Started OK, migration ran OK, and the setting is an integer!