commit 90f7a35483b4cf7dd848c34634803bf28f95081d
Author: Olly Betts <olly@survex.com>
Date:   Wed Jan 25 11:40:44 2023 +1300

    Fix recovery from failed commit
    
    If renaming to switch the new version file live fails (e.g. due to
    ENOSPC) we discard the changes, try to write and switch to a different
    new version file with an increased revision (on failure of this too we
    close the database), and throw DatabaseError.
    
    Unfortunately the roll-back of state is not complete, and if switching
    to the different new version file succeeds that bad state persists on
    disk.
    
    Thanks to Uwe Kleine-König for reporting and coming up with the idea
    to reproduce using strace to inject a rename() failure - this is a
    simple reproducer:
    
    rm -rf enospc.db
    strace -e inject=rename:error=ENOSPC:when=2 examples/simpleindex enospc.db < INSTALL
    xapian-check enospc.db
    
    No automated regression test for this yet as this doesn't trivially
    fit into the existing testsuite framework, but we ought to have
    tests using fault injection.
    
    (cherry picked from commit 9f9aad17893bde4acb3a98e60dde397c346fcd9a)

--- a/backends/glass/glass_database.cc
+++ b/backends/glass/glass_database.cc
@@ -619,7 +619,7 @@
 	cancel();
 
 	// Reopen tables with old revision number.
-	version_file.cancel();
+	version_file.read();
 	docdata_table.open(flags, version_file.get_root(Glass::DOCDATA), old_revision);
 	spelling_table.open(flags, version_file.get_root(Glass::SPELLING), old_revision);
 	synonym_table.open(flags, version_file.get_root(Glass::SYNONYM), old_revision);
