From 47a2edf9c28cc2330bcfd111d7b4a887cce45e13 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dan=20Vr=C3=A1til?= Date: Tue, 22 Apr 2014 11:40:30 +0200 Subject: [PATCH 1/2] Backport 1.12 commit to fix upgrade from Akonadi<1.12 for users with invalid DB entries --- ...alid-part-before-parttable-migration.patch | 41 +++++++++++++++++++ akonadi.spec | 9 +++- 2 files changed, 49 insertions(+), 1 deletion(-) create mode 100644 0001-remove-invalid-part-before-parttable-migration.patch diff --git a/0001-remove-invalid-part-before-parttable-migration.patch b/0001-remove-invalid-part-before-parttable-migration.patch new file mode 100644 index 0000000..a367067 --- /dev/null +++ b/0001-remove-invalid-part-before-parttable-migration.patch @@ -0,0 +1,41 @@ +commit 4ca8b846baaad48ebbd723f6411f9571a3b0f5ad +Author: Dan Vrátil +Date: Tue Apr 22 11:28:07 2014 +0200 + + Remove the invalid GID part from PartTable before starting PartTable migration + + More people than we expected have invalid 'GID' part in their PartTable, + which breaks migration to schema 25, because it expects all part types + to have a valid name. + + To work around this fact, we DELETE all parts with name 'GID' from PartTable + before starting the actual migration. This will not fix the migration for + people with other invalid parts, but I haven't heard of any such. To make + this completely bullet-proof, we would need to iterate through all entries, + which would be massively slower than current INSERT INTO ... SELECT FROM approach. + + Distributions, this is a good choice for backporting into 1.12.1 ;-) + + BUG: 331867 + FIXED-IN: 1.12.2 + +diff --git a/server/src/storage/dbupdater.cpp b/server/src/storage/dbupdater.cpp +index ccaf584..d6368b5 100644 +--- a/server/src/storage/dbupdater.cpp ++++ b/server/src/storage/dbupdater.cpp +@@ -261,6 +261,15 @@ bool DbUpdater::complexUpdate_25() + } + } + ++ { ++ // It appears that more users than expected have the invalid "GID" part in their ++ // PartTable, which breaks the migration below (see BKO#331867), so we apply this ++ // wanna-be fix to remove the invalid part before we start the actual migration. ++ QueryBuilder qb( QLatin1String( "PartTable" ), QueryBuilder::Delete ); ++ qb.addValueCondition( QLatin1String( "PartTable.name" ), Query::Equals, QLatin1String( "GID" ) ); ++ qb.exec(); ++ } ++ + akDebug() << "Creating a PartTable_new"; + { + TableDescription description; diff --git a/akonadi.spec b/akonadi.spec index 95bcf26..38cf7ea 100644 --- a/akonadi.spec +++ b/akonadi.spec @@ -14,7 +14,7 @@ Summary: PIM Storage Service Name: akonadi Version: 1.12.1 -Release: 2%{?dist} +Release: 3%{?dist} License: LGPLv2+ URL: http://community.kde.org/KDE_PIM/Akonadi @@ -33,6 +33,8 @@ Source10: akonadiserverrc.mysql ## upstreamable patches ## upstream patches +# 1.12 branch +Patch101: 0001-remove-invalid-part-before-parttable-migration.patch %define mysql_conf_timestamp 20140415 @@ -87,6 +89,8 @@ See also: %{_sysconfdir}/akonadi/mysql-global.conf %prep %setup -q -n akonadi-%{version} +%patch101 -p1 -b .0001 + %build mkdir -p %{_target_platform} @@ -190,6 +194,9 @@ fi %changelog +* Tue Apr 22 2014 Daniel Vrátil 1.12.1-3 +- backport 1.12.2 patch to fix upgrade from Akonadi < 1.12 for users with invalid entries in DB + * Tue Apr 15 2014 Rex Dieter 1.12.1-2 - drop mysql-global-mobile.conf, it's too minimalistic - drop Requires: qt4 >= 4.8.5-10 (workaround for psql driver bug had only a small window a long time ago) From 412777560a091d16a0b825ad95bfc5c9aa330328 Mon Sep 17 00:00:00 2001 From: Rex Dieter Date: Thu, 1 May 2014 13:11:59 -0500 Subject: [PATCH 2/2] Revert "Backport 1.12 commit to fix upgrade from Akonadi<1.12 for users with invalid DB entries" This reverts commit 47a2edf9c28cc2330bcfd111d7b4a887cce45e13. --- ...alid-part-before-parttable-migration.patch | 41 ------------------- akonadi.spec | 9 +--- 2 files changed, 1 insertion(+), 49 deletions(-) delete mode 100644 0001-remove-invalid-part-before-parttable-migration.patch diff --git a/0001-remove-invalid-part-before-parttable-migration.patch b/0001-remove-invalid-part-before-parttable-migration.patch deleted file mode 100644 index a367067..0000000 --- a/0001-remove-invalid-part-before-parttable-migration.patch +++ /dev/null @@ -1,41 +0,0 @@ -commit 4ca8b846baaad48ebbd723f6411f9571a3b0f5ad -Author: Dan Vrátil -Date: Tue Apr 22 11:28:07 2014 +0200 - - Remove the invalid GID part from PartTable before starting PartTable migration - - More people than we expected have invalid 'GID' part in their PartTable, - which breaks migration to schema 25, because it expects all part types - to have a valid name. - - To work around this fact, we DELETE all parts with name 'GID' from PartTable - before starting the actual migration. This will not fix the migration for - people with other invalid parts, but I haven't heard of any such. To make - this completely bullet-proof, we would need to iterate through all entries, - which would be massively slower than current INSERT INTO ... SELECT FROM approach. - - Distributions, this is a good choice for backporting into 1.12.1 ;-) - - BUG: 331867 - FIXED-IN: 1.12.2 - -diff --git a/server/src/storage/dbupdater.cpp b/server/src/storage/dbupdater.cpp -index ccaf584..d6368b5 100644 ---- a/server/src/storage/dbupdater.cpp -+++ b/server/src/storage/dbupdater.cpp -@@ -261,6 +261,15 @@ bool DbUpdater::complexUpdate_25() - } - } - -+ { -+ // It appears that more users than expected have the invalid "GID" part in their -+ // PartTable, which breaks the migration below (see BKO#331867), so we apply this -+ // wanna-be fix to remove the invalid part before we start the actual migration. -+ QueryBuilder qb( QLatin1String( "PartTable" ), QueryBuilder::Delete ); -+ qb.addValueCondition( QLatin1String( "PartTable.name" ), Query::Equals, QLatin1String( "GID" ) ); -+ qb.exec(); -+ } -+ - akDebug() << "Creating a PartTable_new"; - { - TableDescription description; diff --git a/akonadi.spec b/akonadi.spec index 38cf7ea..95bcf26 100644 --- a/akonadi.spec +++ b/akonadi.spec @@ -14,7 +14,7 @@ Summary: PIM Storage Service Name: akonadi Version: 1.12.1 -Release: 3%{?dist} +Release: 2%{?dist} License: LGPLv2+ URL: http://community.kde.org/KDE_PIM/Akonadi @@ -33,8 +33,6 @@ Source10: akonadiserverrc.mysql ## upstreamable patches ## upstream patches -# 1.12 branch -Patch101: 0001-remove-invalid-part-before-parttable-migration.patch %define mysql_conf_timestamp 20140415 @@ -89,8 +87,6 @@ See also: %{_sysconfdir}/akonadi/mysql-global.conf %prep %setup -q -n akonadi-%{version} -%patch101 -p1 -b .0001 - %build mkdir -p %{_target_platform} @@ -194,9 +190,6 @@ fi %changelog -* Tue Apr 22 2014 Daniel Vrátil 1.12.1-3 -- backport 1.12.2 patch to fix upgrade from Akonadi < 1.12 for users with invalid entries in DB - * Tue Apr 15 2014 Rex Dieter 1.12.1-2 - drop mysql-global-mobile.conf, it's too minimalistic - drop Requires: qt4 >= 4.8.5-10 (workaround for psql driver bug had only a small window a long time ago)