Delete RCL_USE_XATTR configure/compile time variable, it was not

useful. Add configuration variable to use mtime instead of ctime for update
detection. Useful on a system where xattrs would be modified but not
indexed, to avoid excessive reindexing.
This commit is contained in:
Jean-Francois Dockes
2014-12-09 11:15:17 +01:00
parent 969ffee8e7
commit d630cbbaec
11 changed files with 56 additions and 44 deletions
+9 -11
View File
@@ -47,16 +47,7 @@
#include "execmd.h"
#include "extrameta.h"
// When using extended attributes, we have to use the ctime, because
// this is all that gets set when the attributes are modified.
// As of 1.19 we use ctime in all cases as this allows to detect a
// file renamed into an existing file (e.g. when shifting logs or
// other archives).
#ifdef RCL_USE_XATTR
#define RCL_STTIME st_ctime
#else
#define RCL_STTIME st_ctime
#endif // RCL_USE_XATTR
int FsIndexer::o_tstupdusemtime = -1;
using namespace std;
@@ -119,6 +110,12 @@ FsIndexer::FsIndexer(RclConfig *cnf, Rcl::Db *db, DbIxStatusUpdater *updfunc)
LOGDEB1(("FsIndexer::FsIndexer\n"));
m_havelocalfields = m_config->hasNameAnywhere("localfields");
m_config->getConfParam("detectxattronly", &m_detectxattronly);
if (o_tstupdusemtime == -1) {
bool b(false);
m_config->getConfParam("testmodifusemtime", &b);
o_tstupdusemtime = b ? 1 : 0;
}
#ifdef IDX_THREADS
m_stableconfig = new RclConfig(*m_config);
@@ -499,7 +496,8 @@ void FsIndexer::setlocalfields(const map<string, string>& fields, Rcl::Doc& doc)
void FsIndexer::makesig(const struct stat *stp, string& out)
{
char cbuf[100];
sprintf(cbuf, "%lld" "%ld", (long long)stp->st_size, (long)stp->RCL_STTIME);
sprintf(cbuf, "%lld" "%ld", (long long)stp->st_size,
o_tstupdusemtime ? (long)stp->st_mtime : (long)stp->st_ctime);
out = cbuf;
}
+4
View File
@@ -135,6 +135,10 @@ class FsIndexer : public FsTreeWalkerCB {
// Activate detection of xattr-only document updates. Experimental, so
// needs a config option
bool m_detectxattronly;
// Use mtime instead of ctime for up-to-date tests. This is mostly
// incompatible with xattr indexing, in addition to other
// issues. See recoll.conf comments.
static int o_tstupdusemtime;
#ifdef IDX_THREADS
friend void *FsIndexerDbUpdWorker(void*);
-2
View File
@@ -601,12 +601,10 @@ bool RclIntf::addWatch(const string& path, bool)
// CLOSE_WRITE is covered through MODIFY. CREATE is needed for mkdirs
uint32_t mask = IN_MODIFY | IN_CREATE
| IN_MOVED_FROM | IN_MOVED_TO | IN_DELETE
#ifdef RCL_USE_XATTR
// IN_ATTRIB used to be not needed to receive extattr
// modification events, which was a bit weird because only ctime is
// set, and now it is...
| IN_ATTRIB
#endif
#ifdef IN_DONT_FOLLOW
| IN_DONT_FOLLOW
#endif