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

[mysql] Make the userid column a BIGINT #470

Closed
pjenvey opened this issue Mar 6, 2020 · 3 comments · Fixed by #530
Closed

[mysql] Make the userid column a BIGINT #470

pjenvey opened this issue Mar 6, 2020 · 3 comments · Fixed by #530
Assignees
Labels
2 Estimate - s - This is a small change with clearly defined parameters. bug Something isn't working good first bug Low priority, but valuable contributions

Comments

@pjenvey
Copy link
Member

pjenvey commented Mar 6, 2020

The mysql schema defines the userid column in all tables as a regular 32 bit INT. This is incorrect: the userid is handed to syncstorage-rs via an auth token by the tokenserver, which uses a 64 bit BIGINT.

syncstorage-rs correctly parses the auth token into the HawkIdentifier struct, w/ userid (HawkIdentifier refers to it as legacy_id) being 64 bits.

The mysql db code then casts legacy_id down to the a u32 (which truncates!) per the column type.

We need to:

  • Create a new diesel migration to convert the column to a BIGINT
  • Modify the diesel schema accordingly
  • Remove the truncating casts (though we still need to cast from legacy_id's u64 type to i64 which diesel expects for BIGINTs)

(This bug extracted from the original #74)

@pjenvey pjenvey added bug Something isn't working 2 Estimate - s - This is a small change with clearly defined parameters. good first bug Low priority, but valuable contributions labels Mar 6, 2020
@pjenvey pjenvey mentioned this issue Mar 6, 2020
3 tasks
@Emmanuel-Melon
Copy link
Contributor

Hi @pjenvey, this sounds like a good first issue. I'd love to give it a shot. I'll take a look at the codebase and then give you an update.

@undef1nd
Copy link
Contributor

Hey @Emmanuel-Melon, are you working on this one? I'd like to give it a try 🙂

@Emmanuel-Melon
Copy link
Contributor

Emmanuel-Melon commented Mar 18, 2020 via email

Emmanuel-Melon added a commit to Emmanuel-Melon/syncstorage-rs that referenced this issue Apr 3, 2020
The MySQL schema defines userid columns as 32 bit integers inteded for use by the token server which expects 64 bit integers.
This change creates a new migration to convert the columns and to modify the `src/db/mysql/schema.rs` to reflect those changes.

Closes mozilla-services#470
Emmanuel-Melon added a commit to Emmanuel-Melon/syncstorage-rs that referenced this issue Apr 3, 2020
The MySQL schema defines userid columns as 32 bit integers inteded for use by the token server which expects 64 bit integers.
This change creates a new migration to convert the columns and to modify the `src/db/mysql/schema.rs` to reflect those changes.

Closes mozilla-services#470
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
2 Estimate - s - This is a small change with clearly defined parameters. bug Something isn't working good first bug Low priority, but valuable contributions
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants