tracker r1730 - branches/indexer-split/src/libtracker-db



Author: pvanhoof
Date: Fri Jun 20 15:18:04 2008
New Revision: 1730
URL: http://svn.gnome.org/viewvc/tracker?rev=1730&view=rev

Log:
2008-06-20  Philip Van Hoof  <pvanhoof gnome org>

        * src/libtracker-db/tracker-db-manager.c:
        * data/sqlite-service-triggers.sql:
        * data/sqlite-tracker-triggers.sql:

        Using a transaction around database initializations. This speeds up
        initialization, makes it more robust (what if we get killed while
        initializing) and it seems to avoid a call for fsync() when we have
        PRAGMA synchronous = NORMAL (which we currently do have for all
        database connections).

        Point of opinion about this commit: we should utilize transactions more
        often in the code. It helps us avoid corruption and massively speeds up
        INSERTs and UPDATEs:

        http://www.sqlite.org/speed.html:

        At Executive Summary: SQLite works best if you group multiple
        operations together into a single transaction.

	continued
w


Modified:
   branches/indexer-split/src/libtracker-db/tracker-db-manager.c

Modified: branches/indexer-split/src/libtracker-db/tracker-db-manager.c
==============================================================================
--- branches/indexer-split/src/libtracker-db/tracker-db-manager.c	(original)
+++ branches/indexer-split/src/libtracker-db/tracker-db-manager.c	Fri Jun 20 15:18:04 2008
@@ -2036,6 +2036,7 @@
 {
 	TrackerDBInterface *iface;
 	gboolean            create;
+	guint               i;
 
 	iface = db_interface_get (TRACKER_DB_XESAM, &create);
 
@@ -2062,6 +2063,20 @@
 		tracker_db_interface_end_transaction (iface);
 	}
 
+	/* Xesam's DB connection depends on all interfaces being attached. 
+	 * The current initialization code does not guarantee that all are
+	 * at this point indeed already attached. */
+
+	for (i = 0; i < G_N_ELEMENTS (dbs); i++) {
+		gboolean            dummy;
+		TrackerDBInterface *dependency_iface;
+
+		dependency_iface = db_interface_get (dbs[i].db, &dummy);
+		g_object_unref (dependency_iface);
+		/* If it was not yet created, we have a problem */
+		g_assert (!dummy);
+	}
+
 	/* Load static xesam data */
 	db_get_static_xesam_data (attach_iface);
 



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