DatabaseSchemaObjectExistsException: Cannot add index system_list to table system: index already exists. in DatabaseSchema_mysql->addIndex() (line 433 of /home/drupal-7.0-beta3/includes/database/mysql/schema.inc).
I have the same database error as http://drupal.org/node/937714. I don't get the PDO version check error message from http://drupal.org/node/818374 so it "may" be different. Or the PECL solution may not be the underlying cause of the problem.
I am using a multi site setup with 7.0 beta3 - two sites are running fine.
The first site is a new site it works fine.
Second site is converted (started in drupal 5.0) it works fine no problem with the conversion to V6 or V7.
Third site I attempted also started from Drupal 5 - converted with no problem to Drupal 6 now I get the database error about index already existing trying to upgrade to D7 - I remove that index and get stuck in a loop of database issues.
I am running PHP 5.2.10-2ubuntu6.5 with apache2.2.12 - pdo_mysql shows 5.1.37 ...
If I run "pecl list" the only package that shows up is uploadprogress ...
I have tried the update several times with no luck. It still works fine in D6 - I uninstalled all "extra" modules it is not a very complex site - no CCK - there was one view that I got rid of -- I tried to remove all inststances of "other modules" from the system table to see if there was some crud holding things back - no luck.
Again the site is working fine in the latest version of D6 even after my database clean up.
So that gives me a 50% shot at upgrading a simple site...
Comments
Comment #1
Crell commentedI think this is actually a problem with the updater, not the database.
Comment #2
ralphb commentedThis happens to me as well:
The first update attempt failed because of some PHP error (my old theme was missing). When I restart the update, I get an unending stream of database errors such as
Note that fixing the first error by manually dropping the index in the database will allow me to proceed to the second error. But to fix the second error I'll have to fix the first error AGAIN, since the upgrade script has added the index again.
It seems that the upgrade script cannot handle partially completed upgrades.
Comment #3
oranjer commentedsubscribed
Comment #4
chx commentedWhen I restart the update -- do you mean you did not restore the database just tried to run the update the second time after an error? That's not even supposed to work.
Comment #5
ralphb commentedYes, I just reran update.php -- that approach seemed perfectly natural to me.
It's fine that it's not supposed to work that way, but I would strongly recommend to add a short note about this to UPGRADE.TXT.
Comment #6
joemoraca commentedSo is the answer that you only get one try to upgrade?
I am fine with that - it just means no upgrading sites to D7 only starting new.
Comment #7
ralphb commented@joemoraca: No, it just means that you'll have to rollback your database before you retry.
Comment #8
federico commentedI'm having the same issue using latest dev.
I enabled PDO in ubuntu (not using PECL).
I'm rolling back the 6.19 database after each try. I don't get the PDO version check. I've disabled all optional modules in 6.19 database. I'm marking this issue as major, but seems critical to me, I just don't want to block Drupal 7.
Comment #9
shelleyp commentedI'm getting one error:
DatabaseSchemaObjectExistsException: Cannot add index system_list to table system: index already exists. in DatabaseSchema_mysql->addIndex() (line 433 of /home/books/public_html/includes/database/mysql/schema.inc).
We shouldn't need to rollback an upgrade attempt. The upgrade should be graceful enough to handle a partial upgrade.
Comment #10
int commented@shelleyp, you must upgrade to the dev version and run the update.php, I think that error are allready fixed.
Comment #11
federico commentedI tried again using latest dev (20 Dec) and I'm still getting the errors.
DatabaseSchemaObjectExistsException: Table role_permission already exists. in DatabaseSchema->createTable() (line 623 of /var/www/includes/database/schema.inc).
Comment #12
shelleyp commentedI'll try the dev version, see how it goes. Thanks for suggestion.
Update: I tried it with the dev, and still getting this error. And an uncaught exception.
Comment #13
pfx commentedexactly the same problem as #2 when I try do upgrade from Drupal 6.20 to Drupal Drupal 7.0 RC 3 Released...
Comment #14
rfayComment #15
dwwComment #16
federico commentedI tried again usign RC3:
DatabaseSchemaObjectExistsException: Table role_permission already exists. in DatabaseSchema->createTable() (line 623 of /var/www/includes/database/schema.inc).
Comment #17
federico commentedComment #18
catchfederico - could you post your PDO version, and also the output of pecl list?
Comment #19
federico commentedThanks, I don't know how to check the PDO version, this is the output of phpinfo
and this is pecl list
Comment #20
catchHmm, any chance you're running EAccelerator as well as APC (seems unlikely but has been responsible for a lot of similar errors #914742: Add hook_requirements() for buggy versions of eAccelerator)
Comment #21
catchAlso #947616: Warn people not to enable xdebug.show_exception_trace.
Both of these cause bizarre errors in the installer, neither are patched.
Comment #22
webchickI'm open to discussing both of those, btw. It just seems like a lot of workarounds in our code for weirdness in others'.
Comment #23
federico commentedI'm not running EAcceleartor. I've uninstalled the "php5-xdebug" package and tried again, with no luck.
Comment #24
chx commentedfederico any chance I can get access to that machine? Either catch me on irc.freenode.net #drupal-contribute as chx or email me chx1975 gmail com. Thanks
Comment #25
federico commentedchx: it's a local machine, I tried again using another machine (ubuntu server 10.04 with pdo 5.1.41) and got:
Comment #26
carlos8f commentedAbout the "cannot add index 'system_list'" error, that simply means that the upgrade failed previously and was attempted again without restoring a backup. A more meaningful error will likely appear before the 'system_list' error in the php logs. I'm not sure what the "role_permission" error is about though.
The last error about "Numeric value out of range" looks meaningless as well.
I'm not convinced that there is an actual bug in this issue, seems more likely that http://drupal.org/requirements or UPGRADE.txt are not being followed. Otherwise it would be more widely reproducible.
Comment #27
chx commentedI am putting down to needs info until we get a reproducible bug report. Sorry I can not see how could I fix anything here. If you can start from a D6 database and upgrade and it fails and restoring it restarting fails the same place and make that dump available somehow... that'd be a usable bug report for example. These two word "i tried foo" reports contain nothing tangible, no two reports are the same. (There is no trace of an OS, webserver and PHP version either).
Edit: local machines can run VNC or sshd too. You can do VNC reverse connection to bypass firewalls. Where there is a will, there is a way.
Comment #28
Crell commentedA one-off issue is not critical/release blocking if no one else is able to reproduce it yet.
Comment #29
federico commentedAbout the "cannot add index 'system_list' error, I'm sure I dropped the database after every failed attempt, then I copied the D6 database again from the original site (running live without issues), after disabling every optional module and setting the theme to Garland.
I changed the priority to critical because I thought I was not the only one facing this issue.
About VNC reverse connection to bypass firewall, sorry, I didn't know about that, maybe I don't have the required skills to participate here. Thanks anyway, I'll see if I can configure a VPS to give you access to the server (i'll have to remove the personal info of every user and other sensitive data to complain with the disclaimers of my site). But I spent a lot of time on this, you didn't need to say that there is no will from my side, that's not true.
If it helps somehow:
Comment #30
rfay@federico, it's very likely that if you can provide a database (D6, before upgrade) and perhaps a tarball, that this could be replicated.
If you can replicate this every time you try with the same starting point, then it may be worth chasing.
Comment #31
federico commentedSolved using another machine!
Comment #32
drumrwaldo commentedI am having the same issue. Following instructions per http://drupal.org/node/570162, though one installation I mistakenly autocompleted the address to install.php instead of update.php. Downloaded a new copy of the database to a new location and re-downloaded core module and all components from a functional live site. Drupal 7.0 was a fresh download yesterday when it failed again. I'm working on MAMP on a local machine and am happy to provide any additional information. The error is:
"DatabaseSchemaObjectExistsException: Cannot add index system_list to table system: index already exists. in DatabaseSchema_mysql->addIndex() (line 433 of /Applications/MAMP/htdocs/bonustomato/web/includes/database/mysql/schema.inc)."
Below that I get:
Uncaught exception thrown in session handler.
PDOException: SQLSTATE[42S22]: Column not found: 1054 Unknown column 'ssid' in 'where clause': SELECT 1 AS expression FROM {sessions} sessions WHERE ( (sid = :db_condition_placeholder_0) AND (ssid = :db_condition_placeholder_1) ) FOR UPDATE; Array ( [:db_condition_placeholder_0] => c821958eae86b5803a10d46c0909cbeb [:db_condition_placeholder_1] => ) in _drupal_session_write() (line 204 of /Applications/MAMP/htdocs/bonustomato/web/includes/session.inc).
I've tried the process several different times using variations on the downloaded components and database from the functional live site, and continue to have the same result. Site was previously on 6.12 and upgraded to 6.20 without issue.
Thanks in advance to anyone that can provide assistance.
Comment #33
ihateie commentedThe same issue as #32. Trying to upgrade from 6.20 to 7.x following 7's upgrade.txt and having errors:
DatabaseSchemaObjectExistsException: Cannot add index system_list to table system: index already exists. in DatabaseSchema_mysql->addIndex() (line 433 of ...\includes\database\mysql\schema.inc).
Uncaught exception thrown in session handler.
PDOException: SQLSTATE[42S22]: Column not found: 1054 Unknown column 'ssid' in 'where clause': SELECT 1 AS expression FROM {sessions} sessions WHERE ( (sid = :db_condition_placeholder_0) AND (ssid = :db_condition_placeholder_1) ) FOR UPDATE; Array ( [:db_condition_placeholder_0] => 73613c88076d259e3edbc52bf77e0680 [:db_condition_placeholder_1] => ) in _drupal_session_write() (line 204 of ...\includes\session.inc).
Comment #34
ihateie commentedresolved manually using mysql `drop index` & `alter table drop column` statements
Comment #35
drumrwaldo commentedihatie, can you explain how you resolved that manually? Forgive my ignorance of manual mysql manipulation. Thanks!
Comment #36
bryancasler commentedsubscribe
Comment #37
klausiStumbled over the same role_permission error today. Solution for me: make sure you completely empty the database before you try the upgrade again. I just imported the mysqldump again, so an existing role_permission table was left behind from a previous upgrade attempt which caused the error.
Comment #38
kasorbo commentedI am still getting this error.
I have read this thread and tried everything mentioned. I have
I still get:
DatabaseSchemaObjectExistsException: Cannot add index <em class="placeholder">system_list</em> to table <em class="placeholder">system</em>: index already exists. in DatabaseSchema_mysql->addIndex() (line 432 of C:\inetpub\wwwroot\civiCRM4.1\includes\database\mysql\schema.inc).Upgrading from 6.19 to 7.4
Running php 5.3.5 on IIS 7
Mysql 5.0.81
Comment #39
jonathan_hunt commentedI get the same error upgrading from Drupal 6.22 to 7.7. Looks like the system_list index was removed from system_update_7018() (see http://drupal.org/node/563106#comment-2610716 ) but re-instated in system_update_7062().
Edit: false alarm, my database hadn't been properly clean up before retrying. Emptying all tables and restarting the migration process worked fine for me.
Comment #40
frank ralf commentedSame error messages as #33 when upgrading from 6.22 to 7.7.
See also 6.2 to 7 error PDOException: SQLSTATE[42S22]
Might be related to #717834: The dependencies declared in core's hook_update_dependencies() implementations aren't actually correct which is supposed to be fixed in 7.8.
Comment #41
deajan commentedHello,
Database Schema errors usually appear if an update.php script did not finish.
Like mine:
DatabaseSchemaObjectExistsException: Cannot add index system_list to table system: index already exists. in DatabaseSchema_mysql->addIndex()...
I was able to get past this error by increasing php max_exec_time in php.ini from 30s to something more likely to give the update script some time (i put in 3600s, just for the update, and reverted it back later)
After that do a database backup restoration (once the update script failed the database becomes unusable)...
You should then be able to run your update.php without trouble...
Comment #42
dgtlmoon commentedI just got bit by this bug
"DatabaseSchemaObjectExistsException: Cannot add index system_list to table system: index already exists. in DatabaseSchema_mysql->addIndex() (line 432 of /var/www/d7/includes/database/mysql/schema.inc).
The website encountered an unexpected error. Please try again later."
seems to be executing immediately so it's not a time out issue
I have ran all the updates for latest drupal 6, now migrating to D7 seems to be an issue
not sure where to go from here , if i drop that index, it recreates it, then i end up back in the same place
Comment #43
rfayOne often has to do multiple upgrades to get where they're going. However, I suspect you might have done the upgrade more than one time without reloading the D6 database from scratch.
When repetitively trying upgrades, make sure to start with the *original* *unaltered* D6 database before starting over again.
Is it possible this is what happened to you?
Putting this back to fixed, as it appears to be more of a support request than a bug report against this issue. You can reopen if you're sure it's this same issue.
Comment #44
dgtlmoon commentedYes, actually to throw a curve ball, I'm upgrading from drupal 5, but i'm doing all the upgrades in D6, then moving to D7.
Turns out it might have something todo with my PHP timeout settings, even tho all the updates for D6 are marked as complete, the D6 upgrade might have terminated before it was really finished, trying on the D7 again now, will update this issue if required
Comment #45
justindodge commentedJust to add to the pot, I was getting this error during an upgrade process and realized that even though I was reimporting a fresh sql file every time, it wasn't actually dropping the new tables created by the upgrade process.
Dropping the database and recreating it before reattempting the update will make absolutely certain you are starting fresh, and solved the error for me.
Comment #46
dgtlmoon commentedBut if you drop the database and create a fresh one, that is not really upgrading is it? what if you have a current site you want to upgrade?
Comment #47
justindodge commentedSorry, what I mean is that you should
1. Make a backup of your D6 database
2. Upgrade
3. If upgrade does not complete or you encounter any errors - DROP the database and import the one you made on step 1.
4. Try to resolve the cause of errors
5. Go back to 2, and repeat.
If you if you don't do the drop on step 3 and just reimport your DB from step 1, you will end up with extra tables that will cause the updater to throw errors, regardless of whether you ever fix what was causing them in the first place, whether it be timeout issues, missing dependencies, or whatever.
Comment #48
cryptosmith commented"DatabaseSchemaObjectExistsException: Cannot add index system_list to table system: index already exists. in DatabaseSchema_mysql->addIndex() (line 432 of /var/www/d7/includes/database/mysql/schema.inc).
The website encountered an unexpected error. Please try again later."
I worked past this error by using phpmyadmin to clean up every last database anomaly reported by the D6 Schema module. There was one anomaly that I simply left in place (an inconsistency in specifying "unique" for an index field in the Blog_API table, I think). After that, I got update.php to work correctly.
At one point when trying to update to 7.12, I cleaned up all the schema inconsistencies except for the blog_api thing and, bizarrely, I also failed to remove the extra system_list index noted in the error message. Once I removed the system_list index, though, the conversion process took off like gangbusters.
Now, the system_list table may have been there because of earlier (failed) D7 conversions - I'd been trying since Drupal Chicago to do the conversion. Still, it would have been nice, given that it hits a lot of people, if that sort of thing could be fixed.
Comment #49
marcingy commentedYou need to make sure you clean up all data from previous failed installs if you didn't then reattempting an update will fail.
Comment #50
Screenack commentedAfter many red herring chases and misleading posts regarding artifacts related to not following best practices on the D6 -> D7 upgrade, this thread helped set me straight, and I am grateful.
My workflow requires that I will "reflow" updated content through the D6 -> D7 update procedure, so I automated this with drush. The other component is two local folders: a full D6 mirror of the site, and the "clean" D7 version, each with its own virtual host.
Here's from my shell script:
Comment #51
neRok commentedClosing as there doesnt seem to be an issue here, just support requests of the same thing over and over. The 'solution' was posted many times, such as #47.
Comment #52
dgtlmoon commentedAlso drop those indexes before running the upgrade if they are a problem
Comment #53
avinash.deedwaniya commentedStill I am getting below error:
DatabaseSchemaObjectExistsException: Cannot add field url_alias.source: field already exists. in DatabaseSchema_mysql->addField()
Upgrade 6.23 to 7.0
please help. give me some steps for solutions. urgent
Comment #54
kari.kaariainen commentedYou're supposed to upgrade to the latest D7, not 7.0.
Comment #55
hometoy commentedI have been upgrading my multi-site Drupal from Drupal 5 to Drupal 7 in a VM on FreeBSD 9.1 with PostgreSQL 9.0 in a VM (for dev purposes only, final destination is a barebones remote server)
I upgraded both sites from Drupal 5 to Drupal 6 and had to do some manual data fixes to put the blocks back where they were before. The theme was set to Garland for both.
When I run update.php for the default site, it seems to run through without an issue. When I run update.php for the secondary site it never gets to the point of being able to run it.
The secondary site has a prefix set to the table names, while the default does not.
The system table does not have an index called "system_list" but does have "system_system_list_idx" which I don't know if it is the same.
NOTE: I am not sure what you mean by dropping the database and how this is done without losing all of the content and settings. I do have dumps of the database.
Comment #56
rfayDrop the index system_list (not table, index) before you begin the D7 upgrade. Or manually create the index D7 wants. Or ignore the error.
Comment #57
hometoy commentedI don't see "system_list" above as an index for the table. So I tried dropping it blindly with
DROP INDEX system_list;and getSo do I need to run instead
Is that the same thing?
Comment #58
harry slaughterA bit unsettling that broken = 'works as designed'.
Core doesn't upgrade itself at all. The available migrate tools somewhat kinda half migrate some stuff.
I guess a lot of people are starting from scratch or making consultants happy.
These are dark days Drupaleers.
Comment #59
santljvr commentedi am upgrading locally from drupal 6.34 to drupal 7.1 and getting similar error : DatabaseSchemaObjectExistsException: Cannot add index system_list to table
Comment #60
David_Rothstein commentedFor anyone who stumbles across this via a search, note that the issue from #25:
is likely caused by #1007038: profiles/standard update query blocks 6 to 7 update if the site started on Drupal 4.6 or earlier (PDOException: SQLSTATE[22003]: Numeric value out of range).