Ticket #109: quartz-recovery.patch

File quartz-recovery.patch, 2.8 KB (added by Olly Betts, 17 years ago)

Fix for flint ported back to quartz

  • backends/quartz/btree.cc

     
    17751775
    17761776/************ B-tree reading ************/
    17771777
    1778 void
     1778bool
    17791779Btree::do_open_to_read(bool revision_supplied, quartz_revision_number_t revision_)
    17801780{
    17811781    if (!basic_open(revision_supplied, revision_)) {
     1782        if (revision_supplied) {
     1783            // The requested revision was not available.
     1784            // This could be because the database was modified underneath us, or
     1785            // because a base file is missing.  Return false, and work out what
     1786            // the problem was at a higher level.
     1787            return false;
     1788        }
    17821789        throw Xapian::DatabaseOpeningError("Failed to open table for reading");
    17831790    }
    17841791
     
    18011808    }
    18021809
    18031810    read_root();
     1811    return true;
    18041812}
    18051813
    18061814void
     
    18111819    close();
    18121820
    18131821    if (!writable) {
    1814         do_open_to_read(false, 0);
     1822        // Any errors are thrown if revision_supplied is false
     1823        (void)do_open_to_read(false, 0);
    18151824        return;
    18161825    }
    18171826
     
    18271836    close();
    18281837
    18291838    if (!writable) {
    1830         do_open_to_read(true, revision);
    1831         AssertEq(revision_number, revision);
    1832         RETURN(true);
     1839        if (do_open_to_read(true, revision)) {
     1840            AssertEq(revision_number, revision);
     1841            RETURN(true);
     1842        } else {
     1843            close();
     1844            RETURN(false);
     1845        }
    18331846    }
    18341847
    18351848    if (!do_open_to_write(true, revision)) {
  • backends/quartz/btree.h

     
    553553    protected:
    554554
    555555        /** Perform the opening operation to read.
     556         *
     557         *  Return true iff the open succeeded.
    556558         */
    557         void do_open_to_read(bool revision_supplied, quartz_revision_number_t revision_);
     559        bool do_open_to_read(bool revision_supplied, quartz_revision_number_t revision_);
    558560
    559561        /** Perform the opening operation to read.
    560562         *
  • backends/quartz/quartz_database.cc

     
    285285                log.make_entry("Cannot open all tables at revision in record table: " + om_tostring(revision));
    286286                throw Xapian::DatabaseCorruptError("Cannot open tables at consistent revisions");
    287287            }
     288            revision = newrevision;
    288289        }
    289290    }
    290291
    291292    if (!fully_opened) {
    292293        log.make_entry("Cannot open all tables in a consistent state - keep changing too fast, giving up after " + om_tostring(tries) + " attempts");
    293         throw Xapian::DatabaseOpeningError("Cannot open tables at stable revision - changing too fast");
     294        throw Xapian::DatabaseModifiedError("Cannot open tables at stable revision - changing too fast");
    294295    }
    295296
    296297    log.make_entry("Opened tables at revision " + om_tostring(revision));