[tracker] Remove unused cache database



commit fa42d3463652f450bb5af53ce2e4ee8f9eb61a58
Author: Jürg Billeter <j bitron ch>
Date:   Wed Apr 15 15:35:29 2009 +0200

    Remove unused cache database
---
 data/db/Makefile.am                    |    1 -
 data/db/sqlite-cache.sql               |   70 --------------------------------
 data/db/sqlite-stored-procs.sql        |   26 ------------
 src/libtracker-db/tracker-db-manager.c |   65 ++---------------------------
 src/libtracker-db/tracker-db-manager.h |    1 -
 src/tracker-indexer/tracker-indexer.c  |    4 --
 6 files changed, 4 insertions(+), 163 deletions(-)

diff --git a/data/db/Makefile.am b/data/db/Makefile.am
index bd57b2f..fe56065 100644
--- a/data/db/Makefile.am
+++ b/data/db/Makefile.am
@@ -3,7 +3,6 @@ include $(top_srcdir)/Makefile.decl
 configdir = $(datadir)/tracker
 
 config_DATA =				\
-	sqlite-cache.sql 		\
 	sqlite-contents.sql		\
 	sqlite-email.sql		\
 	sqlite-metadata.sql 		\
diff --git a/data/db/sqlite-cache.sql b/data/db/sqlite-cache.sql
deleted file mode 100644
index 6777806..0000000
--- a/data/db/sqlite-cache.sql
+++ /dev/null
@@ -1,70 +0,0 @@
-CREATE TABLE SearchResults1
-(
-	SID		Integer primary key not null,
-	Score		Integer
-);
-
-
-CREATE TABLE SearchResults2
-(
-	SID		Integer primary key not null,
-	Score		Integer
-);
-
-
-/* table for files waiting to be processed */
-CREATE TABLE  FilePending
-(
-	ID			Integer primary key AUTOINCREMENT not null,
-	FileID 			Integer default 0,
-	Action			Integer default 0,
-	PendingDate		Integer,
-	FileUri			Text  not null,
-	MimeType		Text ,
-	IsDir			Integer default 0,
-	IsNew			Integer default 0,
-	RefreshEmbedded		Integer default 0,
-	RefreshContents		Integer default 0,	
-	ServiceTypeID		Integer default 0
-);
-
-
-/* temp tables */
-CREATE TABLE  FileTemp
-(
-	ID			Integer primary key not null,
-	FileID 			Integer default 0,
-	Action			Integer default 0,
-	FileUri			Text  not null,
-	MimeType		Text ,
-	IsDir			Integer default 0,
-	IsNew			Integer default 0,
-	RefreshEmbedded		Integer default 0,
-	RefreshContents		Integer default 0,	
-	ServiceTypeID		Integer default 0
-);
-
-CREATE TABLE  MetadataTemp
-(
-	ID			Integer primary key not null,
-	FileID 			Integer default 0,
-	Action			Integer default 0,
-	FileUri			Text  not null,
-	MimeType		Text ,
-	IsDir			Integer default 0,
-	IsNew			Integer default 0,
-	RefreshEmbedded		Integer default 0,
-	RefreshContents		Integer default 0,	
-	ServiceTypeID		Integer default 0
-);
-
-
-CREATE TABLE  FileWatches
-(
-	WatchID 	Integer not null, 
-	URI 		Text not null,  
-
-	primary key (WatchID), 
-	unique (URI)
-);
-
diff --git a/data/db/sqlite-stored-procs.sql b/data/db/sqlite-stored-procs.sql
index 6b97bd9..0d2be7f 100644
--- a/data/db/sqlite-stored-procs.sql
+++ b/data/db/sqlite-stored-procs.sql
@@ -90,32 +90,6 @@ InsertServiceType              REPLACE INTO ServiceTypes (TypeName) VALUES (?);
 GetMimeForServiceId            SELECT Mime FROM FileMimes WHERE ServiceTypeId = ?;
 GetMimePrefixForServiceId      SELECT MimePrefix FROM FileMimePrefixes WHERE ServiceTypeId = ?;
 
