Backport upstream patch to fix database migration failures (GNOME #743727)

This commit is contained in:
Debarshi Ray 2015-03-03 19:58:08 +01:00
parent f1c139c051
commit 5f59f381c2
2 changed files with 50 additions and 1 deletions

View File

@ -0,0 +1,43 @@
From eac52e3db3c472e35af41f664ae686c0d26739d0 Mon Sep 17 00:00:00 2001
From: Carlos Garnacho <carlosg@gnome.org>
Date: Fri, 13 Feb 2015 13:54:13 +0100
Subject: [PATCH] data-manager: Account for cardinality=0 on DB migration
If a property changes from maxCardinality 1 to many, the database
format is updated to cope with that, but at the time of migrating
data, it doesn't account for resources having no elements. In order
to avoid constraint errors, those must be skipped.
https://bugzilla.gnome.org/show_bug.cgi?id=743727
---
src/libtracker-data/tracker-data-manager.c | 11 ++++++-----
1 file changed, 6 insertions(+), 5 deletions(-)
diff --git a/src/libtracker-data/tracker-data-manager.c b/src/libtracker-data/tracker-data-manager.c
index 74c8fc6..384a98a 100644
--- a/src/libtracker-data/tracker-data-manager.c
+++ b/src/libtracker-data/tracker-data-manager.c
@@ -3206,14 +3206,15 @@ create_decomposed_metadata_tables (TrackerDBInterface *iface,
/* Function does what it must do, so reusable atm */
range_change_for (property, n_in_col_sql, n_sel_col_sql, field_name);
-
- /* Columns happen to be the same for decomposed multi-value and single value atm */
+
+ /* Columns happen to be the same for decomposed multi-value and single value atm */
query = g_strdup_printf ("INSERT INTO \"%s_%s\"(%s) "
- "SELECT %s FROM \"%s_TEMP\"",
+ "SELECT %s FROM \"%s_TEMP\" "
+ "WHERE ID IS NOT NULL AND \"%s\" IS NOT NULL",
service_name, field_name,
- n_in_col_sql->str, n_sel_col_sql->str,
- service_name);
+ n_in_col_sql->str, n_sel_col_sql->str,
+ service_name, field_name);
g_string_free (n_in_col_sql, TRUE);
g_string_free (n_sel_col_sql, TRUE);
--
2.1.0

View File

@ -16,7 +16,7 @@
Name: tracker
Version: 1.3.3
Release: 1%{?dist}
Release: 2%{?dist}
Summary: Desktop-neutral search tool and indexer
Group: Applications/System
@ -27,6 +27,8 @@ Source0: https://download.gnome.org/sources/%{name}/1.3/%{name}-%{version
# only autostart in Gnome, see also
# https://bugzilla.redhat.com/show_bug.cgi?id=771601
Patch0: 0001-Only-autostart-in-GNOME-771601.patch
# https://bugzilla.gnome.org/show_bug.cgi?id=743727
Patch1: 0001-data-manager-Account-for-cardinality-0-on-DB-migrati.patch
BuildRequires: desktop-file-utils
BuildRequires: firefox
@ -172,6 +174,7 @@ This package contains the documentation for tracker
%setup -q
%patch0 -p1 -b .autostart-gnome
%patch1 -p1 -b .cardinality
## nuke unwanted rpaths, see also
## https://fedoraproject.org/wiki/Packaging/Guidelines#Beware_of_Rpath
@ -318,6 +321,9 @@ gtk-update-icon-cache %{_datadir}/icons/hicolor &>/dev/null || :
%changelog
* Tue Mar 03 2015 Debarshi Ray <rishi@fedoraproject.org> - 1.3.3-2
- Backport upstream patch to fix database migration failures (GNOME #743727)
* Fri Feb 06 2015 David King <amigadave@amigadave.com> - 1.3.3-1
- Update to 1.3.3