Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
Comment: | Apply [b9b11855e8] (the alternate fix to [fc62af4523]) to the trunk. |
---|---|
Downloads: | Tarball | ZIP archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA1: |
9a949a3a5c32b8bfbb94e10e18d050ec |
User & Date: | dan 2010-06-17 17:05:54.000 |
Context
2010-06-19
| ||
15:10 | Change the unix VFS to always allocate shared-memory using a file in the same directory as the database. Otherwise, a chroot might cause different processes to use different shared memory files resulting in database corruption. (check-in: 2241788bc8 user: drh tags: trunk) | |
2010-06-17
| ||
17:05 | Apply [b9b11855e8] (the alternate fix to [fc62af4523]) to the trunk. (check-in: 9a949a3a5c user: dan tags: trunk) | |
16:08 | Fix the tkt-fc62af4523.test to work around non-randomness of the randomblob() function when in testing mode. (check-in: 7c3a86b9c7 user: drh tags: trunk) | |
Changes
Changes to src/pager.c.
︙ | ︙ | |||
5873 5874 5875 5876 5877 5878 5879 5880 5881 5882 5883 5884 5885 5886 | */ if( isOpen(pPager->jfd) && eMode!=PAGER_JOURNALMODE_WAL ){ sqlite3OsClose(pPager->jfd); } /* Change the journal mode. */ pPager->journalMode = (u8)eMode; } /* Return the new journal mode */ return (int)pPager->journalMode; } /* | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 5873 5874 5875 5876 5877 5878 5879 5880 5881 5882 5883 5884 5885 5886 5887 5888 5889 5890 5891 5892 5893 5894 5895 5896 5897 5898 5899 5900 5901 5902 5903 5904 5905 5906 5907 5908 5909 5910 5911 5912 5913 5914 5915 5916 5917 5918 5919 5920 5921 5922 5923 5924 5925 5926 5927 5928 | */ if( isOpen(pPager->jfd) && eMode!=PAGER_JOURNALMODE_WAL ){ sqlite3OsClose(pPager->jfd); } /* Change the journal mode. */ pPager->journalMode = (u8)eMode; /* When transistioning from TRUNCATE or PERSIST to any other journal ** mode except WAL (and we are not in locking_mode=EXCLUSIVE) then ** delete the journal file. */ assert( (PAGER_JOURNALMODE_TRUNCATE & 5)==1 ); assert( (PAGER_JOURNALMODE_PERSIST & 5)==1 ); assert( (PAGER_JOURNALMODE_DELETE & 5)==0 ); assert( (PAGER_JOURNALMODE_MEMORY & 5)==4 ); assert( (PAGER_JOURNALMODE_OFF & 5)==0 ); assert( (PAGER_JOURNALMODE_WAL & 5)==5 ); assert( isOpen(pPager->fd) || pPager->exclusiveMode ); if( !pPager->exclusiveMode && (eOld & 5)==1 && (eMode & 1)==0 ){ /* In this case we would like to delete the journal file. If it is ** not possible, then that is not a problem. Deleting the journal file ** here is an optimization only. ** ** Before deleting the journal file, obtain a RESERVED lock on the ** database file. This ensures that the journal file is not deleted ** while it is in use by some other client. */ int rc = SQLITE_OK; int state = pPager->state; if( state<PAGER_SHARED ){ rc = sqlite3PagerSharedLock(pPager); } if( pPager->state==PAGER_SHARED ){ assert( rc==SQLITE_OK ); rc = sqlite3OsLock(pPager->fd, RESERVED_LOCK); } if( rc==SQLITE_OK ){ sqlite3OsDelete(pPager->pVfs, pPager->zJournal, 0); } if( rc==SQLITE_OK && state==PAGER_SHARED ){ sqlite3OsUnlock(pPager->fd, SHARED_LOCK); }else if( state==PAGER_UNLOCK ){ pager_unlock(pPager); } assert( state==pPager->state ); } } /* Return the new journal mode */ return (int)pPager->journalMode; } /* |
︙ | ︙ |
Changes to src/vdbe.c.
︙ | ︙ | |||
5247 5248 5249 5250 5251 5252 5253 | */ rc = sqlite3PagerCloseWal(pPager); if( rc==SQLITE_OK ){ sqlite3PagerSetJournalMode(pPager, eNew); }else if( rc==SQLITE_BUSY && pOp->p5==0 ){ goto abort_due_to_error; } | < < < | < > | 5247 5248 5249 5250 5251 5252 5253 5254 5255 5256 5257 5258 5259 5260 5261 5262 5263 5264 5265 5266 5267 5268 5269 5270 5271 5272 5273 5274 5275 5276 5277 5278 5279 5280 | */ rc = sqlite3PagerCloseWal(pPager); if( rc==SQLITE_OK ){ sqlite3PagerSetJournalMode(pPager, eNew); }else if( rc==SQLITE_BUSY && pOp->p5==0 ){ goto abort_due_to_error; } } /* Open a transaction on the database file. Regardless of the journal ** mode, this transaction always uses a rollback journal. */ assert( sqlite3BtreeIsInTrans(pBt)==0 ); if( rc==SQLITE_OK ){ rc = sqlite3BtreeSetVersion(pBt, (eNew==PAGER_JOURNALMODE_WAL ? 2 : 1)); if( rc==SQLITE_BUSY && pOp->p5==0 ) goto abort_due_to_error; } if( rc==SQLITE_BUSY ){ eNew = eOld; rc = SQLITE_OK; } } } #endif /* ifndef SQLITE_OMIT_WAL */ eNew = sqlite3PagerSetJournalMode(pPager, eNew); pOut = &aMem[pOp->p2]; pOut->flags = MEM_Str|MEM_Static|MEM_Term; pOut->z = (char *)sqlite3JournalModename(eNew); pOut->n = sqlite3Strlen30(pOut->z); pOut->enc = SQLITE_UTF8; sqlite3VdbeChangeEncoding(pOut, encoding); break; |
︙ | ︙ |
Changes to test/jrnlmode.test.
︙ | ︙ | |||
480 481 482 483 484 485 486 | do_test jrnlmode-6.5 { execsql { PRAGMA journal_mode = MEMORY; BEGIN; INSERT INTO t4 VALUES(3, 4); } file exists test.db-journal | | | | 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 | do_test jrnlmode-6.5 { execsql { PRAGMA journal_mode = MEMORY; BEGIN; INSERT INTO t4 VALUES(3, 4); } file exists test.db-journal } {0} do_test jrnlmode-6.7 { execsql { COMMIT; SELECT * FROM t4; } } {1 2 3 4} do_test jrnlmode-6.8 { file exists test.db-journal } {0} do_test jrnlmode-6.9 { execsql { PRAGMA journal_mode = DELETE; BEGIN IMMEDIATE; INSERT INTO t4 VALUES(1,2); COMMIT; } file exists test.db-journal } {0} |
︙ | ︙ |