Skip to content

Prevent duplicate WHOIS server records for the same name - #2966

Open
maricavor wants to merge 1 commit into
masterfrom
fix/whois-record-name-uniqueness
Open

maricavor wants to merge 1 commit into
masterfrom
fix/whois-record-name-uniqueness

Conversation

@maricavor

Copy link
Copy Markdown
Contributor

whois_records.name in the WHOIS database had only a regular index, and all write paths did find-then-insert, so concurrent updates could insert two rows for one name. Later updates and deletes touched only one of them, leaving stale data in WHOIS.

  • Make the name index unique in whois_schema.rb
  • Add Whois::Record.find_or_create_by_name! and .save_by_name, which fall back to the existing row when a concurrent insert wins, and use them in all write paths
  • Add whois:remove_orphans rake task to list (and with DRY_RUN=false delete) WHOIS server records that have no source in Registry

The unique index has to be applied to existing WHOIS databases manually after removing duplicate rows, there are no migrations for that database.

whois_records.name in the WHOIS database had only a regular index, and all
write paths did find-then-insert, so concurrent updates could insert two rows
for one name. Later updates and deletes touched only one of them, leaving
stale data in WHOIS.

- Make the name index unique in whois_schema.rb
- Add Whois::Record.find_or_create_by_name! and .save_by_name, which fall
  back to the existing row when a concurrent insert wins, and use them in
  all write paths
- Add whois:remove_orphans rake task to list (and with DRY_RUN=false delete)
  WHOIS server records that have no source in Registry

The unique index has to be applied to existing WHOIS databases manually
after removing duplicate rows, there are no migrations for that database.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

This branch has not been deployed

No deployments
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.

3 participants