Bug 220007 - akonadi database schema upgrade to version 13 fails
Summary: akonadi database schema upgrade to version 13 fails
Status: RESOLVED FIXED
Alias: None
Product: Akonadi
Classification: Frameworks and Libraries
Component: general (show other bugs)
Version: 4.3
Platform: Compiled Sources Linux
: NOR crash
Target Milestone: ---
Assignee: Volker Krause
URL:
Keywords:
: 219004 (view as bug list)
Depends on:
Blocks:
 
Reported: 2009-12-24 22:18 UTC by Benoit Grégoire
Modified: 2010-01-15 10:14 UTC (History)
1 user (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Benoit Grégoire 2009-12-24 22:18:15 UTC
Version:            (using Devel)
OS:                Linux
Installed from:    Compiled sources

Akonadi is unable to upgrade to schema version 13 because of a capitalisation error.  Depending on configuration, mysql is case insensitive on table names, which is probably why this hasn't been caught earlier.

Error text:

akonadictl start
Starting Akonadi Server...                     
   done.                                       
[akonadiserver] QSqlDatabasePrivate::removeDatabase: connection 'initConnection' is still in use, all queries will cease to work.
[akonadiserver] Database "akonadi" opened using driver "QMYSQL"                                                                                                 
[akonadiserver] DbInitializer::run()                                                                                                                            
[akonadiserver] checking table  "SchemaVersionTable"                                                                                                            
[akonadiserver] checking table  "ResourceTable"                                                                                                                 
[akonadiserver] checking table  "CollectionTable"                                                                                                               
[akonadiserver] checking table  "MimeTypeTable"                                                                                                                 
[akonadiserver] checking table  "PimItemTable"                                                                                                                  
[akonadiserver] checking table  "FlagTable"                                                                                                                     
[akonadiserver] checking table  "PartTable"                                                                                                                     
[akonadiserver] checking table  "CollectionAttributeTable"                                                                                                      
[akonadiserver] checking relation  "PimItemFlagRelation"                                                                                                        
[akonadiserver] checking relation  "CollectionMimeTypeRelation"                                                                                                 
[akonadiserver] checking relation  "CollectionPimItemRelation"                                                                                                  
[akonadiserver] DbInitializer::run() done                                                                                                                       
[akonadiserver] skipping update 2                                                                                                                               
[akonadiserver] skipping update 3                                                                                                                               
[akonadiserver] skipping update 4                                                                                                                               
[akonadiserver] skipping update 8                                                                                                                               
[akonadiserver] skipping update 10                                                                                                                              
[akonadiserver] skipping update 12                                                                                                                              
[akonadiserver] DbUpdater: update to version: 13  mandatory: true  code: "UPDATE collectiontable SET parentId = NULL WHERE parentId = 0;                        
[akonadiserver] ALTER TABLE CollectionTable CHANGE parentId parentId BIGINT DEFAULT NULL;"                                                                      
[akonadiserver] DBUpdater: query error: "Table 'akonadi.collectiontable' doesn't exist QMYSQL: Unable to execute query" " "                                     
[akonadiserver] Query was:  "UPDATE collectiontable SET parentId = NULL WHERE parentId = 0;                                                                     
[akonadiserver] ALTER TABLE CollectionTable CHANGE parentId parentId BIGINT DEFAULT NULL;"                                                                      
[akonadiserver] Target version was:  13                                                                                                                         
[akonadiserver] Mandatory:  true                                                                                                                                
[akonadiserver] Failed to commit transaction for database update                                                                                                
[akonadiserver] Unable to initialize database.                                                                                                                  
[akonadiserver] "[                                                                                                                                              
[akonadiserver] 0: akonadiserver(_Z11akBacktracev+0x35) [0x8051fc5]                                                                                             
[akonadiserver] 1: akonadiserver [0x8052496]                                                                                                                    
[akonadiserver] 2: [0x110400]                                                                                                                                   
[akonadiserver] 3: [0x110422]                                                                                                                                   
[akonadiserver] 4: /lib/tls/i686/cmov/libc.so.6(gsignal+0x51) [0x7e24d1]                                                                                        
[akonadiserver] 5: /lib/tls/i686/cmov/libc.so.6(abort+0x182) [0x7e5932]                                                                                         
[akonadiserver] 6: /usr/lib/libQtCore.so.4(_Z17qt_message_output9QtMsgTypePKc+0x8c) [0x23f20c]                                                                  
[akonadiserver] 7: akonadiserver(_ZN15FileDebugStream9writeDataEPKcx+0xc4) [0x80534b4]                                                                          
[akonadiserver] 8: /usr/lib/libQtCore.so.4(_ZN9QIODevice5writeEPKcx+0x8e) [0x2d847e]                                                                            
[akonadiserver] 9: /usr/lib/libQtCore.so.4 [0x2ebe55]                                                                                                           
[akonadiserver] 10: /usr/lib/libQtCore.so.4(_ZN11QTextStreamD1Ev+0x3d) [0x2ed2fd]                                                                               
[akonadiserver] 11: akonadiserver(_ZN6QDebugD1Ev+0x46) [0x804dcb6]                                                                                              
[akonadiserver] 12: /usr/lib/libakonadiprivate.so.1(_ZN7Akonadi13AkonadiServerC1EP7QObject+0x67a) [0xd7fb9a]                                                    
[akonadiserver] 13: /usr/lib/libakonadiprivate.so.1(_ZN7Akonadi13AkonadiServer8instanceEv+0x58) [0xd80a58]                                                      
[akonadiserver] 14: akonadiserver(main+0x32c) [0x804d20c]                                                                                                       
[akonadiserver] 15: /lib/tls/i686/cmov/libc.so.6(__libc_start_main+0xe6) [0x7ceb56]                                                                             
[akonadiserver] 16: akonadiserver [0x804ce11]                                                                                                                   
[akonadiserver] ]                                                                                                                                               
[akonadiserver] "                                                                                                                                               
ProcessControl: Application 'akonadiserver' returned with exit code 255 (Unknown error)                                                                         


Solution is to replace the following SQL fragment for the schema upgrade:
UPDATE collectiontable SET parentId = NULL WHERE parentId = 0;
with:
UPDATE CollectionTable SET parentId = NULL WHERE parentId = 0;

Temporary workaround is to run the following queries manually:
UPDATE CollectionTable SET parentId = NULL WHERE parentId = 0;                                                                     
ALTER TABLE CollectionTable CHANGE parentId parentId BIGINT DEFAULT NULL;                
UPDATE SchemaVersionTable SET version = 13 WHERE SchemaVersionTable.version=12;
Comment 1 Volker Krause 2009-12-29 23:16:56 UTC
SVN commit 1067593 by vkrause:

We cannot rely on case-insensitive table names when not using our
internal MySQL server, an external MySQL server might be configured
differently (not sure about PostgreSQL, might be affected as well).

BUG: 220007


 M  +7 -7      dbupdate.xml  


WebSVN link: http://websvn.kde.org/?view=rev&revision=1067593
Comment 2 Alexander Opitz 2009-12-29 23:40:54 UTC
Tested and works.
Comment 3 Volker Krause 2010-01-15 10:14:17 UTC
*** Bug 219004 has been marked as a duplicate of this bug. ***