Rex Dieter 78fb1bf
From 4ca8b846baaad48ebbd723f6411f9571a3b0f5ad Mon Sep 17 00:00:00 2001
Rex Dieter 78fb1bf
From: =?UTF-8?q?Dan=20Vr=C3=A1til?= <dvratil@redhat.com>
Rex Dieter 78fb1bf
Date: Tue, 22 Apr 2014 11:28:07 +0200
Rex Dieter 78fb1bf
Subject: [PATCH 2/7] Remove the invalid GID part from PartTable before
Rex Dieter 78fb1bf
 starting PartTable migration
Dan Vrátil 660e892
Rex Dieter 78fb1bf
More people than we expected have invalid 'GID' part in their PartTable,
Rex Dieter 78fb1bf
which breaks migration to schema 25, because it expects all part types
Rex Dieter 78fb1bf
to have a valid name.
Rex Dieter 78fb1bf
Rex Dieter 78fb1bf
To work around this fact, we DELETE all parts with name 'GID' from PartTable
Rex Dieter 78fb1bf
before starting the actual migration. This will not fix the migration for
Rex Dieter 78fb1bf
people with other invalid parts, but I haven't heard of any such. To make
Rex Dieter 78fb1bf
this completely bullet-proof, we would need to iterate through all entries,
Rex Dieter 78fb1bf
which would be massively slower than current INSERT INTO ... SELECT FROM approach.
Rex Dieter 78fb1bf
Rex Dieter 78fb1bf
Distributions, this is a good choice for backporting into 1.12.1 ;-)
Rex Dieter 78fb1bf
Rex Dieter 78fb1bf
BUG: 331867
Rex Dieter 78fb1bf
FIXED-IN: 1.12.2
Rex Dieter 78fb1bf
---
Rex Dieter 78fb1bf
 server/src/storage/dbupdater.cpp | 9 +++++++++
Rex Dieter 78fb1bf
 1 file changed, 9 insertions(+)
Dan Vrátil 660e892
Dan Vrátil 660e892
diff --git a/server/src/storage/dbupdater.cpp b/server/src/storage/dbupdater.cpp
Dan Vrátil 660e892
index ccaf584..d6368b5 100644
Dan Vrátil 660e892
--- a/server/src/storage/dbupdater.cpp
Dan Vrátil 660e892
+++ b/server/src/storage/dbupdater.cpp
Dan Vrátil 660e892
@@ -261,6 +261,15 @@ bool DbUpdater::complexUpdate_25()
Dan Vrátil 660e892
     }
Dan Vrátil 660e892
   }
Dan Vrátil 660e892
 
Dan Vrátil 660e892
+  {
Dan Vrátil 660e892
+    // It appears that more users than expected have the invalid "GID" part in their
Dan Vrátil 660e892
+    // PartTable, which breaks the migration below (see BKO#331867), so we apply this
Dan Vrátil 660e892
+    // wanna-be fix to remove the invalid part before we start the actual migration.
Dan Vrátil 660e892
+    QueryBuilder qb( QLatin1String( "PartTable" ), QueryBuilder::Delete );
Dan Vrátil 660e892
+    qb.addValueCondition( QLatin1String( "PartTable.name" ), Query::Equals, QLatin1String( "GID" ) );
Dan Vrátil 660e892
+    qb.exec();
Dan Vrátil 660e892
+  }
Dan Vrátil 660e892
+
Dan Vrátil 660e892
   akDebug() << "Creating a PartTable_new";
Dan Vrátil 660e892
   {
Dan Vrátil 660e892
     TableDescription description;
Rex Dieter 78fb1bf
-- 
Rex Dieter 78fb1bf
1.9.3
Rex Dieter 78fb1bf