[Tracker] PATCH fixing error when deleting from fts table

Hey JÃrg,

Can you review this one for me.

It fixes the issue that we had with the "DELETE FROM \"fts\" WHERE rowid
= ?" query.

I tried this in the tracker-fts-test.c program and I got the exact same
error, making be believe that FTS simply doesn't support this and that
we are getting a strange error back from sqlite.

I noticed that somewhere else in the code using the magic column "fts"
of that table, setting it to -1 for that rowid, appears to also delete. 

This however works only per column? 

So in this patch I iterate over all the properties that are fulltext and
I set the magic column "fts" to -1 for the rowid. Just like the other
place in the code does it (the else block a bit lower, but when the
predicate is rdfs:Resource we want to iter over all properties that are
possible, right? That's what this patch does indeed).

Feel free to take a look at these copy-pastes:

pvanhoof lors:~/repos/gnome/tracker/tracker-master/utils/tracker-fts$ ./tracker-fts-test stew
Tracker-Message: Setting up monitor for changes to config 
** Message: Loading defaults into GKeyFile...
Tracker-Message: Setting up stopword list for language code:'en'
Tracker-Message: Setting up stemmer for language code:'en'
SQL error: bind or column index out of range
pvanhoof lors:~/repos/gnome/tracker/tracker-master/utils/tracker-fts$ git diff
diff --git a/utils/tracker-fts/tracker-fts-test.c b/utils/tracker-fts/tracker-fts-test.c
index 2ccf2e9..6acf77c 100644
--- a/utils/tracker-fts/tracker-fts-test.c
+++ b/utils/tracker-fts/tracker-fts-test.c
 -103,6 +103,7 @@ main (int argc, char **argv)
                exec_sql (db, "insert into recipe (cat, col_default, col_1, col_2) values (2, 'broccoli pie 
stew', 'broccoli,cheese
                exec_sql (db, "insert into recipe (cat, col_default, col_1, col_2) values (7, 'stew pumpkin 
pie stew', 'pumpkin,sug
                exec_sql (db, "insert into recipe (cat, col_default, col_1, col_2) values (6, 'stew pumpkin 
pie stew', 'pumpkin,sug
+               exec_sql (db, "delete from recipe where rowid = 1");
 //     sql = g_strdup_printf ("select cat, count (*) from recipe where recipe match '%s' group by Cat", 
 //     exec_sql (db, sql);
pvanhoof lors:~/repos/gnome/tracker/tracker-master/utils/tracker-fts$

(tracker-store:29814): Tracker-DEBUG: Preparing query: 'DELETE FROM "fts" WHERE rowid = ?'

Tracker-WARNING **: Could not perform SQLite operation, error:25->'bind or column index out of range'

Program received signal SIGABRT, Aborted.
0xb7fe1424 in __kernel_vsyscall ()
(gdb) bt
#0  0xb7fe1424 in __kernel_vsyscall ()
#1  0xb7a273d0 in raise () from /lib/i686/cmov/libc.so.6
#2  0xb7a2aa85 in abort () from /lib/i686/cmov/libc.so.6
#3  0xb7c3740c in IA__g_logv (log_domain=0xb7f7d3fd "Tracker", log_level=G_LOG_LEVEL_WARNING, 
    format=0xb7f7d788 "Could not perform SQLite operation, error:%d->'%s'", args1=0xbfffe89c "\31")
    at /build/buildd-glib2.0_2.20.4-1-i386-6KfM1O/glib2.0-2.20.4/glib/gmessages.c:506
#4  0xb7c37436 in IA__g_log (log_domain=0xb7f7d3fd "Tracker", log_level=G_LOG_LEVEL_WARNING, 
    format=0xb7f7d788 "Could not perform SQLite operation, error:%d->'%s'")
    at /build/buildd-glib2.0_2.20.4-1-i386-6KfM1O/glib2.0-2.20.4/glib/gmessages.c:526
#5  0xb7f79941 in create_result_set_from_stmt (interface=0x8075520, stmt=0x84469c0, error=0x0)
    at tracker-db-interface-sqlite.c:604
#6  0xb7f7a19c in tracker_db_statement_sqlite_execute (stmt=0x8071f08, error=0x0) at 
#7  0xb7f772e2 in tracker_db_statement_execute (stmt=0x8071f08, error=0x0) at tracker-db-interface.c:424
#8  0xb7f945f6 in tracker_data_delete_statement (
    subject=0x8199ab0 "file:///home/pvanhoof/repos/gnome/tracker/tracker-master/bleh", 
    predicate=0x81b7530 "http://www.w3.org/1999/02/22-rdf-syntax-ns#type";, 
    object=0x84331c0 "http://www.w3.org/2000/01/rdf-schema#Resource";) at tracker-data-update.c:785
#9  0xb7f99e6f in tracker_sparql_query_execute_update (self=0x81a7178, query=0x8072000, delete_statements=1, 
    at tracker-sparql-query.c:1181
#10 0xb7f9948e in tracker_sparql_query_execute_delete (self=0x81a7178, query=0x8072000, error=0xbfffeaf8)
    at tracker-sparql-query.c:1007
#11 0xb7f9820f in tracker_sparql_query_execute (self=0x81a7178, error=0xbfffebb8) at 
#12 0xb7f96067 in tracker_data_update_sparql (update=0x8097020 "DELETE { <bleh> a rdfs:Resource }", 
    at tracker-data-update.c:1507
#13 0x0805791c in tracker_store_sparql_update (sparql=0x8097020 "DELETE { <bleh> a rdfs:Resource }", 
    at tracker-store.c:393
#14 0x0805302b in tracker_resources_sparql_update (self=0x840c8a8, update=0x8097020 "DELETE { <bleh> a 
rdfs:Resource }", 
    context=0x8096e08, error=0x0) at tracker-resources.c:294
#15 0x0804fa53 in dbus_glib_marshal_tracker_resources_VOID__STRING_POINTER (closure=0xbfffeeb8, 
    n_param_values=3, param_values=0x8426a18, invocation_hint=0x0, marshal_data=0x8052f6d) at 
#16 0xb7e05ff1 in ?? () from /usr/lib/libdbus-glib-1.so.2
#17 0xb7de0695 in ?? () from /lib/libdbus-1.so.3
#18 0xb7dd1dc4 in dbus_connection_dispatch () from /lib/libdbus-1.so.3
#19 0xb7e03b1d in ?? () from /usr/lib/libdbus-glib-1.so.2
---Type <return> to continue, or q <return> to quit---
#20 0xb7c2d368 in g_main_dispatch (context=0x806b740)
    at /build/buildd-glib2.0_2.20.4-1-i386-6KfM1O/glib2.0-2.20.4/glib/gmain.c:1824
#21 IA__g_main_context_dispatch (context=0x806b740) at 
#22 0xb7c308c3 in g_main_context_iterate (context=0x806b740, block=1, dispatch=1, self=0x805fd08)
    at /build/buildd-glib2.0_2.20.4-1-i386-6KfM1O/glib2.0-2.20.4/glib/gmain.c:2455
#23 0xb7c30d8a in IA__g_main_loop_run (loop=0x807f788)
    at /build/buildd-glib2.0_2.20.4-1-i386-6KfM1O/glib2.0-2.20.4/glib/gmain.c:2663
#24 0x080519d8 in main (argc=1, argv=0xbffff264) at tracker-main.c:803

Philip Van Hoof, freelance software developer
home: me at pvanhoof dot be 
gnome: pvanhoof at gnome dot org 

Attachment: fts.diff
Description: Text Data

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