------BEGIN PGP SIGNED MESSAGE-----
-Hash: SHA1
-
-C When\srolling\sback\spage\s1\sfrom\sa\sjournal,\srestore\sthe\s"nReserve"\ssetting\nin\scase\sit\shas\sbeen\scorrupted\sby\sa\sprior\scrash.
-D 2010-07-05T17:43:32
+C Allocate\sa\sbuffer\scontaining\sthe\sfull\spath-name\sto\sthe\sassociated\sWAL\sfile\swhen\sa\spager\sis\screated.\sThis\ssaves\shaving\sto\sconstruct\sa\snew\sbuffer\seach\stime\sa\snew\sread-transaction\sis\sopened\sand\sSQLite\schecks\sfor\sthe\sexistance\sof\sa\sWAL\sfile.
+D 2010-07-05T19:03:36
F Makefile.arm-wince-mingw32ce-gcc fcd5e9cd67fe88836360bb4f9ef4cb7f8e2fb5a0
F Makefile.in a5cad1f8f3e021356bfcc6c77dc16f6f1952bbc3
F Makefile.linux-gcc d53183f4aa6a9192d249731c90dbdffbd2c68654
F src/os_os2.c 665876d5eec7585226b0a1cf5e18098de2b2da19
F src/os_unix.c c6112f0ae34f23ae5ca0189a685e084befbdcf26
F src/os_win.c 883caa09d8cf7c4dfdef6eba6930466cb8a8275c
-F src/pager.c 14ec8ea3d27cf4c8b7b6a6139c150b50dd28df3e
+F src/pager.c d6454d37992882904ac0cdc1fd12887d1eecf434
F src/pager.h 879fdde5a102d2f21a3135d6f647530b21c2796c
F src/parse.y ace5c7a125d9f2a410e431ee3209034105045f7e
F src/pcache.c 1e9aa2dbc0845b52e1b51cc39753b6d1e041cb07
F src/vdbemem.c 5e579abf6532001dfbee0e640dc34eae897a9807
F src/vdbetrace.c 864cef96919323482ebd9986f2132435115e9cc2
F src/vtab.c a0f8a40274e4261696ef57aa806de2776ab72cda
-F src/wal.c 737408e8e6f2386e6318cd01dfaa534c45ffe3ed
+F src/wal.c 585f37237e2621ddd32676bc577b995856267ac2
F src/wal.h 906c85760598b18584921fe08008435aa4eeeeb2
F src/walker.c 3112bb3afe1d85dc52317cb1d752055e9a781f8f
F src/where.c 926c83c6394e132a1c62b6b12ceeba7d55a34c19
F tool/speedtest8.c 2902c46588c40b55661e471d7a86e4dd71a18224
F tool/speedtest8inst1.c 293327bc76823f473684d589a8160bde1f52c14e
F tool/vdbe-compress.tcl d70ea6d8a19e3571d7ab8c9b75cba86d1173ff0f
-P ea80b21c881fabaec1da788588c35c6c9782dcbd
-R 5de919a3a55f2a8c35bbb58047acd345
-U drh
-Z aa2a677064258d9e6322a258f0100e48
------BEGIN PGP SIGNATURE-----
-Version: GnuPG v1.4.6 (GNU/Linux)
-
-iD8DBQFMMhnIoxKgR168RlERAv13AJ0RezR75fN7II4WYQ+k2k88YWRNwgCeOLx/
-tAjj2vuEc4/BCzTdXBrdXV8=
-=hcXV
------END PGP SIGNATURE-----
+P c0d124da88e84e68679c2f3f4b2b35c03aecc916
+R cd5e60ea3770ef2152f9ff5f3bc6b29a
+U dan
+Z 3d489137870470f4068fe7324b7dadaf
-c0d124da88e84e68679c2f3f4b2b35c03aecc916
\ No newline at end of file
+3053a4ad15343a56efa430503797b77bb6d1e770
\ No newline at end of file
sqlite3_backup *pBackup; /* Pointer to list of ongoing backup processes */
#ifndef SQLITE_OMIT_WAL
Wal *pWal; /* Write-ahead log used by "journal_mode=wal" */
+ char *zWal; /* File name for write-ahead log */
#endif
};
*/
static int pagerCheckForOrDeleteWAL(Pager *pPager, int *pExists){
int rc; /* Return code */
- char *zWal; /* Name of the WAL file */
+ char *zWal = pPager->zWal; /* Name of the WAL file */
assert( !pPager->tempFile );
- zWal = sqlite3_mprintf("%s-wal", pPager->zFilename);
- if( !zWal ){
- rc = SQLITE_NOMEM;
+ if( pExists ){
+ rc = sqlite3OsAccess(pPager->pVfs, zWal, SQLITE_ACCESS_EXISTS, pExists);
}else{
- if( pExists ){
- rc = sqlite3OsAccess(pPager->pVfs, zWal, SQLITE_ACCESS_EXISTS, pExists);
- }else{
- rc = sqlite3OsDelete(pPager->pVfs, zWal, 0);
- }
- sqlite3_free(zWal);
+ rc = sqlite3OsDelete(pPager->pVfs, zWal, 0);
}
return rc;
}
journalFileSize * 2 + /* The two journal files */
nPathname + 1 + /* zFilename */
nPathname + 8 + 1 /* zJournal */
+#ifndef SQLITE_OMIT_WAL
+ + nPathname + 4 + 1 /* zWal */
+#endif
);
assert( EIGHT_BYTE_ALIGNMENT(SQLITE_INT_TO_PTR(journalFileSize)) );
if( !pPtr ){
memcpy(pPager->zFilename, zPathname, nPathname);
memcpy(pPager->zJournal, zPathname, nPathname);
memcpy(&pPager->zJournal[nPathname], "-journal", 8);
- if( pPager->zFilename[0]==0 ) pPager->zJournal[0] = 0;
+ if( pPager->zFilename[0]==0 ){
+ pPager->zJournal[0] = 0;
+ }
+#ifndef SQLITE_OMIT_WAL
+ else{
+ pPager->zWal = &pPager->zJournal[nPathname+8+1];
+ memcpy(pPager->zWal, zPathname, nPathname);
+ memcpy(&pPager->zWal[nPathname], "-wal", 4);
+ }
+#endif
sqlite3_free(zPathname);
}
pPager->pVfs = pVfs;
** return an error code.
*/
rc = sqlite3WalOpen(pPager->pVfs, pPager->fd,
- pPager->zFilename, &pPager->pWal);
+ pPager->zWal, &pPager->pWal);
if( rc==SQLITE_OK ){
pPager->journalMode = PAGER_JOURNALMODE_WAL;
}
}
if( rc==SQLITE_OK && logexists ){
rc = sqlite3WalOpen(pPager->pVfs, pPager->fd,
- pPager->zFilename, &pPager->pWal);
+ pPager->zWal, &pPager->pWal);
}
}
u8 writeLock; /* True if in a write transaction */
u8 ckptLock; /* True if holding a checkpoint lock */
WalIndexHdr hdr; /* Wal-index header for current transaction */
- char *zWalName; /* Name of WAL file */
+ const char *zWalName; /* Name of WAL file */
u32 nCkpt; /* Checkpoint sequence counter in the wal-header */
#ifdef SQLITE_DEBUG
u8 lockError; /* True if a locking error has occurred */
}
/*
-** Open a connection to the WAL file associated with database zDbName.
-** The database file must already be opened on connection pDbFd.
+** Open a connection to the WAL file zWalName. The database file must
+** already be opened on connection pDbFd. The buffer that zWalName points
+** to must remain valid for the lifetime of the returned Wal* handle.
**
** A SHARED lock should be held on the database file when this function
** is called. The purpose of this SHARED lock is to prevent any other
int sqlite3WalOpen(
sqlite3_vfs *pVfs, /* vfs module to open wal and wal-index */
sqlite3_file *pDbFd, /* The open database file */
- const char *zDbName, /* Name of the database file */
+ const char *zWalName, /* Name of the WAL file */
Wal **ppWal /* OUT: Allocated Wal handle */
){
int rc; /* Return Code */
Wal *pRet; /* Object to allocate and return */
int flags; /* Flags passed to OsOpen() */
- char *zWal; /* Name of write-ahead log file */
- int nWal; /* Length of zWal in bytes */
- assert( zDbName && zDbName[0] );
+ assert( zWalName && zWalName[0] );
assert( pDbFd );
/* In the amalgamation, the os_unix.c and os_win.c source files come before
/* Allocate an instance of struct Wal to return. */
*ppWal = 0;
- nWal = sqlite3Strlen30(zDbName) + 5;
- pRet = (Wal*)sqlite3MallocZero(sizeof(Wal) + pVfs->szOsFile + nWal);
+ pRet = (Wal*)sqlite3MallocZero(sizeof(Wal) + pVfs->szOsFile);
if( !pRet ){
return SQLITE_NOMEM;
}
pRet->pDbFd = pDbFd;
pRet->readLock = -1;
sqlite3_randomness(8, &pRet->hdr.aSalt);
- pRet->zWalName = zWal = pVfs->szOsFile + (char*)pRet->pWalFd;
- sqlite3_snprintf(nWal, zWal, "%s-wal", zDbName);
+ pRet->zWalName = zWalName;
rc = sqlite3OsShmOpen(pDbFd);
/* Open file handle on the write-ahead log file. */
if( rc==SQLITE_OK ){
pRet->isWIndexOpen = 1;
flags = (SQLITE_OPEN_READWRITE|SQLITE_OPEN_CREATE|SQLITE_OPEN_MAIN_JOURNAL);
- rc = sqlite3OsOpen(pVfs, zWal, pRet->pWalFd, flags, &flags);
+ rc = sqlite3OsOpen(pVfs, zWalName, pRet->pWalFd, flags, &flags);
}
if( rc!=SQLITE_OK ){