-/* 
- * Pending files queries - currently unused 
- */
-ExistsPendingFiles             SELECT count (*) FROM FilePending WHERE Action <> 20;
-InsertPendingFile              INSERT INTO FilePending (FileID, Action, PendingDate, FileUri, MimeType, IsDir, IsNew, RefreshEmbedded, RefreshContents, ServiceTypeID) VALUES (?,?,?,?,?,?,?,?,?,?);
-CountPendingMetadataFiles      SELECT count (*) FROM FilePending WHERE Action = 20;
-SelectPendingByUri             SELECT FileID, FileUri, Action, MimeType, IsDir, IsNew, RefreshEmbedded, RefreshContents, ServiceTypeID FROM FilePending WHERE FileUri = ?;
-UpdatePendingFile              UPDATE FilePending SET PendingDate = ?, Action = ? WHERE FileUri = ?;
-DeletePendingFile              DELETE FROM FilePending WHERE FileUri = ?;
-
-/* 
- * Watch queries - currently unused
- */
-GetWatchUri                    SELECT URI FROM FileWatches WHERE WatchID = ?;
-GetWatchID                     SELECT WatchID FROM FileWatches WHERE URI = ?;
-GetSubWatches                  SELECT WatchID FROM FileWatches WHERE URI glob ?;
-DeleteWatch                    DELETE FROM FileWatches WHERE URI = ?;
-DeleteSubWatches               DELETE FROM FileWatches WHERE URI glob ?;
-InsertWatch                    INSERT INTO FileWatches (URI, WatchID) VALUES (?,?);
-
-/*
- * Search result queries
- */
-InsertSearchResult1            INSERT INTO SearchResults1 (SID, Score) VALUES (?,?);
-DeleteSearchResults1           DELETE FROM SearchResults1;
-
 /*
  * Statistics queries
  */
diff --git a/src/libtracker-db/tracker-db-manager.c b/src/libtracker-db/tracker-db-manager.c
index 259803e..d597fc5 100644
--- a/src/libtracker-db/tracker-db-manager.c
+++ b/src/libtracker-db/tracker-db-manager.c
@@ -110,18 +110,6 @@ static TrackerDBDefinition dbs[] = {
 	  FALSE,
 	  FALSE,
  	  0 },
-	{ TRACKER_DB_CACHE,
-	  TRACKER_DB_LOCATION_SYS_TMP_DIR,
-	  NULL,
-	  "cache.db",
-	  "cache",
-	  NULL,
-	  128,
-	  TRACKER_DB_PAGE_SIZE_DONT_SET,
-	  FALSE,
-	  FALSE,
-	  FALSE,
- 	  0 },
 	{ TRACKER_DB_FILE_METADATA,
 	  TRACKER_DB_LOCATION_DATA_DIR,
 	  NULL,
@@ -1599,23 +1587,6 @@ db_interface_get_common (void)
 }
 
 static TrackerDBInterface *
-db_interface_get_cache (void)
-{
-	TrackerDBInterface *iface;
-	gboolean	    create;
-
-	iface = db_interface_get (TRACKER_DB_CACHE, &create);
-
-	if (create) {
-		tracker_db_interface_start_transaction (iface);
-		load_sql_file (iface, "sqlite-cache.sql", NULL);
-		tracker_db_interface_end_transaction (iface);
-	}
-
-	return iface;
-}
-
-static TrackerDBInterface *
 db_interface_get_file_metadata (void)
 {
 	TrackerDBInterface *iface;
@@ -1751,9 +1722,6 @@ db_interface_create (TrackerDB db)
 	case TRACKER_DB_COMMON:
 		return db_interface_get_common ();
 
-	case TRACKER_DB_CACHE:
-		return db_interface_get_cache ();
-
 	case TRACKER_DB_FILE_METADATA:
 		return db_interface_get_file_metadata ();
 		
@@ -1888,9 +1856,6 @@ tracker_db_get_type (void)
 			{ TRACKER_DB_COMMON,
 			  "TRACKER_DB_COMMON",
 			  "common" },
-			{ TRACKER_DB_CACHE,
-			  "TRACKER_DB_CACHE",
-			  "cache" },
 			{ TRACKER_DB_FILE_METADATA,
 			  "TRACKER_DB_FILE_METADATA",
 			  "file metadata" },
@@ -2042,14 +2007,6 @@ tracker_db_manager_init (TrackerDBManagerFlags	flags,
 			dbs[i].cache_size /= 2;
 		}
 
-		/* Check we have each database in place, if one is
-		 * missing, we reindex, except the cache which we
-		 * expect to be replaced on each startup.
-		 */
-		if (i == TRACKER_DB_CACHE) {
-			continue;
-		}
-
 		/* No need to check for other files not existing (for
 		 * reindex) if one is already missing.
 		 */
@@ -2127,16 +2084,6 @@ tracker_db_manager_init (TrackerDBManagerFlags	flags,
 			dbs[i].iface = NULL;
 		}
 	} else {
-		/* Make sure we remove and recreate the cache directory in tmp
-		 * each time we start up, this is meant to be a per-run
-		 * thing.
-		 */
-		if (flags & TRACKER_DB_MANAGER_REMOVE_CACHE) {
-			g_message ("Removing cache database:'%s'",
-				   dbs[TRACKER_DB_CACHE].abs_filename);
-			g_unlink (dbs[TRACKER_DB_CACHE].abs_filename);
-		}
-
 		/* Make sure we initialize all other modules we depend on */
 		tracker_ontology_init ();
 	}
