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

Error upgrading db while upgrading to 4.0.0-b1 (session update fails) #16798

Closed
tsteur opened this issue Nov 25, 2020 · 2 comments · Fixed by #16814
Closed

Error upgrading db while upgrading to 4.0.0-b1 (session update fails) #16798

tsteur opened this issue Nov 25, 2020 · 2 comments · Fixed by #16814
Assignees
Labels
Bug For errors / faults / flaws / inconsistencies etc.
Milestone

Comments

@tsteur
Copy link
Member

tsteur commented Nov 25, 2020

see https://forum.matomo.org/t/error-upgrading-db-while-upgrading-to-4-0-0-b1/39478

  • /opt/matomo/core/Updates/4.0.0-b1.php:
    Error trying to execute the migration 'ALTER TABLE matomo_session CHANGE id id VARCHAR(191);'.
    The error was: SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry 'AQBqYXZhLnV0aWwuVHJlZU1h8AEBAW9yZy5hcGFjaGUuY29tbW9ucy5iZWFud...' for key 'PRIMARY'
@tsteur tsteur added the Bug For errors / faults / flaws / inconsistencies etc. label Nov 25, 2020
@tsteur tsteur added this to the 4.0.1 milestone Nov 25, 2020
@tsteur
Copy link
Member Author

tsteur commented Nov 25, 2020

Maybe as a workaround we could delete all expired sessions from the table first? This should minimise the risk.

Overall the risk of this happening is quite low because session Ids are usually much shorter unless maybe customised with https://www.php.net/manual/en/session.configuration.php#ini.session.sid-length and the chance of two similar IDs for the first 190 char is quite low. It's actually so low there must have been some other issue there.

Actually better workaround be to update each SessionID... since we now hash the sessionID, we could iterate over each session and update the ID in the table maybe before running this update. The hash would be for sure less than 190 character and maybe it keeps their session alive as a bonus point?

@Findus23
Copy link
Member

Findus23 commented Nov 26, 2020

Deleting the sessions fixed the error as expected: https://forum.matomo.org/t/error-upgrading-db-while-upgrading-to-4-0-0-b1/39478/3

@sgiehl sgiehl self-assigned this Nov 26, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug For errors / faults / flaws / inconsistencies etc.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants