diff --git a/src/configure.ac b/src/configure.ac index e584b380..0d147322 100644 --- a/src/configure.ac +++ b/src/configure.ac @@ -163,9 +163,10 @@ if test X$withFam != Xno ; then fi fi -# Enable use of file extended attributes. -# Not by default as extended attributes are little used for now, and -# looking for them is not completely trivial +# Enable use of file extended attributes. Not by default as extended +# attributes are little used for now, and looking for them is not +# completely trivial: we have to use ctime instead of mtime to detect +# changes. AC_ARG_ENABLE(xattr, AC_HELP_STRING([--enable-xattr], [Enable fetching metadata from file extended attributes. This is only diff --git a/src/rcldb/rcldb.cpp b/src/rcldb/rcldb.cpp index c19999ea..cce8f2a8 100644 --- a/src/rcldb/rcldb.cpp +++ b/src/rcldb/rcldb.cpp @@ -500,11 +500,10 @@ bool Db::i_close(bool final) if (!m_ndb->m_noversionwrite) m_ndb->xwdb.set_metadata(cstr_RCL_IDX_VERSION_KEY, cstr_RCL_IDX_VERSION); LOGDEB(("Rcl::Db:close: xapian will close. May take some time\n")); - } #ifdef IDX_THREADS - waitUpdIdle(); + waitUpdIdle(); #endif - // Used to do a flush here. Cant see why it should be necessary. + } deleteZ(m_ndb); if (w) LOGDEB(("Rcl::Db:close() xapian close done.\n")); @@ -1490,9 +1489,8 @@ bool Db::purge() bool Db::docExists(const string& uniterm) { #ifdef IDX_THREADS - // If we're not running our own (single) thread, need to protect - // read db against multiaccess (e.g. from needUpdate(), or this method). - PTMutexLocker lock(m_ndb->m_mutex, m_ndb->m_havewriteq); + // Need to protect read db against multiaccess. + PTMutexLocker lock(m_ndb->m_mutex); #endif string ermsg; @@ -1543,10 +1541,11 @@ bool Db::purgeFile(const string &udi, bool *existed) bool Db::purgeFileWrite(const string& udi, const string& uniterm) { #if defined(IDX_THREADS) - // If we have a write queue we're called from there, and single - // threaded, no locking. Else need to mutex other threads from - // above - PTMutexLocker lock(m_ndb->m_mutex, m_ndb->m_havewriteq); + // We need a mutex even if we have a write queue (so we can only + // be called by a single thread) to protect about multiple acces + // to xrdb from subDocs() which is also called from needupdate() + // (called from outside the write thread ! + PTMutexLocker lock(m_ndb->m_mutex); #endif // IDX_THREADS Xapian::WritableDatabase db = m_ndb->xwdb; diff --git a/src/rcldb/rcldb.h b/src/rcldb/rcldb.h index 94f87d54..8cb39212 100644 --- a/src/rcldb/rcldb.h +++ b/src/rcldb/rcldb.h @@ -368,7 +368,6 @@ class Db { /* This has to be public for access by embedded Query::Native */ Native *m_ndb; - bool purgeFileWrite(const string& udi, const string& uniterm); private: const RclConfig *m_config; string m_reason; // Error explanation @@ -379,8 +378,6 @@ private: // File existence vector: this is filled during the indexing pass. Any // document whose bit is not set at the end is purged vector updated; - // Stop terms: those don't get indexed. - StopList m_stops; // Text bytes indexed since beginning long long m_curtxtsz; // Text bytes at last flush @@ -393,6 +390,8 @@ private: /*************** * Parameters cached out of the configuration files. Logically const * after init */ + // Stop terms: those don't get indexed. + StopList m_stops; // This is how long an abstract we keep or build from beginning of // text when indexing. It only has an influence on the size of the // db as we are free to shorten it again when displaying @@ -416,6 +415,11 @@ private: static bool o_inPlaceReset; /******* End logical constnesss */ +#ifdef IDX_THREADS + friend void *DbUpdWorker(void*); +#endif // IDX_THREADS + bool purgeFileWrite(const string& udi, const string& uniterm); + // Internal form of close, can be called during destruction bool i_close(bool final); // Reinitialize when adding/removing additional dbs