Ticket #109: quartz-recovery.patch
File quartz-recovery.patch, 2.8 KB (added by , 18 years ago) |
---|
-
backends/quartz/btree.cc
1775 1775 1776 1776 /************ B-tree reading ************/ 1777 1777 1778 void 1778 bool 1779 1779 Btree::do_open_to_read(bool revision_supplied, quartz_revision_number_t revision_) 1780 1780 { 1781 1781 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 } 1782 1789 throw Xapian::DatabaseOpeningError("Failed to open table for reading"); 1783 1790 } 1784 1791 … … 1801 1808 } 1802 1809 1803 1810 read_root(); 1811 return true; 1804 1812 } 1805 1813 1806 1814 void … … 1811 1819 close(); 1812 1820 1813 1821 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); 1815 1824 return; 1816 1825 } 1817 1826 … … 1827 1836 close(); 1828 1837 1829 1838 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 } 1833 1846 } 1834 1847 1835 1848 if (!do_open_to_write(true, revision)) { -
backends/quartz/btree.h
553 553 protected: 554 554 555 555 /** Perform the opening operation to read. 556 * 557 * Return true iff the open succeeded. 556 558 */ 557 voiddo_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_); 558 560 559 561 /** Perform the opening operation to read. 560 562 * -
backends/quartz/quartz_database.cc
285 285 log.make_entry("Cannot open all tables at revision in record table: " + om_tostring(revision)); 286 286 throw Xapian::DatabaseCorruptError("Cannot open tables at consistent revisions"); 287 287 } 288 revision = newrevision; 288 289 } 289 290 } 290 291 291 292 if (!fully_opened) { 292 293 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::Database OpeningError("Cannot open tables at stable revision - changing too fast");294 throw Xapian::DatabaseModifiedError("Cannot open tables at stable revision - changing too fast"); 294 295 } 295 296 296 297 log.make_entry("Opened tables at revision " + om_tostring(revision));