tracker r2892 - in trunk: . data/dbus src/tracker-indexer src/trackerd



Author: carlosg
Date: Fri Feb  6 17:19:36 2009
New Revision: 2892
URL: http://svn.gnome.org/viewvc/tracker?rev=2892&view=rev

Log:
2009-02-06  Carlos Garnacho  <carlos imendio com>

        Pass also the amount of processed items over to trackerd, use this
        number in the IndexProgress DBus signal to improve feedback, this also
        fixes the bug where the total items was being reduced down to 0.

        * data/dbus/tracker-indexer.xml: Include processed items count in both
        Status and Finished signals.
        * src/tracker-indexer/tracker-marshal.list:
        * src/tracker-indexer/tracker-indexer.[ch]: include processed items
        count in ::status and ::finished. Also increase the processed items
        count when an item is being skipped.

        * src/trackerd/tracker-marshal.list:
        * src/trackerd/tracker-dbus.c:
        * src/trackerd/tracker-processor.c:
        * src/trackerd/tracker-xesam-manager.c: Adapt to tracker-indexers DBus
        API change. Report processed items count in IndexProgress.

Modified:
   trunk/ChangeLog
   trunk/data/dbus/tracker-indexer.xml
   trunk/src/tracker-indexer/tracker-indexer.c
   trunk/src/tracker-indexer/tracker-indexer.h
   trunk/src/tracker-indexer/tracker-marshal.list
   trunk/src/trackerd/tracker-dbus.c
   trunk/src/trackerd/tracker-marshal.list
   trunk/src/trackerd/tracker-processor.c
   trunk/src/trackerd/tracker-xesam-manager.c

Modified: trunk/data/dbus/tracker-indexer.xml
==============================================================================
--- trunk/data/dbus/tracker-indexer.xml	(original)
+++ trunk/data/dbus/tracker-indexer.xml	Fri Feb  6 17:19:36 2009
@@ -83,7 +83,8 @@
     <signal name="Status">
       <arg type="d" name="elapsed_time" />
       <arg type="s" name="current_module_name" />
-      <arg type="u" name="items_done" />
+      <arg type="u" name="items_processed" />
+      <arg type="u" name="items_indexed" />
       <arg type="u" name="items_remaining" />
     </signal>
     <signal name="Started" />
@@ -93,7 +94,8 @@
     <signal name="Continued" />
     <signal name="Finished">
       <arg type="d" name="elapsed_time" />
-      <arg type="u" name="items_done" />
+      <arg type="u" name="items_processed" />
+      <arg type="u" name="items_indexed" />
       <arg type="b" name="interrupted" />
     </signal>
     <signal name="ModuleStarted">

Modified: trunk/src/tracker-indexer/tracker-indexer.c
==============================================================================
--- trunk/src/tracker-indexer/tracker-indexer.c	(original)
+++ trunk/src/tracker-indexer/tracker-indexer.c	Fri Feb  6 17:19:36 2009
@@ -143,6 +143,7 @@
 
 	guint items_indexed;
 	guint items_processed;
+	guint items_to_index;
 	guint subelements_processed;
 
 	gboolean in_transaction;
@@ -207,8 +208,7 @@
 static void     item_remove            (TrackerIndexer      *indexer,
 					PathInfo	    *info,
 					const gchar         *dirname,
-					const gchar         *basename,
-					gboolean             recurse);
+					const gchar         *basename);
 
 
 static guint signals[LAST_SIGNAL] = { 0, };
@@ -312,7 +312,7 @@
 		}
 	}
 
-	if (indexer->private->items_indexed > 0 &&
+	if (indexer->private->items_processed > 0 &&
 	    items_remaining > 0) {
 		gchar *str1;
 		gchar *str2;
@@ -323,9 +323,10 @@
 							   items_remaining);
 		str2 = tracker_seconds_to_string (seconds_elapsed, TRUE);
 
-		g_message ("Indexed %d/%d, module:'%s', %s left, %s elapsed (%s)",
+		g_message ("Processed %d/%d, indexed %d, module:'%s', %s left, %s elapsed (%s)",
+			   indexer->private->items_processed,
+			   indexer->private->items_processed + items_remaining,
 			   indexer->private->items_indexed,
-			   indexer->private->items_indexed + items_remaining,
 			   g_quark_to_string (indexer->private->current_module),
 			   str1,
 			   str2,
@@ -338,6 +339,7 @@
 	g_signal_emit (indexer, signals[STATUS], 0,
 		       seconds_elapsed,
 		       g_quark_to_string (indexer->private->current_module),
+		       indexer->private->items_processed,
 		       indexer->private->items_indexed,
 		       items_remaining);
 }
@@ -357,8 +359,8 @@
 	tracker_db_index_flush (indexer->private->email_index);
 	signal_status (indexer, "flush");
 
-	indexer->private->items_indexed += indexer->private->items_processed;
-	indexer->private->items_processed = 0;
+	indexer->private->items_indexed += indexer->private->items_to_index;
+	indexer->private->items_to_index = 0;
 
 	state_unset_flags (indexer, TRACKER_INDEXER_STATE_FLUSHING);
 
@@ -596,12 +598,13 @@
 			      G_SIGNAL_RUN_LAST,
 			      G_STRUCT_OFFSET (TrackerIndexerClass, status),
 			      NULL, NULL,
-			      tracker_marshal_VOID__DOUBLE_STRING_UINT_UINT,
+			      tracker_marshal_VOID__DOUBLE_STRING_UINT_UINT_UINT,
 			      G_TYPE_NONE,
-			      4,
+			      5,
 			      G_TYPE_DOUBLE,
 			      G_TYPE_STRING,
 			      G_TYPE_UINT,
+			      G_TYPE_UINT,
 			      G_TYPE_UINT);
 	signals[STARTED] =
 		g_signal_new ("started",
@@ -636,11 +639,12 @@
 			      G_SIGNAL_RUN_LAST,
 			      G_STRUCT_OFFSET (TrackerIndexerClass, finished),
 			      NULL, NULL,
-			      tracker_marshal_VOID__DOUBLE_UINT_BOOL,
+			      tracker_marshal_VOID__DOUBLE_UINT_UINT_BOOL,
 			      G_TYPE_NONE,
-			      3,
+			      4,
 			      G_TYPE_DOUBLE,
 			      G_TYPE_UINT,
+			      G_TYPE_UINT,
 			      G_TYPE_BOOLEAN);
 	signals[MODULE_STARTED] =
 		g_signal_new ("module-started",
@@ -720,14 +724,16 @@
 	/* Print out how long it took us */
 	str = tracker_seconds_to_string (seconds_elapsed, FALSE);
 
-	g_message ("Indexer finished in %s, %d items indexed in total",
+	g_message ("Indexer finished in %s, %d items processed in total (%d indexed)",
 		   str,
+		   indexer->private->items_processed,
 		   indexer->private->items_indexed);
 	g_free (str);
 
 	/* Finally signal done */
 	g_signal_emit (indexer, signals[FINISHED], 0,
 		       seconds_elapsed,
+		       indexer->private->items_processed,
 		       indexer->private->items_indexed,
 		       interrupted);
 }
@@ -1769,7 +1775,7 @@
 		g_message ("Destination file '%s' already existed in database, removing", path);
 
 		tracker_file_get_path_and_name (path, &dest_dirname, &dest_basename);
-		item_remove (indexer, info, dest_dirname, dest_basename, TRUE);
+		item_remove (indexer, info, dest_dirname, dest_basename);
 
 		g_free (dest_dirname);
 		g_free (dest_basename);
@@ -1832,8 +1838,7 @@
 item_remove (TrackerIndexer *indexer,
 	     PathInfo	    *info,
 	     const gchar    *dirname,
-	     const gchar    *basename,
-	     gboolean        recurse)
+	     const gchar    *basename)
 {
 	TrackerService *service;
 	TrackerDataMetadata *data_metadata;
@@ -1898,8 +1903,6 @@
 			   path);
 	}
 
