[tracker/tracker-0.10] tracker-writeback: Remove IgnoreNextUpdate and file locking from writeback



commit 6a83ca7fda1a4851f377ed41c8d023c69d527b1b
Author: Philip Van Hoof <philip codeminded be>
Date:   Tue Jul 19 15:54:08 2011 +0200

    tracker-writeback: Remove IgnoreNextUpdate and file locking from writeback

 src/tracker-writeback/tracker-writeback-file.c |   75 ------------------------
 1 files changed, 0 insertions(+), 75 deletions(-)
---
diff --git a/src/tracker-writeback/tracker-writeback-file.c b/src/tracker-writeback/tracker-writeback-file.c
index a837ed9..3ada83f 100644
--- a/src/tracker-writeback/tracker-writeback-file.c
+++ b/src/tracker-writeback/tracker-writeback-file.c
@@ -47,23 +47,6 @@ tracker_writeback_file_init (TrackerWritebackFile *writeback_file)
 {
 }
 
-static gboolean
-file_unlock_cb (gpointer user_data)
-{
-	GFile *file;
-	gchar *path;
-
-	file = user_data;
-	path = g_file_get_path (file);
-	g_message ("Unlocking file '%s'", path);
-	g_free (path);
-
-	tracker_file_unlock (file);
-	g_object_unref (file);
-
-	return FALSE;
-}
-
 static GFile *
 create_temporary_file (GFile     *file,
                        GFileInfo *file_info)
@@ -142,7 +125,6 @@ tracker_writeback_file_update_metadata (TrackerWriteback        *writeback,
 	gboolean retval;
 	GFile *file, *tmp_file;
 	GFileInfo *file_info;
-	const gchar *urls[2] = { NULL, NULL };
 	GStrv row;
 	const gchar * const *content_types;
 	const gchar *mime_type;
@@ -200,68 +182,11 @@ tracker_writeback_file_update_metadata (TrackerWriteback        *writeback,
 	g_object_unref (file_info);
 
 	if (retval) {
-		g_message ("Locking file '%s' in order to write metadata", row[0]);
-
-		tracker_file_lock (file);
-
-		urls[0] = row[0];
-
-#warning Remove this after the queues are properly integrated and this isnt needed anymore
-
-		tracker_miner_manager_ignore_next_update (tracker_writeback_get_miner_manager (),
-		                                          "org.freedesktop.Tracker1.Miner.Files",
-		                                          urls);
-
-		/* A note on IgnoreNextUpdate + Writeback. Consider this situation
-		 * I see with an application recording a video:
-		 *  - Application creates a resource for a video in the store and
-		 *    sets slo:location
-		 *  - Application starts writting the new video file.
-		 *  - Store tells writeback to write the new slo:location in the file
-		 *  - Writeback reaches this exact function and sends IgnoreNextUpdate,
-		 *    then tries to update metadata.
-		 *  - Miner-fs gets the IgnoreNextUpdate (sent by the line above).
-		 *  - Application is still recording the video, which gets translated
-		 *    into an original CREATED event plus multiple UPDATE events which
-		 *    are being merged at tracker-monitor level, still not notified to
-		 *    TrackerMinerFS.
-		 *  - TrackerWriteback tries to updte file metadata (line below) but cannot
-		 *    do it yet as application is still updating the file, thus, the real
-		 *    metadata update gets delayed until the application ends writing
-		 *    the video.
-		 *  - Application ends writing the video.
-		 *  - Now TrackerWriteback really updates the file. This happened N seconds
-		 *    after we sent the IgnoreNextUpdate, being N the length of the video...
-		 *  - TrackerMonitor sends the merged CREATED event to TrackerMinerFS,
-		 *    detects the IgnoreNextUpdate request and in this case we ignore the
-		 *    IgnoreNextUpdate request as this is a CREATED event.
-		 *
-		 * Need to review the whole writeback+IgnoreNextUpdate mechanism to cope
-		 * with situations like the one above.
-		 */
-
 		retval = (writeback_file_class->update_file_metadata) (TRACKER_WRITEBACK_FILE (writeback),
 		                                                       tmp_file,
 		                                                       values,
 		                                                       connection,
 		                                                       cancellable);
-
-		/*
-		 * This timeout value was 3s before, which could have been in
-		 * order to have miner-fs skip the updates we just made, something
-		 * along the purpose of IgnoreNextUpdate.
-		 *
-		 * But this is a problem when the event being ignored is a CREATED
-		 * event. This is, tracker-writeback modifies a file that was just
-		 * created. If we ignore this in the miner-fs, it will never index
-		 * it, and that is not good. As there is already the
-		 * IgnoreNextUpdate mechanism in place, I'm moving this timeout
-		 * value to 1s. So, once writeback has written the file, only 1s
-		 * after will unlock it. This synchronizes well with the 2s timeout
-		 * in the miner-fs between detecting the file update and the actual
-		 * processing.
-		 */
-		g_timeout_add_seconds (1, file_unlock_cb, g_object_ref (file));
 	}
 
 	/* Move back the modified file to the original location */



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