Commit ee2ae04b authored by Carlos Garnacho's avatar Carlos Garnacho Committed by Carlos Garnacho

Pass also the amount of processed items over to trackerd, use this number

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.

svn path=/trunk/; revision=2892
parent 0908150c
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.
2009-02-06 Carlos Garnacho <carlos@imendio.com>
* src/tracker-indexer/tracker-indexer.c (item_remove): Add a boolean
......
......@@ -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">
......
......@@ -143,6 +143,7 @@ struct TrackerIndexerPrivate {
guint items_indexed;
guint items_processed;
guint items_to_index;
guint subelements_processed;
gboolean in_transaction;
......@@ -207,8 +208,7 @@ static void state_check (TrackerIndexer *indexer);
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 @@ signal_status (TrackerIndexer *indexer,
}
}
if (indexer->private->items_indexed > 0 &&
if (indexer->private->items_processed > 0 &&
items_remaining > 0) {
gchar *str1;
gchar *str2;
......@@ -323,9 +323,10 @@ signal_status (TrackerIndexer *indexer,
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 @@ signal_status (TrackerIndexer *indexer,
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 @@ flush_data (TrackerIndexer *indexer)
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 @@ tracker_indexer_class_init (TrackerIndexerClass *class)
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 @@ tracker_indexer_class_init (TrackerIndexerClass *class)
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 @@ check_stopped (TrackerIndexer *indexer,
/* 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 @@ item_move (TrackerIndexer *indexer,
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 @@ static void
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 @@ item_remove (TrackerIndexer *indexer,
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 @@ item_remove (TrackerIndexer *indexer,
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 @@ process_file (TrackerIndexer *indexer,
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 @@ process_file (TrackerIndexer *indexer,
g_free (basename);
g_free (path);
return TRUE;
}
}
......@@ -2358,16 +2364,13 @@ process_file (TrackerIndexer *indexer,
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 @@ process_func (gpointer data)
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);
}
......
......@@ -59,6 +59,7 @@ struct TrackerIndexerClass {
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 @@ struct TrackerIndexerClass {
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);
......
VOID:DOUBLE,UINT,BOOL
VOID:DOUBLE,STRING,UINT,UINT
VOID:DOUBLE,UINT,UINT,BOOL
VOID:DOUBLE,STRING,UINT,UINT,UINT
......@@ -463,17 +463,19 @@ tracker_dbus_indexer_get_proxy (void)
}
/* 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 @@ tracker_dbus_indexer_get_proxy (void)
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 @@ tracker_dbus_indexer_get_proxy (void)
"Finished",
G_TYPE_DOUBLE,
G_TYPE_UINT,
G_TYPE_UINT,
G_TYPE_BOOLEAN,
G_TYPE_INVALID);
dbus_g_proxy_add_signal (proxy_for_indexer,
......
......@@ -14,5 +14,5 @@ VOID:STRING,BOXED
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
......@@ -116,12 +116,14 @@ static void process_module_next (TrackerProcessor *processor);
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 @@ 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)
{
......@@ -1089,7 +1092,7 @@ indexer_status_cb (DBusGProxy *proxy,
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 @@ indexer_status_cb (DBusGProxy *proxy,
"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 @@ indexer_status_cb (DBusGProxy *proxy,
/* 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 @@ indexer_status_cb (DBusGProxy *proxy,
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 @@ indexer_finished_cb (DBusGProxy *proxy,
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 @@ indexer_finished_cb (DBusGProxy *proxy,
"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 @@ indexer_finished_cb (DBusGProxy *proxy,
/* 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 ? */
......
......@@ -46,7 +46,8 @@ 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)
{
......@@ -67,7 +68,8 @@ indexer_started_cb (DBusGProxy *proxy,
static void
indexer_finished_cb (DBusGProxy *proxy,
gdouble seconds_elapsed,
guint items_done,
guint items_processed,
guint items_indexed,
gboolean interrupted,
gpointer user_data)
{
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment