Error: 1062 Duplicate entry 'testuser' for key 'actor name'

1 문제상황[ | ]

root@localhost:/var/www/html# php maintenance/update.php 
MediaWiki 1.33.0 Updater

Your composer.lock file is up to date with current dependencies!
Going to run database updates for my_wiki
Depending on the size of your database this may take a while!
Abort with control-c in the next five seconds (skip this countdown with --quick) ...
... (생략)
... 1718 - 1818
... 1819 - 1919
... 1920 - 1942
Completed actor creation, added 0 new actor(s)
Beginning migration of revision.rev_user and revision.rev_user_text to revision_actor_temp.revactor_actor
Completed migration, updated 0 row(s) with 0 new actor(s), 0 error(s)
Beginning migration of archive.ar_user and archive.ar_user_text to archive.ar_actor
[e984a6bdf28faebbc720a3f6] [no req]   Wikimedia\Rdbms\DBQueryError from line 1587 of /var/www/html/includes/libs/rdbms/database/Database.php: A database query error has occurred. Did you forget to run your application's database schema updater after upgrading?
Query: INSERT  INTO `actor` (actor_name) VALUES ('113.57.92.46'),('93.57.91.35'),('testuser'),('224.68.103.57')
Function: MigrateActors::addActorsForRows
Error: 1062 Duplicate entry 'testuser' for key 'actor_name' (testdb)

Backtrace:
#0 /var/www/html/includes/libs/rdbms/database/Database.php(1556): Wikimedia\Rdbms\Database->getQueryExceptionAndLog(string, integer, string, string)
#1 /var/www/html/includes/libs/rdbms/database/Database.php(1274): Wikimedia\Rdbms\Database->reportQueryError(string, integer, string, string, boolean)
#2 /var/www/html/includes/libs/rdbms/database/Database.php(2149): Wikimedia\Rdbms\Database->query(string, string)
#3 /var/www/html/maintenance/includes/MigrateActors.php(226): Wikimedia\Rdbms\Database->insert(string, array, string)
#4 /var/www/html/maintenance/includes/MigrateActors.php(306): MigrateActors->addActorsForRows(Wikimedia\Rdbms\DatabaseMysqli, string, array, array, integer)
#5 /var/www/html/maintenance/includes/MigrateActors.php(114): MigrateActors->migrate(string, array, string, string, string)
#6 /var/www/html/maintenance/Maintenance.php(1719): MigrateActors->doDBUpdates()
#7 /var/www/html/includes/installer/DatabaseUpdater.php(1318): LoggedUpdateMaintenance->execute()
#8 /var/www/html/includes/installer/DatabaseUpdater.php(489): DatabaseUpdater->migrateActors()
#9 /var/www/html/includes/installer/DatabaseUpdater.php(453): DatabaseUpdater->runUpdates(array, boolean)
#10 /var/www/html/maintenance/update.php(203): DatabaseUpdater->doUpdates(array)
#11 /var/www/html/maintenance/doMaintenance.php(96): UpdateMediaWiki->execute()
#12 /var/www/html/maintenance/update.php(266): require_once(string)
#13 {main}

2 확인[ | ]

  • user 테이블에서 삭제되었는데, archive나 revision 테이블에 user_name이 남아 있는 경우에 이런 문제가 발생할 수 있다.
MariaDB [my_wiki]> SELECT ar_id, ar_user, ar_user_text, ar_actor FROM archive WHERE ar_user_text='testuser';
+-------+---------+--------------+----------+
| ar_id | ar_user | ar_user_text | ar_actor |
+-------+---------+--------------+----------+
|  3669 |     260 | testuser     |        0 |
|  3670 |     260 | testuser     |        0 |
+-------+---------+--------------+----------+
2 rows in set (0.000 sec)
MariaDB [my_wiki]> SELECT * FROM actor WHERE actor_name='testuser';                                                                              
+----------+------------+------------+
| actor_id | actor_user | actor_name |
+----------+------------+------------+
|     2261 |       NULL | testuser   |
+----------+------------+------------+
1 row in set (0.000 sec)
MariaDB [my_wiki]> SELECT * FROM user WHERE user_id=260 OR user_name='testuser';
Empty set (0.000 sec)

3 조치[ | ]

MariaDB [my_wiki]> INSERT INTO user (user_id,user_name,user_password,user_newpassword,user_email) VALUES (260,'testuser','','','');
Query OK, 1 row affected (0.004 sec)
MariaDB [my_wiki]> UPDATE actor SET actor_user=260 WHERE actor_id=2261 AND actor_user IS NULL AND actor_name='testuser' LIMIT 1; 
Query OK, 1 row affected (0.002 sec)
Rows matched: 1  Changed: 1  Warnings: 0

4 확인 2[ | ]

root@localhost:/var/www/html# php maintenance/update.php
... (생략)
... log_id=446566
... log_id=446666
... log_id=446691
Completed migration, updated 446425 row(s) with 0 new actor(s), 0 error(s)
Beginning migration of log_search
... target_author_ip, ls_value=213.57.92.46 ls_log_id=212859
Completed migration, inserted 3 row(s) with 0 new actor(s), 0 error(s)
done.
...rev_text_id in table revision already modified by patch patch-rev_text_id-default.sql.
...table site_stats already modified by patch patch-site_stats-modify.sql.
...index rc_namespace_title_timestamp already set on recentchanges table.
...change_tag_def table already exists.
...el_index_60 in table externallinks already modified by patch patch-externallinks-el_index_60-drop-default.sql.
Running maintenance/deduplicateArchiveRevId.php...
...Update 'DeduplicateArchiveRevId' already logged as completed.
done.
...have ct_tag_id field in change_tag table.
...index ar_revid_uniq already set on archive table.
...index log_type_action already set on logging table.
...type_action key doesn't exist.
...index PRIMARY already set on interwiki table.
...index PRIMARY already set on page_props table.
...index PRIMARY already set on protected_titles table.
...index PRIMARY already set on site_identifiers table.
...index rc_this_oldid already set on recentchanges table.
...transcache doesn't exist.
Running maintenance/populateChangeTagDef.php...
...Update 'PopulateChangeTagDef' already logged as completed.
done.
...index change_tag_rc_tag_id already set on change_tag table.
...have ipb_sitewide field in ipblocks table.
...ipblocks_restrictions table already exists.
Table change_tag contains ct_tag field. Dropping ...done.
Dropping table valid_tag ...done.
Dropping table tag_summary ...done.
... (생략)
el_id 830000 - 840000 of 859139
el_id 840000 - 850000 of 859139
el_id 850000 - 859139 of 859139
Done, 2046 rows updated, 2 deleted.
Purging caches...done.

Done in 9 min 31 s.

5 같이 보기[ | ]

6 참고[ | ]

문서 댓글 ({{ doc_comments.length }})
{{ comment.name }} {{ comment.created | snstime }}