Merge development into production - #483
Merged
Merged
Conversation
Add a unique index on event_transcriptions (classification_id, event_id, team_id, user_id) and record rows with createOrFirst(), so concurrent listeners or retried jobs cannot double count a transcription and a duplicate no longer fails the job. Production has no duplicate rows, so the index can be added by a regular migration.
Add the pusher-transcription-duplicates update operation and run it on deploy. For each classification_id it keeps the earliest document and deletes the rest, then rebuilds the classification_id index as unique so PusherTranscriptionJob's existing E11000 handling stops further copies from duplicate listeners or retried jobs. The cleanup repeats if new duplicates arrive before the index is built, and a re-run is a no-op. Closes #481
Remove duplicate transcriptions and enforce unique classification ids
This branch was successfully deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Included
app:update-queries pusher-transcription-duplicateskeeps the earliestpusher_transcriptionsdocument perclassification_id, deletes the 401,231 extra documents, and rebuildsclassification_id_1as unique.event_transcriptions(classification_id,event_id,team_id,user_id);EventTranscriptionServiceusescreateOrFirst().Deployment
Before merging, stop the Panoptes listener on production:
The deploy then runs the migration followed by the cleanup (
update_queries_operation=pusher-transcription-duplicates); expect a few minutes on the shared MongoDB server.After the deploy, start it again and confirm only one listener runs:
Classifications missed while it was stopped are backfilled by the reconcile chain (
ZooniversePusherJob). No events are running.Follow-up: set
update_queries_operationback to''.Validation
pusher_transcriptionswith production's indexes:classification_id(76,843 duplicated ids, 401,231 extra documents removed)classification_id_1is UNIQUE; the 711-copy classification703618983kept its earliest copyevent_transcriptionsmigration ran and its unique index exists