-	tracker_data_update_delete_content (service, service_id);
-
 #if 0
 	/* Get content, unindex the words and delete the contents */
 	content = tracker_data_query_content (service, service_id);
@@ -1940,7 +1943,7 @@
 	tracker_data_update_delete_service (service, service_id);
 	tracker_data_update_delete_all_metadata (service, service_id);
 
-	if (recurse && strcmp (service_type, "Folders") == 0) {
+	if (strcmp (service_type, "Folders") == 0) {
 		tracker_data_update_delete_service_recursively (service, path);
 	}
 
@@ -2330,6 +2333,8 @@
 		if (!should_index_file (indexer, info, dirname, basename)) {
 			gchar *path;
 
+			indexer->private->items_processed++;
+
 			path = g_file_get_path (info->file);
 
 			g_debug ("File is already up to date: '%s'", path);
@@ -2338,6 +2343,7 @@
 			g_free (basename);
 			g_free (path);
 
+
 			return TRUE;
 		}
 	}
@@ -2358,16 +2364,13 @@
 			item_add_or_update (indexer, info, dirname, basename, metadata);
 			g_object_unref (metadata);
 		} else {
-			/* Delete events are not atomic, so we don't recurse
-			 * here, since we'll have probably got already events
-			 * from children
-			 */
-			item_remove (indexer, info, dirname, basename, FALSE);
+			item_remove (indexer, info, dirname, basename);
 		}
 	}
 
 	indexer->private->subelements_processed++;
 	indexer->private->items_processed++;
+	indexer->private->items_to_index++;
 
 	g_free (dirname);
 	g_free (basename);
@@ -2541,7 +2544,7 @@
 		g_free (module_name);
 	}
 
-	if (indexer->private->items_processed > TRACKER_INDEXER_TRANSACTION_MAX) {
+	if (indexer->private->items_to_index > TRACKER_INDEXER_TRANSACTION_MAX) {
 		schedule_flush (indexer, TRUE);
 	}
 

Modified: trunk/src/tracker-indexer/tracker-indexer.h
==============================================================================
--- trunk/src/tracker-indexer/tracker-indexer.h	(original)
+++ trunk/src/tracker-indexer/tracker-indexer.h	Fri Feb  6 17:19:36 2009
@@ -59,6 +59,7 @@
 	void (*status)		(TrackerIndexer *indexer,
 				 gdouble	 seconds_elapsed,
 				 const gchar	*current_module_name,
+				 guint           items_processed,
 				 guint		 items_indexed,
 				 guint		 items_remaining);
 	void (*started)		(TrackerIndexer *indexer);
@@ -66,6 +67,7 @@
 	void (*continued)	(TrackerIndexer *indexer);
 	void (*finished)	(TrackerIndexer *indexer,
 				 gdouble	 seconds_elapsed,
+				 guint           items_processed,
 				 guint		 items_indexed);
 	void (*module_started)	(TrackerIndexer *indexer,
 				 const gchar	*module_name);

Modified: trunk/src/tracker-indexer/tracker-marshal.list
==============================================================================
--- trunk/src/tracker-indexer/tracker-marshal.list	(original)
+++ trunk/src/tracker-indexer/tracker-marshal.list	Fri Feb  6 17:19:36 2009
@@ -1,2 +1,2 @@
-VOID:DOUBLE,UINT,BOOL
-VOID:DOUBLE,STRING,UINT,UINT
+VOID:DOUBLE,UINT,UINT,BOOL
+VOID:DOUBLE,STRING,UINT,UINT,UINT

Modified: trunk/src/trackerd/tracker-dbus.c
==============================================================================
--- trunk/src/trackerd/tracker-dbus.c	(original)
+++ trunk/src/trackerd/tracker-dbus.c	Fri Feb  6 17:19:36 2009
@@ -463,17 +463,19 @@
 		}
 
 		/* Add marshallers */
