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

Add unique index for page groups #348 #350

Merged
merged 1 commit into from
Aug 23, 2024

Conversation

bwalkerl
Copy link
Contributor

Closes #348

We have a minor loss in data with concurrent updates that can cause duplicate rows, so this adds a unique index on name and month and catches unique key errors.

This same problem does occur with updates when fuzzycount is low, but realistically this isn't a big concern as these are estimates, and the ones with the low fuzzycount will get updated quickly.

We don't want any sort of transactions or locking to ensure we do no harm - so best to ignore those cases.

For upgrade script logic:

  • I've kept the page group with the higher fuzzycount. In most cases this is lopsided, but even when they are close the highest is still a reasonable estimate.
  • I also had to change the precision of name to 255 to be able to add this as a unique index. We shouldn't have real page groups with names this long, but bad urls can exist so I've deleted those.

@brendanheywood brendanheywood merged commit 109a680 into MOODLE_35_STABLE Aug 23, 2024
42 checks passed
@brendanheywood brendanheywood deleted the page-group-unique branch August 23, 2024 06:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Debugging: Error: mdb->get_record() found more than one record!
2 participants