Page MenuHomePhabricator

Lost pages after deployed addtional namespaces on shn.wikibooks
Closed, ResolvedPublicBUG REPORT

Description

There are some pages (Wikijunior and Cookbook pages) that were created in the mainspace before the additional namespaces was deployed at shn.wikibooks (T327850). All those pages are lost after deployed additional namespaces. I have no idea how to deal with it. You can check it (here). Thanks.

Event Timeline

Looks like namespaceDupes.php wasn’t run.

425 pages to fix, 425 were resolvable.

Should hopefully be a straightforward fix, mwscript namespaceDupes.php shnwikibooks --fix. (It seems to get into an infinite loop in dry-run mode, but I think it should be okay to try non-dry-run mode and see if that works better.)

Mentioned in SAL (#wikimedia-operations) [2023-02-02T11:23:52Z] <Lucas_WMDE> lucaswerkmeister-wmde@mwmaint1002:~$ mwscript namespaceDupes.php shnwikibooks --fix | tee T328634-namespaceDupes.out # T328634 – failed quickly, details in task

Meh.

lucaswerkmeister-wmde@mwmaint1002:~$ mwscript namespaceDupes.php shnwikibooks --fix | tee T328634-namespaceDupes.out # T328634
id=3 ns=0 dbk=Cookbook:လမ်းၼႂ်း -> ပပ်ႉတူမ်ႈႁုင်:လမ်းၼႂ်း (no conflict)
id=4 ns=0 dbk=Cookbook:ၼိူဝ်ႉၵႆႇသႃႈ -> ပပ်ႉတူမ်ႈႁုင်:ၼိူဝ်ႉၵႆႇသႃႈ (no conflict)
id=5 ns=0 dbk=Cookbook:ၽၵ်းပၵ်ႉၵႅင် -> ပပ်ႉတူမ်ႈႁုင်:ၽၵ်းပၵ်ႉၵႅင် (no conflict)
id=6 ns=0 dbk=Cookbook:ၽၵ်းၶဵဝ် -> ပပ်ႉတူမ်ႈႁုင်:ၽၵ်းၶဵဝ် (no conflict)
id=398 ns=0 dbk=ပပ်ႉတူမ်ႈႁုင်:မၢၵ်ႇၶိူဝ်ဢုပ်ႉလေႃး_ၵလေႃး -> ပပ်ႉတူမ်ႈႁုင်:မၢၵ်ႇၶိူဝ်ဢုပ်ႉလေႃး_ၵလေႃး (no conflict)
id=399 ns=0 dbk=ပပ်ႉတူမ်ႈႁုင်:လမ်းၼႂ်း -> ပပ်ႉတူမ်ႈႁုင်:လမ်းၼႂ်း (no conflict)
Wikimedia\Rdbms\DBQueryError from line 1534 of /srv/mediawiki/php-1.40.0-wmf.21/includes/libs/rdbms/database/Database.php: Error 1062: Duplicate entry '102-\xE1\x80\x9C\xE1\x80\x99\xE1\x80\xBA\xE1\x80\xB8\xE1\x81\...' for key 'page_name_title'
Function: NamespaceDupes::movePage
Query: UPDATE  `page` SET page_namespace = 102,page_title = 'လမ်းၼႂ်း' WHERE page_id = '399'

#0 /srv/mediawiki/php-1.40.0-wmf.21/includes/libs/rdbms/database/Database.php(1518): Wikimedia\Rdbms\Database->getQueryException('Duplicate entry...', 1062, 'UPDATE  `page` ...', 'NamespaceDupes:...')
#1 /srv/mediawiki/php-1.40.0-wmf.21/includes/libs/rdbms/database/Database.php(1492): Wikimedia\Rdbms\Database->getQueryExceptionAndLog('Duplicate entry...', 1062, 'UPDATE  `page` ...', 'NamespaceDupes:...')
#2 /srv/mediawiki/php-1.40.0-wmf.21/includes/libs/rdbms/database/Database.php(865): Wikimedia\Rdbms\Database->reportQueryError('Duplicate entry...', 1062, 'UPDATE  `page` ...', 'NamespaceDupes:...', false)
#3 /srv/mediawiki/php-1.40.0-wmf.21/includes/libs/rdbms/database/Database.php(1763): Wikimedia\Rdbms\Database->query('UPDATE  `page` ...', 'NamespaceDupes:...', 128)
#4 /srv/mediawiki/php-1.40.0-wmf.21/includes/libs/rdbms/database/DBConnRef.php(119): Wikimedia\Rdbms\Database->update('page', Array, Array, 'NamespaceDupes:...')
#5 /srv/mediawiki/php-1.40.0-wmf.21/includes/libs/rdbms/database/DBConnRef.php(401): Wikimedia\Rdbms\DBConnRef->__call('update', Array)
#6 /srv/mediawiki/php-1.40.0-wmf.21/maintenance/namespaceDupes.php(631): Wikimedia\Rdbms\DBConnRef->update('page', Array, Array, 'NamespaceDupes:...')
#7 /srv/mediawiki/php-1.40.0-wmf.21/maintenance/namespaceDupes.php(335): NamespaceDupes->movePage('399', Object(Title))
#8 /srv/mediawiki/php-1.40.0-wmf.21/maintenance/namespaceDupes.php(197): NamespaceDupes->checkNamespace(102, '\xE1\x80\x95\xE1\x80\x95\xE1\x80\xBA\xE1\x82\x89\xE1\x80\x90...', Array)
#9 /srv/mediawiki/php-1.40.0-wmf.21/maintenance/namespaceDupes.php(116): NamespaceDupes->checkAll(Array)
#10 /srv/mediawiki/php-1.40.0-wmf.21/maintenance/includes/MaintenanceRunner.php(585): NamespaceDupes->execute()
#11 /srv/mediawiki/php-1.40.0-wmf.21/maintenance/doMaintenance.php(99): MediaWiki\Maintenance\MaintenanceRunner->run()
#12 /srv/mediawiki/php-1.40.0-wmf.21/maintenance/namespaceDupes.php(730): require_once('/srv/mediawiki/...')
#13 /srv/mediawiki/multiversion/MWScript.php(118): require_once('/srv/mediawiki/...')
#14 {main}

Not sure what to make of that error. I guess some page title exists both in the main namespace (with the new namespace in the page_title) and in the new namespace?

Yeah, okay, if I run another dry run (without --fix) this appears at the beginning:

id=399 ns=0 dbk=ပပ်ႉတူမ်ႈႁုင်:လမ်းၼႂ်း *** dest title exists and --add-prefix not specified

Let me look up what the usual prefix is…

There are also a handful more, actually.

id=399 ns=0 dbk=ပပ်ႉတူမ်ႈႁုင်:လမ်းၼႂ်း *** dest title exists and --add-prefix not specified
id=2727 ns=0 dbk=ပပ်ႉတူမ်ႈႁုင်:လၢႆးႁဵတ်း_ဢၼ်သႃႈ -> ပပ်ႉတူမ်ႈႁုင်:လၢႆးႁဵတ်း_ဢၼ်သႃႈ (no conflict) DRY RUN ONLY
id=2730 ns=0 dbk=ပပ်ႉတူမ်ႈႁုင်:လၢႆးႁဵတ်း_ဢၼ်ဢုပ်ႉ -> ပပ်ႉတူမ်ႈႁုင်:လၢႆးႁဵတ်း_ဢၼ်ဢုပ်ႉ (no conflict) DRY RUN ONLY
id=400 ns=0 dbk=ပပ်ႉတူမ်ႈႁုင်:ၵုင်ႈဢုပ်ႉ -> ပပ်ႉတူမ်ႈႁုင်:ၵုင်ႈဢုပ်ႉ (no conflict) DRY RUN ONLY
id=401 ns=0 dbk=ပပ်ႉတူမ်ႈႁုင်:ၶဝ်ႈႁုင်လႅဝ်_ၵွၼ်ႈၵဵၼ်း -> ပပ်ႉတူမ်ႈႁုင်:ၶဝ်ႈႁုင်လႅဝ်_ၵွၼ်ႈၵဵၼ်း (no conflict) DRY RUN ONLY
id=402 ns=0 dbk=ပပ်ႉတူမ်ႈႁုင်:ၼိူဝ်ႉမူဢုပ်ႉမေႃႈလိၼ် -> ပပ်ႉတူမ်ႈႁုင်:ၼိူဝ်ႉမူဢုပ်ႉမေႃႈလိၼ် (no conflict) DRY RUN ONLY
id=403 ns=0 dbk=ပပ်ႉတူမ်ႈႁုင်:ၼိူဝ်ႉၵႆႇသိၵ်ႇၶူဝ်ႈ -> ပပ်ႉတူမ်ႈႁုင်:ၼိူဝ်ႉၵႆႇသိၵ်ႇၶူဝ်ႈ (no conflict) DRY RUN ONLY
id=404 ns=0 dbk=ပပ်ႉတူမ်ႈႁုင်:ၼိူဝ်ႉၵႆႇသႃႈ *** dest title exists and --add-prefix not specified
id=405 ns=0 dbk=ပပ်ႉတူမ်ႈႁုင်:ၼိူဝ်ႉၵႆႇသႃႈ_သူမ်ႈသူမ်ႈၽဵတ်းၽဵတ်း -> ပပ်ႉတူမ်ႈႁုင်:ၼိူဝ်ႉၵႆႇသႃႈ_သူမ်ႈသူမ်ႈၽဵတ်းၽဵတ်း (no conflict) DRY RUN ONLY
id=406 ns=0 dbk=ပပ်ႉတူမ်ႈႁုင်:ၼိူဝ်ႉၵႆႉႁုင်မၢၵ်ႇၵဵင် -> ပပ်ႉတူမ်ႈႁုင်:ၼိူဝ်ႉၵႆႉႁုင်မၢၵ်ႇၵဵင် (no conflict) DRY RUN ONLY
id=407 ns=0 dbk=ပပ်ႉတူမ်ႈႁုင်:ၽၵ်းပၵ်ႉၵႅင် *** dest title exists and --add-prefix not specified
id=408 ns=0 dbk=ပပ်ႉတူမ်ႈႁုင်:ၽၵ်းၵမ်ႇၸွၼ်း_ၶူဝ်ႈလေႃး_ႁဵပ်း -> ပပ်ႉတူမ်ႈႁုင်:ၽၵ်းၵမ်ႇၸွၼ်း_ၶူဝ်ႈလေႃး_ႁဵပ်း (no conflict) DRY RUN ONLY
id=409 ns=0 dbk=ပပ်ႉတူမ်ႈႁုင်:ၽၵ်းၶဵဝ် *** dest title exists and --add-prefix not specified

Mentioned in SAL (#wikimedia-operations) [2023-02-02T11:28:10Z] <Lucas_WMDE> lucaswerkmeister-wmde@mwmaint1002:~$ mwscript namespaceDupes.php shnwikibooks --fix --add-prefix=T328634/ | tee T328634-namespaceDupes-2.out # T328634 – another error but made more progress

This one worked better but eventually got another error.

Wikimedia\Rdbms\DBQueryError from line 1534 of /srv/mediawiki/php-1.40.0-wmf.21/includes/libs/rdbms/database/Database.php: Error 1062: Duplicate entry '110-\xE1\x80\x9A\xE1\x80\xB0\xE1\x80\xB8\xE1\x80\x9B\xE1\x80\...' for key 'page_name_title'
Function: NamespaceDupes::movePage
Query: UPDATE  `page` SET page_namespace = 110,page_title = 'ယူးရူပ်ႉ' WHERE page_id = '582'

#0 /srv/mediawiki/php-1.40.0-wmf.21/includes/libs/rdbms/database/Database.php(1518): Wikimedia\Rdbms\Database->getQueryException('Duplicate entry...', 1062, 'UPDATE  `page` ...', 'NamespaceDupes:...')
#1 /srv/mediawiki/php-1.40.0-wmf.21/includes/libs/rdbms/database/Database.php(1492): Wikimedia\Rdbms\Database->getQueryExceptionAndLog('Duplicate entry...', 1062, 'UPDATE  `page` ...', 'NamespaceDupes:...')
#2 /srv/mediawiki/php-1.40.0-wmf.21/includes/libs/rdbms/database/Database.php(865): Wikimedia\Rdbms\Database->reportQueryError('Duplicate entry...', 1062, 'UPDATE  `page` ...', 'NamespaceDupes:...', false)
#3 /srv/mediawiki/php-1.40.0-wmf.21/includes/libs/rdbms/database/Database.php(1763): Wikimedia\Rdbms\Database->query('UPDATE  `page` ...', 'NamespaceDupes:...', 128)
#4 /srv/mediawiki/php-1.40.0-wmf.21/includes/libs/rdbms/database/DBConnRef.php(119): Wikimedia\Rdbms\Database->update('page', Array, Array, 'NamespaceDupes:...')
#5 /srv/mediawiki/php-1.40.0-wmf.21/includes/libs/rdbms/database/DBConnRef.php(401): Wikimedia\Rdbms\DBConnRef->__call('update', Array)
#6 /srv/mediawiki/php-1.40.0-wmf.21/maintenance/namespaceDupes.php(631): Wikimedia\Rdbms\DBConnRef->update('page', Array, Array, 'NamespaceDupes:...')
#7 /srv/mediawiki/php-1.40.0-wmf.21/maintenance/namespaceDupes.php(335): NamespaceDupes->movePage('582', Object(Title))
#8 /srv/mediawiki/php-1.40.0-wmf.21/maintenance/namespaceDupes.php(197): NamespaceDupes->checkNamespace(110, '\xE1\x80\x9D\xE1\x80\xAE\xE1\x82\x87\xE1\x81\xB6\xE1\x80\xAE...', Array)
#9 /srv/mediawiki/php-1.40.0-wmf.21/maintenance/namespaceDupes.php(116): NamespaceDupes->checkAll(Array)
#10 /srv/mediawiki/php-1.40.0-wmf.21/maintenance/includes/MaintenanceRunner.php(585): NamespaceDupes->execute()
#11 /srv/mediawiki/php-1.40.0-wmf.21/maintenance/doMaintenance.php(99): MediaWiki\Maintenance\MaintenanceRunner->run()
#12 /srv/mediawiki/php-1.40.0-wmf.21/maintenance/namespaceDupes.php(730): require_once('/srv/mediawiki/...')
#13 /srv/mediawiki/multiversion/MWScript.php(118): require_once('/srv/mediawiki/...')
#14 {main}

Some of the conflicting pages are here now, by the way (and possibly in other namespaces too, not sure): Special:PrefixIndex/T328634/ – you’ll need to check if those should be moved/renamed or deleted, I believe.

If I do another dry run, it only reports 20 pages to fix:

id=582 ns=0 dbk=ဝီႇၶီႇလုၵ်ႈဢွၼ်ႇ:ယူးရူပ်ႉ *** dest title exists and --add-prefix not specified
id=583 ns=0 dbk=ဝီႇၶီႇလုၵ်ႈဢွၼ်ႇ:ယူးရူပ်ႉ/ပထဝီႇ_ယူးရူပ်ႉ *** dest title exists and --add-prefix not specified
id=584 ns=0 dbk=ဝီႇၶီႇလုၵ်ႈဢွၼ်ႇ:ယူးရူပ်ႉ/ယူးရူပ်ႉ *** dest title exists and --add-prefix not specified
id=585 ns=0 dbk=ဝီႇၶီႇလုၵ်ႈဢွၼ်ႇ:ယူးရူပ်ႉ/ဢီးယူႇ *** dest title exists and --add-prefix not specified
id=586 ns=0 dbk=ဝီႇၶီႇလုၵ်ႈဢွၼ်ႇ:ယူးရူပ်ႉ/ဢေႃႉသထရီးယႃး -> ဝီႇၶီႇလုၵ်ႈဢွၼ်ႇ:ယူးရူပ်ႉ/ဢေႃႉသထရီးယႃး (no conflict) DRY RUN ONLY
id=587 ns=0 dbk=ဝီႇၶီႇလုၵ်ႈဢွၼ်ႇ:ယူးရူပ်ႉ/ဢႃႇပႃးၼီးယႃး -> ဝီႇၶီႇလုၵ်ႈဢွၼ်ႇ:ယူးရူပ်ႉ/ဢႃႇပႃးၼီးယႃး (no conflict) DRY RUN ONLY
id=588 ns=0 dbk=ဝီႇၶီႇလုၵ်ႈဢွၼ်ႇ:ယူးရူပ်ႉ/ဢႃႇမေးၼီးယႃး -> ဝီႇၶီႇလုၵ်ႈဢွၼ်ႇ:ယူးရူပ်ႉ/ဢႃႇမေးၼီးယႃး (no conflict) DRY RUN ONLY
id=589 ns=0 dbk=ဝီႇၶီႇလုၵ်ႈဢွၼ်ႇ:ယူးရူပ်ႉ/ဢႅၼ်ႇတူဝ်ႇရႃႇ -> ဝီႇၶီႇလုၵ်ႈဢွၼ်ႇ:ယူးရူပ်ႉ/ဢႅၼ်ႇတူဝ်ႇရႃႇ (no conflict) DRY RUN ONLY
id=590 ns=0 dbk=ဝီႇၶီႇလုၵ်ႈဢွၼ်ႇ:ယူးရူပ်ႉ/ၵူၼ်း_ယူးရူပ်ႉ *** dest title exists and --add-prefix not specified
id=591 ns=0 dbk=ဝီႇၶီႇလုၵ်ႈဢွၼ်ႇ:ယူးရူပ်ႉ/ၶေႃႈမုၼ်း *** dest title exists and --add-prefix not specified
id=592 ns=0 dbk=ဝီႇၶီႇလုၵ်ႈဢွၼ်ႇ:ယူးရူပ်ႉ/ၸၢမ်းၺၢၼ်ႇ -> ဝီႇၶီႇလုၵ်ႈဢွၼ်ႇ:ယူးရူပ်ႉ/ၸၢမ်းၺၢၼ်ႇ (no conflict) DRY RUN ONLY
id=593 ns=0 dbk=ဝီႇၶီႇလုၵ်ႈဢွၼ်ႇ:ယူးရူပ်ႉ/ၽႃႇသႃႇၵႂၢမ်း_ယူးရူပ်ႉ *** dest title exists and --add-prefix not specified
id=594 ns=0 dbk=ဝီႇၶီႇလုၵ်ႈဢွၼ်ႇ:သိုပ်ႇမိုတ်ႈ_ပၢႆးၼပ်ႉ *** dest title exists and --add-prefix not specified
id=595 ns=0 dbk=ဝီႇၶီႇလုၵ်ႈဢွၼ်ႇ:ၶိူင်ႈႁဵတ်းႁိုဝ်_ႁဵတ်းၵၢၼ် -> ဝီႇၶီႇလုၵ်ႈဢွၼ်ႇ:ၶိူင်ႈႁဵတ်းႁိုဝ်_ႁဵတ်းၵၢၼ် (no conflict) DRY RUN ONLY
id=596 ns=0 dbk=ဝီႇၶီႇလုၵ်ႈဢွၼ်ႇ:ၸိုင်ႈမိူင်း_ၵ_တေႃႇ_ဢ *** dest title exists and --add-prefix not specified
id=2708 ns=0 dbk=Subject:Computing -> ပၢႆး:Computing (no conflict) DRY RUN ONLY
id=2344 ns=0 dbk=Subject:ပၢႆးမၼုတ်ႉသ -> ပၢႆး:ပၢႆးမၼုတ်ႉသ (no conflict) DRY RUN ONLY
id=2341 ns=0 dbk=Subject:ၽႃႇသႃႇပုတ်ႉထ -> ပၢႆး:ၽႃႇသႃႇပုတ်ႉထ (no conflict) DRY RUN ONLY
id=2343 ns=0 dbk=Subject:ၽႃႇသႃႇၵိူဝ်းယမ် -> ပၢႆး:ၽႃႇသႃႇၵိူဝ်းယမ် (no conflict) DRY RUN ONLY
id=2342 ns=0 dbk=Subject:ၽႃႇသႃႇၵိူဝ်းယမ်_ဢိၼ်းတီးယၼ်း -> ပၢႆး:ၽႃႇသႃႇၵိူဝ်းယမ်_ဢိၼ်းတီးယၼ်း (no conflict) DRY RUN ONLY
20 pages to fix, 11 were resolvable.

And then there’s the output that seems to indicate an infinite loop:

pagelinks from=1157 ns=0 dbk=Cookbook:Appetizers -> ပပ်ႉတူမ်ႈႁုင်:Appetizers DRY RUN
pagelinks from=1462 ns=0 dbk=Cookbook:Appetizers -> ပပ်ႉတူမ်ႈႁုင်:Appetizers DRY RUN
pagelinks from=1157 ns=0 dbk=Cookbook:Beverages -> ပပ်ႉတူမ်ႈႁုင်:Beverages DRY RUN
pagelinks from=1462 ns=0 dbk=Cookbook:Beverages -> ပပ်ႉတူမ်ႈႁုင်:Beverages DRY RUN
pagelinks from=1157 ns=0 dbk=Cookbook:Bread_Recipes -> ပပ်ႉတူမ်ႈႁုင်:Bread_Recipes DRY RUN
pagelinks from=1462 ns=0 dbk=Cookbook:Bread_Recipes -> ပပ်ႉတူမ်ႈႁုင်:Bread_Recipes DRY RUN
pagelinks from=1157 ns=0 dbk=Cookbook:Breakfast_Recipes -> ပပ်ႉတူမ်ႈႁုင်:Breakfast_Recipes DRY RUN
pagelinks from=1462 ns=0 dbk=Cookbook:Breakfast_Recipes -> ပပ်ႉတူမ်ႈႁုင်:Breakfast_Recipes DRY RUN
pagelinks from=1276 ns=0 dbk=Cookbook:Chewy_Ginger_Cookies -> ပပ်ႉတူမ်ႈႁုင်:Chewy_Ginger_Cookies DRY RUN
pagelinks from=1157 ns=0 dbk=Cookbook:Confections -> ပပ်ႉတူမ်ႈႁုင်:Confections DRY RUN
pagelinks from=1462 ns=0 dbk=Cookbook:Confections -> ပပ်ႉတူမ်ႈႁုင်:Confections DRY RUN
pagelinks from=1157 ns=0 dbk=Cookbook:Dessert -> ပပ်ႉတူမ်ႈႁုင်:Dessert DRY RUN
pagelinks from=1462 ns=0 dbk=Cookbook:Dessert -> ပပ်ႉတူမ်ႈႁုင်:Dessert DRY RUN
pagelinks from=1157 ns=0 dbk=Cookbook:Meat_Recipes -> ပပ်ႉတူမ်ႈႁုင်:Meat_Recipes DRY RUN
pagelinks from=1462 ns=0 dbk=Cookbook:Meat_Recipes -> ပပ်ႉတူမ်ႈႁုင်:Meat_Recipes DRY RUN
pagelinks from=1157 ns=0 dbk=Cookbook:Pasta_Recipes -> ပပ်ႉတူမ်ႈႁုင်:Pasta_Recipes DRY RUN
pagelinks from=1462 ns=0 dbk=Cookbook:Pasta_Recipes -> ပပ်ႉတူမ်ႈႁုင်:Pasta_Recipes DRY RUN
pagelinks from=582 ns=0 dbk=Cookbook:Pizza -> ပပ်ႉတူမ်ႈႁုင်:Pizza DRY RUN
pagelinks from=1157 ns=0 dbk=Cookbook:Rice_Recipes -> ပပ်ႉတူမ်ႈႁုင်:Rice_Recipes DRY RUN
pagelinks from=1462 ns=0 dbk=Cookbook:Rice_Recipes -> ပပ်ႉတူမ်ႈႁုင်:Rice_Recipes DRY RUN
pagelinks from=1157 ns=0 dbk=Cookbook:Salad_Recipes -> ပပ်ႉတူမ်ႈႁုင်:Salad_Recipes DRY RUN
pagelinks from=1462 ns=0 dbk=Cookbook:Salad_Recipes -> ပပ်ႉတူမ်ႈႁုင်:Salad_Recipes DRY RUN
pagelinks from=894 ns=0 dbk=Cookbook:Tea -> ပပ်ႉတူမ်ႈႁုင်:Tea DRY RUN
pagelinks from=407 ns=0 dbk=Cookbook:ထူဝ်ႇယၢဝ်း -> ပပ်ႉတူမ်ႈႁုင်:ထူဝ်ႇယၢဝ်း DRY RUN
pagelinks from=407 ns=0 dbk=Cookbook:ထူဝ်ႇၼဝ်ႈ -> ပပ်ႉတူမ်ႈႁုင်:ထူဝ်ႇၼဝ်ႈ DRY RUN
pagelinks from=407 ns=0 dbk=Cookbook:မၢၵ်ႇပၵ်ႉ -> ပပ်ႉတူမ်ႈႁုင်:မၢၵ်ႇပၵ်ႉ DRY RUN
pagelinks from=407 ns=0 dbk=Cookbook:မၢၵ်ႇၶိူဝ်ဝၢၼ် -> ပပ်ႉတူမ်ႈႁုင်:မၢၵ်ႇၶိူဝ်ဝၢၼ် DRY RUN
pagelinks from=407 ns=0 dbk=Cookbook:မၢၵ်ႇၶိူဝ်သူမ်ႈ -> ပပ်ႉတူမ်ႈႁုင်:မၢၵ်ႇၶိူဝ်သူမ်ႈ DRY RUN
pagelinks from=401 ns=0 dbk=Cookbook:လၢႆးႁဵတ်း_ဢၼ်ႁုင် -> ပပ်ႉတူမ်ႈႁုင်:လၢႆးႁဵတ်း_ဢၼ်ႁုင် DRY RUN
pagelinks from=407 ns=0 dbk=Cookbook:ဢိမ်ၶိမ်း -> ပပ်ႉတူမ်ႈႁုင်:ဢိမ်ၶိမ်း DRY RUN
pagelinks from=407 ns=0 dbk=Cookbook:ၵိူဝ် -> ပပ်ႉတူမ်ႈႁုင်:ၵိူဝ် DRY RUN
pagelinks from=407 ns=0 dbk=Cookbook:ၼမ်ႉမၼ်း -> ပပ်ႉတူမ်ႈႁုင်:ၼမ်ႉမၼ်း DRY RUN
pagelinks from=407 ns=0 dbk=Cookbook:ၽွင်ဝၢၼ် -> ပပ်ႉတူမ်ႈႁုင်:ၽွင်ဝၢၼ် DRY RUN
pagelinks from=407 ns=0 dbk=Cookbook:ၽၵ်းပၵ်ႉ -> ပပ်ႉတူမ်ႈႁုင်:ၽၵ်းပၵ်ႉ DRY RUN
pagelinks from=409 ns=0 dbk=Cookbook:ၽၵ်းၶဵဝ် -> ပပ်ႉတူမ်ႈႁုင်:ၽၵ်းၶဵဝ် DRY RUN
pagelinks from=1157 ns=0 dbk=Cookbook:Appetizers -> ပပ်ႉတူမ်ႈႁုင်:Appetizers DRY RUN
pagelinks from=1462 ns=0 dbk=Cookbook:Appetizers -> ပပ်ႉတူမ်ႈႁုင်:Appetizers DRY RUN
pagelinks from=1157 ns=0 dbk=Cookbook:Beverages -> ပပ်ႉတူမ်ႈႁုင်:Beverages DRY RUN
pagelinks from=1462 ns=0 dbk=Cookbook:Beverages -> ပပ်ႉတူမ်ႈႁုင်:Beverages DRY RUN
…

I’ll try running the script again to see if that fixes the 20 pages at least.

Mentioned in SAL (#wikimedia-operations) [2023-02-02T11:32:25Z] <Lucas_WMDE> lucaswerkmeister-wmde@mwmaint1002:~$ mwscript namespaceDupes.php shnwikibooks --fix --add-prefix=T328634/ | tee T328634-namespaceDupes-3.out # T328634 – seemed to finish the first 20 pages and then go into an infinite loop, I Ctrl+Ced it

Looks like the pages are now fixed, but the pagelinks might not be?

0 pages to fix, 0 were resolvable.

pagelinks from=67 ns=0 dbk=Wikijunior:တူဝ်မႄႈလိၵ်ႈ_ပၢႆးသၢႆႊ/O -> ဝီႇၶီႇလုၵ်ႈဢွၼ်ႇ:တူဝ်မႄႈလိၵ်ႈ_ပၢႆးသၢႆႊ/O DRY RUN
pagelinks from=68 ns=0 dbk=Wikijunior:တူဝ်မႄႈလိၵ်ႈ_ပၢႆးသၢႆႊ/O -> ဝီႇၶီႇလုၵ်ႈဢွၼ်ႇ:တူဝ်မႄႈလိၵ်ႈ_ပၢႆးသၢႆႊ/O DRY RUN
pagelinks from=69 ns=0 dbk=Wikijunior:တူဝ်မႄႈလိၵ်ႈ_ပၢႆးသၢႆႊ/O -> ဝီႇၶီႇလုၵ်ႈဢွၼ်ႇ:တူဝ်မႄႈလိၵ်ႈ_ပၢႆးသၢႆႊ/O DRY RUN
pagelinks from=70 ns=0 dbk=Wikijunior:တူဝ်မႄႈလိၵ်ႈ_ပၢႆးသၢႆႊ/O -> ဝီႇၶီႇလုၵ်ႈဢွၼ်ႇ:တူဝ်မႄႈလိၵ်ႈ_ပၢႆးသၢႆႊ/O DRY RUN
pagelinks from=71 ns=0 dbk=Wikijunior:တူဝ်မႄႈလိၵ်ႈ_ပၢႆးသၢႆႊ/O -> ဝီႇၶီႇလုၵ်ႈဢွၼ်ႇ:တူဝ်မႄႈလိၵ်ႈ_ပၢႆးသၢႆႊ/O DRY RUN
pagelinks from=72 ns=0 dbk=Wikijunior:တူဝ်မႄႈလိၵ်ႈ_ပၢႆးသၢႆႊ/O -> ဝီႇၶီႇလုၵ်ႈဢွၼ်ႇ:တူဝ်မႄႈလိၵ်ႈ_ပၢႆးသၢႆႊ/O DRY RUN
pagelinks from=73 ns=0 dbk=Wikijunior:တူဝ်မႄႈလိၵ်ႈ_ပၢႆးသၢႆႊ/O -> ဝီႇၶီႇလုၵ်ႈဢွၼ်ႇ:တူဝ်မႄႈလိၵ်ႈ_ပၢႆးသၢႆႊ/O DRY RUN
pagelinks from=74 ns=0 dbk=Wikijunior:တူဝ်မႄႈလိၵ်ႈ_ပၢႆးသၢႆႊ/O -> ဝီႇၶီႇလုၵ်ႈဢွၼ်ႇ:တူဝ်မႄႈလိၵ်ႈ_ပၢႆးသၢႆႊ/O DRY RUN
pagelinks from=75 ns=0 dbk=Wikijunior:တူဝ်မႄႈလိၵ်ႈ_ပၢႆးသၢႆႊ/O -> ဝီႇၶီႇလုၵ်ႈဢွၼ်ႇ:တူဝ်မႄႈလိၵ်ႈ_ပၢႆးသၢႆႊ/O DRY RUN
pagelinks from=76 ns=0 dbk=Wikijunior:တူဝ်မႄႈလိၵ်ႈ_ပၢႆးသၢႆႊ/O -> ဝီႇၶီႇလုၵ်ႈဢွၼ်ႇ:တူဝ်မႄႈလိၵ်ႈ_ပၢႆးသၢႆႊ/O DRY RUN
pagelinks from=77 ns=0 dbk=Wikijunior:တူဝ်မႄႈလိၵ်ႈ_ပၢႆးသၢႆႊ/O -> ဝီႇၶီႇလုၵ်ႈဢွၼ်ႇ:တူဝ်မႄႈလိၵ်ႈ_ပၢႆးသၢႆႊ/O DRY RUN
pagelinks from=78 ns=0 dbk=Wikijunior:တူဝ်မႄႈလိၵ်ႈ_ပၢႆးသၢႆႊ/O -> ဝီႇၶီႇလုၵ်ႈဢွၼ်ႇ:တူဝ်မႄႈလိၵ်ႈ_ပၢႆးသၢႆႊ/O DRY RUN

I’ll do a longer dry run and see if this is actually an infinite loop or if it eventually finishes.

Definitely looks like an infinite loop, mwscript namespaceDupes.php shnwikibooks | awk '!a[$0]++' | ts (only show unique lines, then timestamp them) indicates that there are no new lines after the initial burst of output, just the same ones over and over again.

Mentioned in SAL (#wikimedia-operations) [2023-02-02T11:37:19Z] <Lucas_WMDE> lucaswerkmeister-wmde@mwmaint1002:~$ mwscript namespaceDupes.php shnwikibooks --fix | tee T328634-namespaceDupes-4.out # T328634 – made some progress then errored out again

That command fixed a good number of pagelinks (I think) but eventually errored with:

Wikimedia\Rdbms\DBQueryError from line 1534 of /srv/mediawiki/php-1.40.0-wmf.21/includes/libs/rdbms/database/Database.php: Error 1064: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '1=0 WHERE tl_from = '596' AND tl_target_id = 64' at line 1
Function: NamespaceDupes::checkLinkTable
Query: UPDATE IGNORE `templatelinks` SET 1=0 WHERE tl_from = '596' AND tl_target_id = 64

#0 /srv/mediawiki/php-1.40.0-wmf.21/includes/libs/rdbms/database/Database.php(1518): Wikimedia\Rdbms\Database->getQueryException('You have an err...', 1064, 'UPDATE IGNORE `...', 'NamespaceDupes:...')
#1 /srv/mediawiki/php-1.40.0-wmf.21/includes/libs/rdbms/database/Database.php(1492): Wikimedia\Rdbms\Database->getQueryExceptionAndLog('You have an err...', 1064, 'UPDATE IGNORE `...', 'NamespaceDupes:...')
#2 /srv/mediawiki/php-1.40.0-wmf.21/includes/libs/rdbms/database/Database.php(865): Wikimedia\Rdbms\Database->reportQueryError('You have an err...', 1064, 'UPDATE IGNORE `...', 'NamespaceDupes:...', false)
#3 /srv/mediawiki/php-1.40.0-wmf.21/includes/libs/rdbms/database/Database.php(1763): Wikimedia\Rdbms\Database->query('UPDATE IGNORE `...', 'NamespaceDupes:...', 128)
#4 /srv/mediawiki/php-1.40.0-wmf.21/includes/libs/rdbms/database/DBConnRef.php(119): Wikimedia\Rdbms\Database->update('templatelinks', Array, Array, 'NamespaceDupes:...', Array)
#5 /srv/mediawiki/php-1.40.0-wmf.21/includes/libs/rdbms/database/DBConnRef.php(401): Wikimedia\Rdbms\DBConnRef->__call('update', Array)
#6 /srv/mediawiki/php-1.40.0-wmf.21/maintenance/namespaceDupes.php(466): Wikimedia\Rdbms\DBConnRef->update('templatelinks', Array, Array, 'NamespaceDupes:...', Array)
#7 /srv/mediawiki/php-1.40.0-wmf.21/maintenance/namespaceDupes.php(225): NamespaceDupes->checkLinkTable('templatelinks', 'tl', 110, '\xE1\x80\x9D\xE1\x80\xAE\xE1\x82\x87\xE1\x81\xB6\xE1\x80\xAE...', Array)
#8 /srv/mediawiki/php-1.40.0-wmf.21/maintenance/namespaceDupes.php(116): NamespaceDupes->checkAll(Array)
#9 /srv/mediawiki/php-1.40.0-wmf.21/maintenance/includes/MaintenanceRunner.php(585): NamespaceDupes->execute()
#10 /srv/mediawiki/php-1.40.0-wmf.21/maintenance/doMaintenance.php(99): MediaWiki\Maintenance\MaintenanceRunner->run()
#11 /srv/mediawiki/php-1.40.0-wmf.21/maintenance/namespaceDupes.php(730): require_once('/srv/mediawiki/...')
#12 /srv/mediawiki/multiversion/MWScript.php(118): require_once('/srv/mediawiki/...')
#13 {main}

No clue what on earth SET 1=0 is supposed to do…

Okay, I think it actually finished fixing pagelinks, but fixing templatelinks isn’t working? @Ladsgroup perhaps related to the linktarget migration?

(I’m done with this task for the moment, if anyone else wants to take it over feel free to.)

No clue what on earth SET 1=0 is supposed to do…

Seems to come from NamespaceDupes::checkLinkTable() calling $setValue = $linksMigration->getLinksConditions( $table, $destTitle );, where LinksMigration has:

			$targetId = $this->linkTargetLookup->getLinkTargetId( $linkTarget );
			// Not found, it shouldn't pick anything
			if ( !$targetId ) {
				return [ '1=0' ];
			}

It probably shouldn’t be using conditions for the SET part in the first place?

sigh, I was afraid it might break. Is it because it had set condition in where and other way around? This has happened before...

It’s using $linksMigration->getLinksConditions() for $setValue, $whereCondition and $deleteCondition. I guess it needs to call LinkTargetLookup::acquireLinkTargetId(), depending on the schema migration stage, similar to GenericPageLinksTable::insertLink()? But it currently only has access to a LinksMigration instance, which doesn’t have an “acquire”-type method afaict.

How about something like this?

diff --git a/maintenance/namespaceDupes.php b/maintenance/namespaceDupes.php
index ad8b60ba00..b3d000e547 100644
--- a/maintenance/namespaceDupes.php
+++ b/maintenance/namespaceDupes.php
@@ -433,6 +433,9 @@ private function checkLinkTable( $table, $fieldPrefix, $ns, $name, $options,
 				}
 
 				if ( isset( $linksMigration::$mapping[$table] ) ) {
+					if ( $this->getConfig()->get( $linksMigration::$mapping[$table]['config'] ) & SCHEMA_COMPAT_READ_NEW ) {
+						MediaWikiServices::getInstance()->getLinkTargetLookup()->acquireLinkTargetId( $destTitle, $dbw );
+					}
 					$setValue = $linksMigration->getLinksConditions( $table, $destTitle );
 					$whereCondition = $linksMigration->getLinksConditions(
 						$table,

If LinksMigration::getLinksConditions() is about to try using the target_id column, first acquire the link target ID; then getLinksConditions() should return a correct mapping from target_id to the just-acquired ID value. It’s not great, but I think it should work, and I’m having trouble finding anything better without totally rearranging how the code is split between GenericPageLinksTable and LinksMigration.

(It’s pretty ugly to use READ_NEW rather than WRITE_NEW as the schema compat constant, but that’s the one getLinksConditions() uses, and I don’t think it would be very helpful to acquire a link target ID that’s not going to be used in the write-but-not-yet-read case…)

Alright, I’ll see if I can test it on mwdebug later and upload it to Gerrit if it works.

Mentioned in SAL (#wikimedia-operations) [2023-02-09T14:09:03Z] <Lucas_WMDE> lucaswerkmeister-wmde@mwdebug1001:~$ mwscript namespaceDupes.php shnwikibooks --fix | tee T328634-1-unpatched.out # T328634 – finished successfully, to my surprise

lucaswerkmeister-wmde@mwdebug1001:~$ mwscript namespaceDupes.php shnwikibooks --fix | tee T328634-1-unpatched.out
0 pages to fix, 0 were resolvable.

pagelinks from=1648 ns=0 dbk=Subject:Books_by_subject -> ပၢႆး:Books_by_subject
pagelinks from=2346 ns=0 dbk=Subject:Books_by_subject -> ပၢႆး:Books_by_subject
pagelinks from=1648 ns=0 dbk=Subject:Science -> ပၢႆး:Science
pagelinks from=1580 ns=0 dbk=ပၢႆး:ပပ်ႉ_ပၢႆးလႂ်ပၢႆးၼၼ်ႉ -> ပၢႆး:ပပ်ႉ_ပၢႆးလႂ်ပၢႆးၼၼ်ႉ
pagelinks from=2393 ns=0 dbk=ပၢႆး:ပပ်ႉ_ပၢႆးလႂ်ပၢႆးၼၼ်ႉ -> ပၢႆး:ပပ်ႉ_ပၢႆးလႂ်ပၢႆးၼၼ်ႉ
5 links to fix, 5 were resolvable, 0 were deleted.

Looks good!

This is before I started patching anything… did the templatelinks already get fixed in the meantime?

Lucas_Werkmeister_WMDE claimed this task.

Well, it looks like there’s nothing left to do:

lucaswerkmeister-wmde@mwdebug1001:~$ mwscript namespaceDupes.php shnwikibooks

*******************************************************************************
NOTE: Do not run maintenance scripts directly, use maintenance/run.php instead!
      Running scripts directly has been deprecated in MediaWiki 1.40.
      It may not work for some (or any) scripts in the future.
*******************************************************************************

0 pages to fix, 0 were resolvable.

0 links to fix, 0 were resolvable, 0 were deleted.

Looks good!

My best guess is that all the affected pages got edited or purged-with-linksupdate, organically fixing the links so that nothing was left to be updated. It’s possible that namespaceDupes.php still doesn’t properly support the linktarget migration, but it’s hard to know at the moment. (If anyone else encounters similar errors with it: consider trying T328634#8593132 on mwdebug.)