[tracker/wip/carlosg/shuffle-nao: 4/4] libtracker-fts: Bail out on altering empty FTS tables



commit ce17493fc759e1aedb52dbef8ad3e49d39b305ef
Author: Carlos Garnacho <carlosg gnome org>
Date:   Fri Apr 10 13:37:41 2020 +0200

    libtracker-fts: Bail out on altering empty FTS tables
    
    Looking at the code for the previous commit, it seems we don't handle
    properly the case of a database being removed all FTS properties. We
    would issue a FTS update, but try to go with an empty set of properties.
    
    Since FTS updates do drop the FTS view/tables upfront, and the
    alter_table() bits basically consist of create_table() + rebuild,
    it should simply bail out if there's no FTS properties, the FTS
    table/view will be already removed from the database.

 src/libtracker-fts/tracker-fts.c | 3 +++
 1 file changed, 3 insertions(+)
---
diff --git a/src/libtracker-fts/tracker-fts.c b/src/libtracker-fts/tracker-fts.c
index e470be4fe..40aee894a 100644
--- a/src/libtracker-fts/tracker-fts.c
+++ b/src/libtracker-fts/tracker-fts.c
@@ -201,6 +201,9 @@ tracker_fts_alter_table (sqlite3     *db,
        gchar *query, *tmp_name;
        int rc;
 
+       if (g_hash_table_size (tables) == 0)
+               return TRUE;
+
        tmp_name = g_strdup_printf ("%s_TMP", table_name);
 
        if (!tracker_fts_create_table (db, database, tmp_name, tables, grouped_columns)) {


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]