Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
Comment: | Fix a problem with recovering from an IO error in exclusive-locking mode. (CVS 5112) |
---|---|
Downloads: | Tarball | ZIP archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA1: |
7a44fb965b3477fb78901939ba35d569 |
User & Date: | danielk1977 2008-05-09 16:57:51.000 |
Context
2008-05-09
| ||
18:03 | Reformulate the constants for the minimum and maximum 64-bit signed integer to work better with some compilers. Ticket #3105. (CVS 5113) (check-in: 18b1ee10b8 user: drh tags: trunk) | |
16:57 | Fix a problem with recovering from an IO error in exclusive-locking mode. (CVS 5112) (check-in: 7a44fb965b user: danielk1977 tags: trunk) | |
14:39 | Do not clear the error code or error message in sqlite3_clear_bindings(). Ticket #3063. (CVS 5111) (check-in: 069f456010 user: drh tags: trunk) | |
Changes
Changes to src/btree.c.
1 2 3 4 5 6 7 8 9 10 11 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 | - + | /* ** 2004 April 6 ** ** The author disclaims copyright to this source code. In place of ** a legal notice, here is a blessing: ** ** May you do good and not evil. ** May you find forgiveness for yourself and forgive others. ** May you share freely, never taking more than you give. ** ************************************************************************* |
︙ | |||
1640 1641 1642 1643 1644 1645 1646 1647 1648 1649 1650 1651 1652 1653 1654 1655 1656 | 1640 1641 1642 1643 1644 1645 1646 1647 1648 1649 1650 1651 1652 1653 1654 1655 1656 1657 1658 1659 1660 1661 1662 1663 1664 1665 1666 1667 1668 1669 | + - + + + + + | ** well-formed database file, then SQLITE_CORRUPT is returned. ** SQLITE_BUSY is returned if the database is locked. SQLITE_NOMEM ** is returned if we run out of memory. */ static int lockBtree(BtShared *pBt){ int rc; MemPage *pPage1; int nPage; assert( sqlite3_mutex_held(pBt->mutex) ); if( pBt->pPage1 ) return SQLITE_OK; rc = sqlite3BtreeGetPage(pBt, 1, &pPage1, 0); if( rc!=SQLITE_OK ) return rc; /* Do some checking to help insure the file we opened really is ** a valid database file. */ rc = SQLITE_NOTADB; |
︙ |
Changes to src/pager.c.
︙ | |||
14 15 16 17 18 19 20 | 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 | - + | ** The pager is used to access a database disk file. It implements ** atomic commit and rollback through the use of a journal file that ** is separate from the database file. The pager also implements file ** locking to prevent two processes from writing the same database ** file simultaneously, or one process from reading the database while ** another is writing. ** |
︙ | |||
1393 1394 1395 1396 1397 1398 1399 | 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 | - - - + + + + + | } sqlite3PagerStmtCommit(pPager); if( pPager->stmtOpen && !pPager->exclusiveMode ){ sqlite3OsClose(pPager->stfd); pPager->stmtOpen = 0; } if( pPager->journalOpen ){ |
︙ | |||
3408 3409 3410 3411 3412 3413 3414 | 3410 3411 3412 3413 3414 3415 3416 3417 3418 3419 3420 3421 3422 3423 3424 3425 | - + | ** the error. Discard the contents of the pager-cache and treat any ** open journal file as a hot-journal. */ if( !MEMDB && pPager->exclusiveMode && pPager->nRef==0 && pPager->errCode ){ if( pPager->journalOpen ){ isHot = 1; } |
︙ |
Changes to src/test_osinst.c.
︙ | |||
299 300 301 302 303 304 305 | 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 | + - + + | OS_TIME_IO(OS_WRITE, iAmt, iOfst, p->pReal->pMethods->xWrite(p->pReal, z, iAmt, iOfst)); } /* ** Truncate an inst-file. */ static int instTruncate(sqlite3_file *pFile, sqlite_int64 size){ OS_TIME_IO(OS_TRUNCATE, 0, (int)size, |
︙ | |||
627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 | 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 | + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - + - + | static void put32bits(unsigned char *p, unsigned int v){ p[0] = v>>24; p[1] = v>>16; p[2] = v>>8; p[3] = v; } static void binarylog_flush(InstVfsBinaryLog *pLog){ sqlite3_file *pFile = pLog->pOut; #ifdef SQLITE_TEST extern int sqlite3_io_error_pending; extern int sqlite3_io_error_persist; extern int sqlite3_diskfull_pending; int pending = sqlite3_io_error_pending; int persist = sqlite3_io_error_persist; int diskfull = sqlite3_diskfull_pending; sqlite3_io_error_pending = 0; sqlite3_io_error_persist = 0; sqlite3_diskfull_pending = 0; #endif pFile->pMethods->xWrite(pFile, pLog->zBuf, pLog->nBuf, pLog->iOffset); pLog->iOffset += pLog->nBuf; pLog->nBuf = 0; #ifdef SQLITE_TEST sqlite3_io_error_pending = pending; sqlite3_io_error_persist = persist; sqlite3_diskfull_pending = diskfull; #endif } static void binarylog_xcall( void *p, int eEvent, int iFileId, sqlite3_int64 nClick, int return_code, const char *zName, int flags, int nByte, sqlite3_int64 iOffset ){ InstVfsBinaryLog *pLog = (InstVfsBinaryLog *)p; unsigned char *zRec; if( (28+pLog->nBuf)>BINARYLOG_BUFFERSIZE ){ |
︙ | |||
694 695 696 697 698 699 700 | 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 | - - - - + | pLog = (InstVfsBinaryLog *)pInstVfs->pClient; if( nBlob<0 ){ nBlob = strlen(zBlob); } nWrite = nBlob + 28; if( (nWrite+pLog->nBuf)>BINARYLOG_BUFFERSIZE ){ |
︙ | |||
746 747 748 749 750 751 752 | 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 | - - + + + | p->zOut = (char *)&p[1]; p->pOut = (sqlite3_file *)sqlite3_malloc(pParent->szOsFile); pParent->xFullPathname(pParent, zLog, pParent->mxPathname, p->zOut); flags = SQLITE_OPEN_READWRITE|SQLITE_OPEN_CREATE|SQLITE_OPEN_MASTER_JOURNAL; pParent->xDelete(pParent, p->zOut, 0); rc = pParent->xOpen(pParent, p->zOut, p->pOut, flags, &flags); if( rc==SQLITE_OK ){ |
︙ | |||
859 860 861 862 863 864 865 866 867 | 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 | + + + - + + + + + + + + + - - + + + + - - - + + + | } Tcl_SetObjResult(interp, objv[2]); break; } case IV_BINARYLOG: { char *zName = 0; char *zLog = 0; char *zParent = 0; sqlite3_vfs *p; int isDefault = 0; int argbase = 2; |
︙ |
Changes to test/incrvacuum_ioerr.test.
︙ | |||
11 12 13 14 15 16 17 | 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 | - + + + | # This file implements regression tests for SQLite library. The # focus of this file is testing for correct handling of I/O errors # such as writes failing because the disk is full. # # The tests in this file use special facilities that are only # available in the SQLite test fixture. # |
︙ | |||
100 101 102 103 104 105 106 | 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 | - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + | PRAGMA incremental_vacuum(5); } -cleanup { sqlite3 db test.db integrity_check incrvacuum-ioerr-2.$n.integritycheck db close } |