@@ -2389,11 +2336,10 @@ tracker_db_manager_get_db_interface_by_service (const gchar *service)
 	switch (type) {
 	case TRACKER_DB_TYPE_EMAIL:
 		if (!email_iface) {
-			email_iface = tracker_db_manager_get_db_interfaces (4,
+			email_iface = tracker_db_manager_get_db_interfaces (3,
 									    TRACKER_DB_COMMON,
 									    TRACKER_DB_EMAIL_CONTENTS,
-									    TRACKER_DB_EMAIL_METADATA,
-									    TRACKER_DB_CACHE);
+									    TRACKER_DB_EMAIL_METADATA);
 		}
 
 		iface = email_iface;
@@ -2404,7 +2350,6 @@ tracker_db_manager_get_db_interface_by_service (const gchar *service)
 	case TRACKER_DB_TYPE_INDEX:
 	case TRACKER_DB_TYPE_COMMON:
 	case TRACKER_DB_TYPE_CONTENT:
-	case TRACKER_DB_TYPE_CACHE:
 	case TRACKER_DB_TYPE_USER:
 		g_warning ("Defaulting to Files DB. Strange DB Type for service '%s'", 
 			   service);
@@ -2412,11 +2357,10 @@ tracker_db_manager_get_db_interface_by_service (const gchar *service)
 	case TRACKER_DB_TYPE_FILES:
 	default:
 		if (!file_iface) {
-			file_iface = tracker_db_manager_get_db_interfaces (4,
+			file_iface = tracker_db_manager_get_db_interfaces (3,
 									   TRACKER_DB_COMMON,
 									   TRACKER_DB_FILE_CONTENTS,
-									   TRACKER_DB_FILE_METADATA,
-									   TRACKER_DB_CACHE);
+									   TRACKER_DB_FILE_METADATA);
 		}
 
 		iface = file_iface;
@@ -2460,7 +2404,6 @@ tracker_db_manager_get_db_interface_by_type (const gchar	  *service,
 	case TRACKER_DB_TYPE_INDEX:
 	case TRACKER_DB_TYPE_COMMON:
 	case TRACKER_DB_TYPE_CONTENT:
-	case TRACKER_DB_TYPE_CACHE:
 	case TRACKER_DB_TYPE_USER:
 	default:
 		g_warning ("Database type not supported");
diff --git a/src/libtracker-db/tracker-db-manager.h b/src/libtracker-db/tracker-db-manager.h
index 2622910..7a8df32 100644
--- a/src/libtracker-db/tracker-db-manager.h
+++ b/src/libtracker-db/tracker-db-manager.h
@@ -32,7 +32,6 @@ G_BEGIN_DECLS
 typedef enum {
 	TRACKER_DB_UNKNOWN,
 	TRACKER_DB_COMMON,
-	TRACKER_DB_CACHE,
 	TRACKER_DB_FILE_METADATA,
 	TRACKER_DB_FILE_CONTENTS,
 	TRACKER_DB_FILE_FULLTEXT,
diff --git a/src/tracker-indexer/tracker-indexer.c b/src/tracker-indexer/tracker-indexer.c
index f6d0812..9eee385 100644
--- a/src/tracker-indexer/tracker-indexer.c
+++ b/src/tracker-indexer/tracker-indexer.c
@@ -127,7 +127,6 @@ struct TrackerIndexerPrivate {
 	TrackerDBInterface *email_metadata;
 	TrackerDBInterface *email_contents;
 	TrackerDBInterface *common;
-	TrackerDBInterface *cache;
 
 	TrackerConfig *config;
 	TrackerLanguage *language;
@@ -277,7 +276,6 @@ start_transaction (TrackerIndexer *indexer)
 
 	indexer->private->in_transaction = TRUE;
 
-	tracker_db_interface_start_transaction (indexer->private->cache);
 	tracker_db_interface_start_transaction (indexer->private->file_contents);
 	tracker_db_interface_start_transaction (indexer->private->email_contents);
 	tracker_db_interface_start_transaction (indexer->private->file_metadata);
@@ -297,7 +295,6 @@ stop_transaction (TrackerIndexer *indexer)
 	tracker_db_interface_end_transaction (indexer->private->file_metadata);
 	tracker_db_interface_end_transaction (indexer->private->email_contents);
 	tracker_db_interface_end_transaction (indexer->private->file_contents);
-	tracker_db_interface_end_transaction (indexer->private->cache);
 
 	indexer->private->in_transaction = FALSE;
 
@@ -1082,7 +1079,6 @@ tracker_indexer_init (TrackerIndexer *indexer)
 	 * interfaces as singletons, it's safe to just ask it
 	 * again for an interface.
 	 */
-	priv->cache = tracker_db_manager_get_db_interface (TRACKER_DB_CACHE);
 	priv->common = tracker_db_manager_get_db_interface (TRACKER_DB_COMMON);
 	priv->file_metadata = tracker_db_manager_get_db_interface (TRACKER_DB_FILE_METADATA);
 	priv->file_contents = tracker_db_manager_get_db_interface (TRACKER_DB_FILE_CONTENTS);



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