« discourse remap » a échoué

Je viens de déplacer un forum de name.com vers forum.name.com, mais l’opération a échoué :

Erreur : ERREUR : la valeur de clé dupliquée viole la contrainte d’unicité “unique_post_links”
DÉTAIL : La clé (topic_id, post_id, url)=(246, 813, http://forum.name.com) existe déjà.
La réaffectation n’a été appliquée que partiellement en raison de l’erreur ci-dessus. Veuillez relancer le script.

J’ai donc relancé le script (il a échoué à nouveau), puis exécuté rake posts:rebake et vérifié le forum. J’ai constaté la présence de certaines instances de forum.forum.name.com. (J’ai donc exécuté discourse remap forum.forum.name.com forum.name.com suivi de rake posts:rebake pour tenter de corriger le problème, avec un certain succès ; j’ai dû modifier manuellement certaines instances).

J’ai quelques questions :

  • discourse remap name.com forum.name.com s’applique-t-il uniquement au contenu des messages ? Sinon, dois-je simplement examiner les Paramètres du site pour détecter d’éventuels problèmes ?
  • Cette commande doit-elle être exécutée dans le cadre d’une transaction ? (Si oui, cela ne semble pas avoir été le cas lors de mon échec).

No, it applies to the entire database. Posts, site settings, themes, uploads, everything.

4 « J'aime »

Ah yeah looking at the full error again now it seems to have gone through these:

backup_metadata=1
categories=6
email_logs=306
email_tokens=1
groups=1
incoming_domains=3
incoming_emails=3
javascript_caches=4
post_custom_fields=275
post_revisions=134
posts=441
post_search_data=50
search_logs=8
site_settings=5
stylesheet_cache=540
theme_fields=9
theme_settings=3

I’ve checked all site settings and they’re fine (as are themes) and I guess all the above were done - can you see anything that should have been done that wasn’t? Do you think it is safe to continue as is or do you think it needs to be redone from scratch?

Also any ideas why duplicate key value violates unique constraint errors are becoming more frequent on Discourse? I’ve noticed a few topics on this and I think this is the third time I’ve had such an issue myself.

Not from the output, no. We only output tables with changes. No way to know if a table not in the list because it of the error, or simply because there were no instances of name.com in the (not listed) table.

Unfortunately that’s beyond my expertise.

Thanks Joshua.

Any ideas what the numbers signify? Number of changes?

What is the recommended way forward now? Fix the unique constraint error then reverse (go from forum.name.com back to name.com, then back again) or do something else?

Edit: done

I entered the app and Rails console then deleted the TopicLink in question then went from forum.name.com back to name.com, then back again.

backup_metadata=1
categories=6
email_logs=318
email_tokens=2
groups=1
incoming_domains=3
incoming_emails=3
javascript_caches=4
post_custom_fields=277
post_revisions=140
posts=444
post_search_data=51
search_logs=10
site_settings=5
stylesheet_cache=564
theme_fields=9
theme_settings=3
topic_links=281
topics=30
topic_search_data=8
translation_overrides=1
uploads=54
user_auth_token_logs=48
user_emails=2
user_histories=189
Done
1 « J'aime »