[Xapian-discuss] Feature request: Determining source index of xapian-compact DatabaseError exception

Henry C. henka at cityweb.co.za
Wed Jul 13 13:17:03 BST 2011


Greets,

When merging lots of subindexes in batches like so:

xapian-compact -m idx1 idx2... dstidx

Errors such as:

xapian-compact: DatabaseError: Error reading block 0: got end of file

present a problem since it does not provide the offending path name (of the
broken index) for easy identification/removal in automated/batch scenarios
(the way DatabaseOpeningError:.... does, eg).  The only way to id the
offending path is to step through the list and use xapian-check.

The same goes for DatabaseCorruptError and possibly others.

Since xapian-compact allows you to pass many paths on the command-line it
would be very useful to always emit the index path currently being processed
in any error thrown, thus allowing for easy identification of problems in
data.

I've hacked the source a bit in a few areas (by using std::string name from
chert_table.h) to emit *something* useful, eg in ChertTable::read_block():

   string message = "Error reading block " + str(n) + ": ";
        message += strerror(errno);
+        message += " (current_path: " + name + ")";
        throw Xapian::DatabaseError(message);
    } else if (bytes_read == 0) {
        string message = "Error reading block " + str(n) + ": got end of file";
+        message += " (current_path: " + name + ")";
        throw Xapian::DatabaseError(message);



What's the possibility of something like this being added in the future?

Regards
Henry





More information about the Xapian-discuss mailing list