[tracker/tablelockedproblem] tracker-store: SQLite SAVEPOINTs seem to be causing SQLITE_MISUSED
- From: Philip Van Hoof <pvanhoof src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [tracker/tablelockedproblem] tracker-store: SQLite SAVEPOINTs seem to be causing SQLITE_MISUSED
- Date: Mon, 3 May 2010 11:09:54 +0000 (UTC)
commit b1e74a0df02d685fe1012937e5a004d1d1a48c5f
Author: Philip Van Hoof <philip codeminded be>
Date: Mon May 3 12:59:06 2010 +0200
tracker-store: SQLite SAVEPOINTs seem to be causing SQLITE_MISUSED
The way to reproduce is to set a breakpoint on begin_batch, start a
tracker-import with a large TTL file, then prepare any sparql query
in another terminal, do cont in gdb and immediately after execute the
query. Of course revert this commit or uncomment the commented out
lines first.
Also set breakpoints on the set_errors of tracker_db_cursor_sqlite_iter_next,
you'll notice that result is SQLITE_MISUSED and not SQLITE_LOCKED or
SQLITE_BUSY. Although the error message will be like "Table locked".
After removing the savepoints in process_turtle_file_part and fixing import's
use of batch_begin and batch_end I cannot reproduce this anymore.
src/tracker-store/tracker-store.c | 28 ++++++++++++++++------------
1 files changed, 16 insertions(+), 12 deletions(-)
---
diff --git a/src/tracker-store/tracker-store.c b/src/tracker-store/tracker-store.c
index bb55c55..a4495d3 100644
--- a/src/tracker-store/tracker-store.c
+++ b/src/tracker-store/tracker-store.c
@@ -148,11 +148,14 @@ process_turtle_file_part (TrackerTurtleReader *reader, GError **error)
* Real applications should all use SPARQL update instead of turtle
* import to avoid this issue.
*/
+
+/* SAVEPOINTS don't seem to work well with concurrent queries. I was getting
+ SQLITE_MISUSED as result for sqlite3_step() until I removed these
tracker_data_begin_transaction (&new_error);
if (new_error) {
g_propagate_error (error, new_error);
return FALSE;
- }
+ } */
while (new_error == NULL && tracker_turtle_reader_next (reader, &new_error)) {
/* insert statement */
@@ -174,26 +177,23 @@ process_turtle_file_part (TrackerTurtleReader *reader, GError **error)
i++;
if (!new_error && i >= 10) {
- tracker_data_commit_transaction (&new_error);
- if (new_error) {
- tracker_data_rollback_transaction ();
- g_propagate_error (error, new_error);
- return FALSE;
- }
/* return to main loop */
return TRUE;
}
}
if (new_error) {
- tracker_data_rollback_transaction ();
+ /* Explanation for commenting out, see above
+ * tracker_data_rollback_transaction (); */
g_propagate_error (error, new_error);
return FALSE;
}
- tracker_data_commit_transaction (&new_error);
+ /* Explanation for commenting out, see above
+ * tracker_data_commit_transaction (&new_error); */
if (new_error) {
- tracker_data_rollback_transaction ();
+ /* Explanation for commenting out, see above
+ * tracker_data_rollback_transaction (); */
g_propagate_error (error, new_error);
return FALSE;
}
@@ -553,11 +553,15 @@ queue_idle_handler (gpointer user_data)
goto out;
}
+
+ begin_batch (private);
task->data.turtle.in_progress = TRUE;
+ } else {
+ if (private->batch_count == 0) {
+ begin_batch (private);
+ }
}
- begin_batch (private);
-
if (process_turtle_file_part (turtle_reader, &error)) {
/* import still in progress */
private->batch_count++;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]