From 1cf832752510839dfe93af74e31311a7e813305d Mon Sep 17 00:00:00 2001 From: Jean-Francois Dockes Date: Tue, 19 Mar 2019 16:41:01 +0100 Subject: [PATCH] internfile: let the constructor succeed even on uncompression error, so that the doc record is created and retry choices can be done for other runs --- src/internfile/internfile.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/internfile/internfile.cpp b/src/internfile/internfile.cpp index d91501af..a7932ff9 100644 --- a/src/internfile/internfile.cpp +++ b/src/internfile/internfile.cpp @@ -129,6 +129,14 @@ FileInterner::FileInterner(const string &fn, const struct stat *stp, init(fn, stp, cnf, flags, imime); } +// Note that we always succeed (set m_ok = true), except in internal +// inconsistency cases (which could just as well abort()). Errors +// will be detected when internfile() is called. This is done so that +// our caller creates a doc record in all cases (with an error-flagged +// signature), so that the appropriate retry choices can be made. This +// used to not be the case, and was changed because this was the +// simplest way to solve the retry issues (simpler than changing the +// caller in e.g. fsindexer). void FileInterner::init(const string &f, const struct stat *stp, RclConfig *cnf, int flags, const string *imime) { @@ -190,6 +198,7 @@ void FileInterner::init(const string &f, const struct stat *stp, RclConfig *cnf, if (!m_cfg->getConfParam("compressedfilemaxkbs", &maxkbs) || maxkbs < 0 || !stp || int(stp->st_size / 1024) < maxkbs) { if (!m_uncomp->uncompressfile(m_fn, ucmd, m_tfile)) { + m_ok = true; return; } LOGDEB1("FileInterner:: after ucomp: tfile " << m_tfile <<"\n"); @@ -199,6 +208,7 @@ void FileInterner::init(const string &f, const struct stat *stp, RclConfig *cnf, if (path_fileprops(m_fn, &ucstat) != 0) { LOGERR("FileInterner: can't stat the uncompressed file[" << m_fn << "] errno " << errno << "\n"); + m_ok = true; return; } else { docsize = ucstat.st_size;