-		dbus_g_object_register_marshaller (tracker_marshal_VOID__DOUBLE_STRING_UINT_UINT,
+		dbus_g_object_register_marshaller (tracker_marshal_VOID__DOUBLE_STRING_UINT_UINT_UINT,
 						   G_TYPE_NONE,
 						   G_TYPE_DOUBLE,
 						   G_TYPE_STRING,
 						   G_TYPE_UINT,
 						   G_TYPE_UINT,
+						   G_TYPE_UINT,
 						   G_TYPE_INVALID);
-		dbus_g_object_register_marshaller (tracker_marshal_VOID__DOUBLE_UINT_BOOL,
+		dbus_g_object_register_marshaller (tracker_marshal_VOID__DOUBLE_UINT_UINT_BOOL,
 						   G_TYPE_NONE,
 						   G_TYPE_DOUBLE,
 						   G_TYPE_UINT,
+						   G_TYPE_UINT,
 						   G_TYPE_BOOLEAN,
 						   G_TYPE_INVALID);
 
@@ -484,6 +486,7 @@
 					 G_TYPE_STRING,
 					 G_TYPE_UINT,
 					 G_TYPE_UINT,
+					 G_TYPE_UINT,
 					 G_TYPE_INVALID);
 		dbus_g_proxy_add_signal (proxy_for_indexer,
 					 "Started",
@@ -499,6 +502,7 @@
 					 "Finished",
 					 G_TYPE_DOUBLE,
 					 G_TYPE_UINT,
+					 G_TYPE_UINT,
 					 G_TYPE_BOOLEAN,
 					 G_TYPE_INVALID);
 		dbus_g_proxy_add_signal (proxy_for_indexer,

Modified: trunk/src/trackerd/tracker-marshal.list
==============================================================================
--- trunk/src/trackerd/tracker-marshal.list	(original)
+++ trunk/src/trackerd/tracker-marshal.list	Fri Feb  6 17:19:36 2009
@@ -14,5 +14,5 @@
 VOID:STRING,UINT
 
 # Indexer signals
-VOID:DOUBLE,UINT,BOOL
-VOID:DOUBLE,STRING,UINT,UINT
+VOID:DOUBLE,UINT,UINT,BOOL
+VOID:DOUBLE,STRING,UINT,UINT,UINT

Modified: trunk/src/trackerd/tracker-processor.c
==============================================================================
--- trunk/src/trackerd/tracker-processor.c	(original)
+++ trunk/src/trackerd/tracker-processor.c	Fri Feb  6 17:19:36 2009
@@ -116,12 +116,14 @@
 static void indexer_status_cb		    (DBusGProxy       *proxy,
 					     gdouble	       seconds_elapsed,
 					     const gchar      *current_module_name,
-					     guint	       items_done,
+					     guint             items_processed,
+					     guint	       items_indexed,
 					     guint	       items_remaining,
 					     gpointer	       user_data);
 static void indexer_finished_cb		    (DBusGProxy       *proxy,
 					     gdouble	       seconds_elapsed,
-					     guint	       items_done,
+					     guint             items_processed,
+					     guint	       items_indexed,
 					     gboolean	       interrupted,
 					     gpointer	       user_data);
 static void monitor_item_created_cb	    (TrackerMonitor   *monitor,
@@ -1074,7 +1076,8 @@
 indexer_status_cb (DBusGProxy  *proxy,
 		   gdouble	seconds_elapsed,
 		   const gchar *current_module_name,
-		   guint	items_done,
+		   guint        items_processed,
+		   guint	items_indexed,
 		   guint	items_remaining,
 		   gpointer	user_data)
 {
@@ -1089,7 +1092,7 @@
 	processor = user_data;
 
 	/* Update our local copy */
-	processor->private->items_done = items_done;
+	processor->private->items_done = items_processed;
 	processor->private->items_remaining = items_remaining;
 	processor->private->seconds_elapsed = seconds_elapsed;
 
@@ -1110,9 +1113,9 @@
 			       "index-progress",
 			       tracker_module_config_get_index_service (current_module_name),
 			       path ? path : "",
-			       items_done,
+			       items_processed,
 			       items_remaining,
-			       items_done + items_remaining,
+			       items_processed + items_remaining,
 			       seconds_elapsed);
 	g_free (path);
 
@@ -1129,13 +1132,14 @@
 	/* Message to the console about state */
 	str1 = tracker_seconds_estimate_to_string (seconds_elapsed,
 						   TRUE,
-						   items_done,
+						   items_processed,
 						   items_remaining);
 	str2 = tracker_seconds_to_string (seconds_elapsed, TRUE);
 
-	g_message ("Indexed %d/%d, module:'%s', %s left, %s elapsed",
-		   items_done,
-		   items_done + items_remaining,
+	g_message ("Processed %d/%d, indexed %d, module:'%s', %s left, %s elapsed",
+		   items_processed,
+		   items_processed + items_remaining,
+		   items_indexed,
 		   current_module_name,
 		   str1,
 		   str2);
@@ -1147,7 +1151,8 @@
 static void
 indexer_finished_cb (DBusGProxy  *proxy,
 		     gdouble	  seconds_elapsed,
-		     guint	  items_done,
+		     guint        items_processed,
+		     guint	  items_indexed,
 		     gboolean	  interrupted,
 		     gpointer	  user_data)
 {
@@ -1159,7 +1164,7 @@
 	processor = user_data;
 	object = tracker_dbus_get_object (TRACKER_TYPE_DAEMON);
 
-	processor->private->items_done = items_done;
+	processor->private->items_done = items_processed;
 	processor->private->items_remaining = 0;
 	processor->private->seconds_elapsed = seconds_elapsed;
 
@@ -1168,9 +1173,9 @@
 			       "index-progress",
 			       "", /* Service */
 			       "", /* Path */
-			       items_done,
+			       items_processed,
 			       0,
-			       items_done,
+			       items_processed,
 			       seconds_elapsed);
 
 	/* Tell the index that it can reload, really we should do
@@ -1186,9 +1191,10 @@
 	/* Message to the console about state */
 	str = tracker_seconds_to_string (seconds_elapsed, FALSE);
 
-	g_message ("Indexer finished in %s, %d items indexed in total",
+	g_message ("Indexer finished in %s, %d items processed in total (%d indexed)",
 		   str,
-		   items_done);
+		   items_processed,
+		   items_indexed);
 	g_free (str);
 
 	/* Do we even need this step Optimizing ? */

Modified: trunk/src/trackerd/tracker-xesam-manager.c
==============================================================================
--- trunk/src/trackerd/tracker-xesam-manager.c	(original)
+++ trunk/src/trackerd/tracker-xesam-manager.c	Fri Feb  6 17:19:36 2009
@@ -46,7 +46,8 @@
 indexer_status_cb (DBusGProxy  *proxy,
 		   gdouble	seconds_elapsed,
 		   const gchar *current_module_name,
-		   guint	items_done,
+		   guint        items_processed,
+		   guint	items_indexed,
 		   guint	items_remaining,
 		   gpointer	user_data)
 {
@@ -67,7 +68,8 @@
 static void
 indexer_finished_cb (DBusGProxy *proxy,
 		     gdouble	 seconds_elapsed,
-		     guint	 items_done,
+		     guint       items_processed,
+		     guint	 items_indexed,
 		     gboolean	 interrupted,
 		     gpointer	 user_data)
 {



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