tracker r2139 - in branches/indexer-split: . src/libtracker-db



Author: mr
Date: Fri Aug 22 09:25:18 2008
New Revision: 2139
URL: http://svn.gnome.org/viewvc/tracker?rev=2139&view=rev

Log:
	* src/libtracker-db/tracker-db-index.c: (tracker_db_index_open),
	(tracker_db_index_flush): Fixed the g_return_val_if_fail() check
	for the priv->index already being set in tracker_db_index_open().
	Initially it is not set at all so the index was not being opened.
	Also, if we can't open the index, we now debug specifically if it
	was because the file doesn't exist yet or if it wasn't closed
	properly.


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

Modified: branches/indexer-split/src/libtracker-db/tracker-db-index.c
==============================================================================
--- branches/indexer-split/src/libtracker-db/tracker-db-index.c	(original)
+++ branches/indexer-split/src/libtracker-db/tracker-db-index.c	Fri Aug 22 09:25:18 2008
@@ -741,7 +741,7 @@
 	priv = TRACKER_DB_INDEX_GET_PRIVATE (index);
 
 	g_return_val_if_fail (priv->filename != NULL, FALSE);
-	g_return_val_if_fail (priv->index != NULL, FALSE);
+	g_return_val_if_fail (priv->index == NULL, FALSE);
 
 	g_mutex_lock (priv->mutex);
 
@@ -760,11 +760,14 @@
 			      priv->max_bucket);
 
 	if (!priv->index) {
-		g_debug ("Index doesnt exists or was not closed properly, index:'%s', %s",
-			 priv->filename,
-			 dperrmsg (dpecode));
+		if (!g_file_test (priv->filename, G_FILE_TEST_EXISTS)) {
+			g_debug ("Index doesnt exists yet:'%s'",
+				 priv->filename);
+		} else {
+			g_debug ("Index was not closed properly:'%s', %s",
+				 priv->filename,
+				 dperrmsg (dpecode));
 
-		if (g_file_test (priv->filename, G_FILE_TEST_EXISTS)) {
 			if (dprepair (priv->filename)) {
 				priv->index = dpopen (priv->filename,
 						      flags,
@@ -844,7 +847,8 @@
 	if (!priv->index) {
 		g_debug ("Index was not open for flush, waiting...");
 		g_mutex_unlock (priv->mutex);
-		return;
+
+		return 0;
 	}
 
 	size = g_hash_table_size (priv->cache);



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