-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
feat: re-enable legacy client IDs #3628
Conversation
Codecov Report
@@ Coverage Diff @@
## master #3628 +/- ##
==========================================
- Coverage 76.18% 76.06% -0.13%
==========================================
Files 133 132 -1
Lines 10043 9971 -72
==========================================
- Hits 7651 7584 -67
+ Misses 1868 1866 -2
+ Partials 524 521 -3
|
// set the internal primary key | ||
cl.ID = o.ID |
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.
Why can we remove this?
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.
The previous UUID (pk) is basically not used. For cockroach, we can just use a hash-sharded index to avoid hot-spots. Mysql, postgres, and sqlite are fine with sequential keys (mysql actually prefers them).
bcd0f5c
to
233c8df
Compare
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.
Wow, lots of tedious work. Well done!
Couple more failing tests... LMK if you want help. |
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.
Please check all foreign key relations, and check that pk has no foreign key relations either.
@@ -0,0 +1 @@ | |||
ALTER TABLE hydra_client ALTER PRIMARY KEY USING COLUMNS (id, nid) USING HASH; |
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.
Now that id
can be user-set, this can lead to ID collisions. We need to ensure that all foreign key lookups consider the full primary key.
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 checked, and all foreign-keys on the client table use (id, nid)
:
select col.constraint_name, col.table_name, column_name, ordinal_position, referenced_table_name from information_schema.key_column_usage as col join information_schema.referential_constraints as constr on col.constraint_name = constr.constraint_name where referenced_table_name != 'networks';
constraint_name | table_name | column_name | ordinal_position | referenced_table_name
--------------------------------------------------------------+------------------------------------------------+------------------+------------------+--------------------------------------
hydra_oauth2_obfuscated_authentication_session_client_id_fk | hydra_oauth2_obfuscated_authentication_session | client_id | 1 | hydra_client
hydra_oauth2_obfuscated_authentication_session_client_id_fk | hydra_oauth2_obfuscated_authentication_session | nid | 2 | hydra_client
hydra_oauth2_logout_request_client_id_fk | hydra_oauth2_logout_request | client_id | 1 | hydra_client
hydra_oauth2_logout_request_client_id_fk | hydra_oauth2_logout_request | nid | 2 | hydra_client
hydra_oauth2_access_challenge_id_fk | hydra_oauth2_access | challenge_id | 1 | hydra_oauth2_flow
hydra_oauth2_access_client_id_fk | hydra_oauth2_access | client_id | 1 | hydra_client
hydra_oauth2_access_client_id_fk | hydra_oauth2_access | nid | 2 | hydra_client
hydra_oauth2_refresh_challenge_id_fk | hydra_oauth2_refresh | challenge_id | 1 | hydra_oauth2_flow
hydra_oauth2_refresh_client_id_fk | hydra_oauth2_refresh | client_id | 1 | hydra_client
hydra_oauth2_refresh_client_id_fk | hydra_oauth2_refresh | nid | 2 | hydra_client
hydra_oauth2_code_challenge_id_fk | hydra_oauth2_code | challenge_id | 1 | hydra_oauth2_flow
hydra_oauth2_code_client_id_fk | hydra_oauth2_code | client_id | 1 | hydra_client
hydra_oauth2_code_client_id_fk | hydra_oauth2_code | nid | 2 | hydra_client
hydra_oauth2_oidc_challenge_id_fk | hydra_oauth2_oidc | challenge_id | 1 | hydra_oauth2_flow
hydra_oauth2_oidc_client_id_fk | hydra_oauth2_oidc | client_id | 1 | hydra_client
hydra_oauth2_oidc_client_id_fk | hydra_oauth2_oidc | nid | 2 | hydra_client
hydra_oauth2_pkce_challenge_id_fk | hydra_oauth2_pkce | challenge_id | 1 | hydra_oauth2_flow
hydra_oauth2_pkce_client_id_fk | hydra_oauth2_pkce | client_id | 1 | hydra_client
hydra_oauth2_pkce_client_id_fk | hydra_oauth2_pkce | nid | 2 | hydra_client
hydra_oauth2_flow_client_id_fk | hydra_oauth2_flow | client_id | 1 | hydra_client
hydra_oauth2_flow_client_id_fk | hydra_oauth2_flow | nid | 2 | hydra_client
hydra_oauth2_flow_login_session_id_fk | hydra_oauth2_flow | login_session_id | 1 | hydra_oauth2_authentication_session
fk_key_set_ref_hydra_jwk | hydra_oauth2_trusted_jwt_bearer_issuer | key_set | 1 | hydra_jwk
fk_key_set_ref_hydra_jwk | hydra_oauth2_trusted_jwt_bearer_issuer | key_id | 2 | hydra_jwk
fk_key_set_ref_hydra_jwk | hydra_oauth2_trusted_jwt_bearer_issuer | nid | 3 | hydra_jwk
Same way,
|
Nice! So I think we can drop this then |
Do we have any indication how fast this will be on different systems? Some of our customers have rather large DBs already. |
If you add the commit body to the PR description I can squash force merge (docker image scanner is failing) |
closes #2911