mirror of
				https://github.com/sqlite/sqlite.git
				synced 2025-11-03 16:53:36 +03:00 
			
		
		
		
	Change the names of the log.c and log.h source files to wal.c and wal.h.
FossilOrigin-Name: 56fe5d7624f840417152bcc63efbe21a5f557920
This commit is contained in:
		@@ -276,6 +276,8 @@ SRC = \
 | 
			
		||||
  $(TOP)/src/vdbetrace.c \
 | 
			
		||||
  $(TOP)/src/vdbeInt.h \
 | 
			
		||||
  $(TOP)/src/vtab.c \
 | 
			
		||||
  $(TOP)/src/wal.c \
 | 
			
		||||
  $(TOP)/src/wal.h \
 | 
			
		||||
  $(TOP)/src/walker.c \
 | 
			
		||||
  $(TOP)/src/where.c
 | 
			
		||||
 | 
			
		||||
@@ -742,6 +744,9 @@ vdbetrace.lo:	$(TOP)/src/vdbetrace.c $(HDR)
 | 
			
		||||
vtab.lo:	$(TOP)/src/vtab.c $(HDR)
 | 
			
		||||
	$(LTCOMPILE) $(TEMP_STORE) -c $(TOP)/src/vtab.c
 | 
			
		||||
 | 
			
		||||
wal.lo:	$(TOP)/src/wal.c $(HDR)
 | 
			
		||||
	$(LTCOMPILE) $(TEMP_STORE) -c $(TOP)/src/wal.c
 | 
			
		||||
 | 
			
		||||
walker.lo:	$(TOP)/src/walker.c $(HDR)
 | 
			
		||||
	$(LTCOMPILE) $(TEMP_STORE) -c $(TOP)/src/walker.c
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										10
									
								
								main.mk
									
									
									
									
									
								
							
							
						
						
									
										10
									
								
								main.mk
									
									
									
									
									
								
							@@ -56,7 +56,7 @@ LIBOBJ+= alter.o analyze.o attach.o auth.o \
 | 
			
		||||
         fts3.o fts3_expr.o fts3_hash.o fts3_icu.o fts3_porter.o \
 | 
			
		||||
         fts3_snippet.o fts3_tokenizer.o fts3_tokenizer1.o fts3_write.o \
 | 
			
		||||
         func.o global.o hash.o \
 | 
			
		||||
         icu.o insert.o journal.o legacy.o loadext.o log.o \
 | 
			
		||||
         icu.o insert.o journal.o legacy.o loadext.o \
 | 
			
		||||
         main.o malloc.o mem0.o mem1.o mem2.o mem3.o mem5.o \
 | 
			
		||||
         memjournal.o \
 | 
			
		||||
         mutex.o mutex_noop.o mutex_os2.o mutex_unix.o mutex_w32.o \
 | 
			
		||||
@@ -66,7 +66,7 @@ LIBOBJ+= alter.o analyze.o attach.o auth.o \
 | 
			
		||||
         table.o tokenize.o trigger.o \
 | 
			
		||||
         update.o util.o vacuum.o \
 | 
			
		||||
         vdbe.o vdbeapi.o vdbeaux.o vdbeblob.o vdbemem.o vdbetrace.o \
 | 
			
		||||
         walker.o where.o utf.o vtab.o
 | 
			
		||||
         wal.o walker.o where.o utf.o vtab.o
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@@ -101,8 +101,6 @@ SRC = \
 | 
			
		||||
  $(TOP)/src/journal.c \
 | 
			
		||||
  $(TOP)/src/legacy.c \
 | 
			
		||||
  $(TOP)/src/loadext.c \
 | 
			
		||||
  $(TOP)/src/log.c \
 | 
			
		||||
  $(TOP)/src/log.h \
 | 
			
		||||
  $(TOP)/src/main.c \
 | 
			
		||||
  $(TOP)/src/malloc.c \
 | 
			
		||||
  $(TOP)/src/mem0.c \
 | 
			
		||||
@@ -160,6 +158,8 @@ SRC = \
 | 
			
		||||
  $(TOP)/src/vdbetrace.c \
 | 
			
		||||
  $(TOP)/src/vdbeInt.h \
 | 
			
		||||
  $(TOP)/src/vtab.c \
 | 
			
		||||
  $(TOP)/src/wal.c \
 | 
			
		||||
  $(TOP)/src/wal.h \
 | 
			
		||||
  $(TOP)/src/walker.c \
 | 
			
		||||
  $(TOP)/src/where.c
 | 
			
		||||
 | 
			
		||||
@@ -257,7 +257,7 @@ TESTSRC = \
 | 
			
		||||
TESTSRC2 = \
 | 
			
		||||
  $(TOP)/src/attach.c $(TOP)/src/backup.c $(TOP)/src/btree.c                   \
 | 
			
		||||
  $(TOP)/src/build.c $(TOP)/src/date.c                                         \
 | 
			
		||||
  $(TOP)/src/expr.c $(TOP)/src/func.c $(TOP)/src/insert.c $(TOP)/src/log.c     \
 | 
			
		||||
  $(TOP)/src/expr.c $(TOP)/src/func.c $(TOP)/src/insert.c $(TOP)/src/wal.c     \
 | 
			
		||||
  $(TOP)/src/mem5.c $(TOP)/src/os.c                                            \
 | 
			
		||||
  $(TOP)/src/os_os2.c $(TOP)/src/os_unix.c $(TOP)/src/os_win.c                 \
 | 
			
		||||
  $(TOP)/src/pager.c $(TOP)/src/pragma.c $(TOP)/src/prepare.c                  \
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										28
									
								
								manifest
									
									
									
									
									
								
							
							
						
						
									
										28
									
								
								manifest
									
									
									
									
									
								
							@@ -1,10 +1,10 @@
 | 
			
		||||
-----BEGIN PGP SIGNED MESSAGE-----
 | 
			
		||||
Hash: SHA1
 | 
			
		||||
 | 
			
		||||
C Begin\smoving\sWAL-specific\sI/O\sinto\sthe\sVFS.\s\sThis\scheckin\scontains\sVFS\ninfrastructure\sbut\sit\sis\suntested\sand\sis\snot\syet\shooked\sup\sto\sthe\sWAL.\nThe\sversion\snumber\sis\sbumped\sto\s3.7.0\sbecause\sof\sthe\sVFS\sextension.
 | 
			
		||||
D 2010-04-26T00:04:55
 | 
			
		||||
C Change\sthe\snames\sof\sthe\slog.c\sand\slog.h\ssource\sfiles\sto\swal.c\sand\swal.h.
 | 
			
		||||
D 2010-04-26T00:19:45
 | 
			
		||||
F Makefile.arm-wince-mingw32ce-gcc fcd5e9cd67fe88836360bb4f9ef4cb7f8e2fb5a0
 | 
			
		||||
F Makefile.in 4f2f967b7e58a35bb74fb7ec8ae90e0f4ca7868b
 | 
			
		||||
F Makefile.in d83a0ffef3dcbfb08b410a6c6dd6c009ec9167fb
 | 
			
		||||
F Makefile.linux-gcc d53183f4aa6a9192d249731c90dbdffbd2c68654
 | 
			
		||||
F Makefile.vxworks ab005d301296c40e021ccd0133ce49ca811e319f
 | 
			
		||||
F README cd04a36fbc7ea56932a4052d7d0b7f09f27c33d6
 | 
			
		||||
@@ -92,7 +92,7 @@ F ext/rtree/tkt3363.test 2bf324f7908084a5f463de3109db9c6e607feb1b
 | 
			
		||||
F ext/rtree/viewrtree.tcl eea6224b3553599ae665b239bd827e182b466024
 | 
			
		||||
F install-sh 9d4de14ab9fb0facae2f48780b874848cbf2f895 x
 | 
			
		||||
F ltmain.sh 3ff0879076df340d2e23ae905484d8c15d5fdea8
 | 
			
		||||
F main.mk f12991ace528dd01d018420988ff053350ae81f8
 | 
			
		||||
F main.mk b681194d6bf557b80ca363306e9c172f81f15b1d
 | 
			
		||||
F mkdll.sh 7d09b23c05d56532e9d44a50868eb4b12ff4f74a
 | 
			
		||||
F mkextu.sh 416f9b7089d80e5590a29692c9d9280a10dbad9f
 | 
			
		||||
F mkextw.sh 4123480947681d9b434a5e7b1ee08135abe409ac
 | 
			
		||||
@@ -134,8 +134,6 @@ F src/journal.c b0ea6b70b532961118ab70301c00a33089f9315c
 | 
			
		||||
F src/legacy.c a199d7683d60cef73089e892409113e69c23a99f
 | 
			
		||||
F src/lempar.c 7f026423f4d71d989e719a743f98a1cbd4e6d99e
 | 
			
		||||
F src/loadext.c 1c7a61ce1281041f437333f366a96aa0d29bb581
 | 
			
		||||
F src/log.c 538da9c42f6da426e82b114f37c27cf730fcba34
 | 
			
		||||
F src/log.h 06eacedac8b5a720cb88aa3c9e5d886ba7b394fe
 | 
			
		||||
F src/main.c 867de6aa444abd97771b2b70472f448d65c1c77e
 | 
			
		||||
F src/malloc.c a08f16d134f0bfab6b20c3cd142ebf3e58235a6a
 | 
			
		||||
F src/mem0.c 6a55ebe57c46ca1a7d98da93aaa07f99f1059645
 | 
			
		||||
@@ -157,7 +155,7 @@ F src/os_common.h 240c88b163b02c21a9f21f87d49678a0aa21ff30
 | 
			
		||||
F src/os_os2.c 082884dc2a20a2f1fddc404f3606ec2abe907b56
 | 
			
		||||
F src/os_unix.c 1acc854259b045cf029c6f95828a5f4b84f361c7
 | 
			
		||||
F src/os_win.c 607b40e40662c6c74ff2400ff03e7f42521d5c75
 | 
			
		||||
F src/pager.c 9da40bb50d2baa8f7cbb18579f147b7623856211
 | 
			
		||||
F src/pager.c 5924538fb99f62774419bfae882debb0d65bc3c8
 | 
			
		||||
F src/pager.h cee4487ab4f0911dd9f22a40e3cd55afdb7ef444
 | 
			
		||||
F src/parse.y ace5c7a125d9f2a410e431ee3209034105045f7e
 | 
			
		||||
F src/pcache.c ace8f6a5ecd4711cc66a1b23053be7109bd437cf
 | 
			
		||||
@@ -226,6 +224,8 @@ F src/vdbeblob.c 5327132a42a91e8b7acfb60b9d2c3b1c5c863e0e
 | 
			
		||||
F src/vdbemem.c 2a82f455f6ca6f78b59fb312f96054c04ae0ead1
 | 
			
		||||
F src/vdbetrace.c 864cef96919323482ebd9986f2132435115e9cc2
 | 
			
		||||
F src/vtab.c a0f8a40274e4261696ef57aa806de2776ab72cda
 | 
			
		||||
F src/wal.c df5283ae70cce52852fd788479bee22994fccbe5 w src/log.c
 | 
			
		||||
F src/wal.h 1a34bb71642b46af5e6d51c2f69ae0f55268df81 w src/log.h
 | 
			
		||||
F src/walker.c 3112bb3afe1d85dc52317cb1d752055e9a781f8f
 | 
			
		||||
F src/where.c faadd9c2bf08868e5135192b44e0d753e363a885
 | 
			
		||||
F test/aggerror.test a867e273ef9e3d7919f03ef4f0e8c0d2767944f2
 | 
			
		||||
@@ -791,7 +791,7 @@ F tool/lempar.c 01ca97f87610d1dac6d8cd96ab109ab1130e76dc
 | 
			
		||||
F tool/mkkeywordhash.c d2e6b4a5965e23afb80fbe74bb54648cd371f309
 | 
			
		||||
F tool/mkopts.tcl 66ac10d240cc6e86abd37dc908d50382f84ff46e
 | 
			
		||||
F tool/mkspeedsql.tcl a1a334d288f7adfe6e996f2e712becf076745c97
 | 
			
		||||
F tool/mksqlite3c.tcl 25ec827588893857eba2d24a645ace1bb7cdab73
 | 
			
		||||
F tool/mksqlite3c.tcl 42b6ba8b997a5f5a98f7f1df946c21c173eef586
 | 
			
		||||
F tool/mksqlite3h.tcl eb100dce83f24b501b325b340f8b5eb8e5106b3b
 | 
			
		||||
F tool/mksqlite3internalh.tcl 7b43894e21bcb1bb39e11547ce7e38a063357e87
 | 
			
		||||
F tool/omittest.tcl 27d6f6e3b1e95aeb26a1c140e6eb57771c6d794a
 | 
			
		||||
@@ -811,14 +811,14 @@ F tool/speedtest2.tcl ee2149167303ba8e95af97873c575c3e0fab58ff
 | 
			
		||||
F tool/speedtest8.c 2902c46588c40b55661e471d7a86e4dd71a18224
 | 
			
		||||
F tool/speedtest8inst1.c 293327bc76823f473684d589a8160bde1f52c14e
 | 
			
		||||
F tool/vdbe-compress.tcl d70ea6d8a19e3571d7ab8c9b75cba86d1173ff0f
 | 
			
		||||
P 3e9ef5153ebf0543ad0f75a7561f73d22171da53
 | 
			
		||||
R d0d00cdfe34b5188edd49187f65dd4f0
 | 
			
		||||
P f5e615c28c7035a7e6d896790b51cf9bc7371d5f
 | 
			
		||||
R 993bceae438ad1d8ab0904d8daf11104
 | 
			
		||||
U drh
 | 
			
		||||
Z a55984eccf1af95745f2d144e70469ac
 | 
			
		||||
Z e29cadabf74dbcaa3b3703c56732da89
 | 
			
		||||
-----BEGIN PGP SIGNATURE-----
 | 
			
		||||
Version: GnuPG v1.4.6 (GNU/Linux)
 | 
			
		||||
 | 
			
		||||
iD8DBQFL1NiqoxKgR168RlERAkSGAKCMwxXVaj6pJFUojxgq8jkWD5q0bgCfXZsd
 | 
			
		||||
BjC57GjZtQKSf+QHQLj1hP0=
 | 
			
		||||
=LyL/
 | 
			
		||||
iD8DBQFL1NwloxKgR168RlERAks8AJ9QVBJiBku5alys49Firj8NBRPvlwCfSHT7
 | 
			
		||||
JCRELzIJ9CW5GkQjtcejMJU=
 | 
			
		||||
=4Ljy
 | 
			
		||||
-----END PGP SIGNATURE-----
 | 
			
		||||
 
 | 
			
		||||
@@ -1 +1 @@
 | 
			
		||||
f5e615c28c7035a7e6d896790b51cf9bc7371d5f
 | 
			
		||||
56fe5d7624f840417152bcc63efbe21a5f557920
 | 
			
		||||
							
								
								
									
										34
									
								
								src/pager.c
									
									
									
									
									
								
							
							
						
						
									
										34
									
								
								src/pager.c
									
									
									
									
									
								
							@@ -20,7 +20,7 @@
 | 
			
		||||
*/
 | 
			
		||||
#ifndef SQLITE_OMIT_DISKIO
 | 
			
		||||
#include "sqliteInt.h"
 | 
			
		||||
#include "log.h"
 | 
			
		||||
#include "wal.h"
 | 
			
		||||
 | 
			
		||||
/*
 | 
			
		||||
******************** NOTES ON THE DESIGN OF THE PAGER ************************
 | 
			
		||||
@@ -1227,7 +1227,7 @@ static void pager_unlock(Pager *pPager){
 | 
			
		||||
    pPager->dbSizeValid = 0;
 | 
			
		||||
 | 
			
		||||
    if( pagerUseLog(pPager) ){
 | 
			
		||||
      sqlite3LogCloseSnapshot(pPager->pLog);
 | 
			
		||||
      sqlite3WalCloseSnapshot(pPager->pLog);
 | 
			
		||||
    }else{
 | 
			
		||||
      rc = osUnlock(pPager->fd, NO_LOCK);
 | 
			
		||||
    }
 | 
			
		||||
@@ -1426,7 +1426,7 @@ static int pager_end_transaction(Pager *pPager, int hasMaster){
 | 
			
		||||
  sqlite3PcacheCleanAll(pPager->pPCache);
 | 
			
		||||
 | 
			
		||||
  if( pagerUseLog(pPager) ){
 | 
			
		||||
    rc2 = sqlite3LogWriteLock(pPager->pLog, 0);
 | 
			
		||||
    rc2 = sqlite3WalWriteLock(pPager->pLog, 0);
 | 
			
		||||
    pPager->state = PAGER_SHARED;
 | 
			
		||||
  }else if( !pPager->exclusiveMode ){
 | 
			
		||||
    rc2 = osUnlock(pPager->fd, SHARED_LOCK);
 | 
			
		||||
@@ -2193,7 +2193,7 @@ static int readDbPage(PgHdr *pPg){
 | 
			
		||||
 | 
			
		||||
  if( pagerUseLog(pPager) ){
 | 
			
		||||
    /* Try to pull the page from the write-ahead log. */
 | 
			
		||||
    rc = sqlite3LogRead(pPager->pLog, pgno, &isInLog, pPg->pData);
 | 
			
		||||
    rc = sqlite3WalRead(pPager->pLog, pgno, &isInLog, pPg->pData);
 | 
			
		||||
  }
 | 
			
		||||
  if( rc==SQLITE_OK && !isInLog ){
 | 
			
		||||
    iOffset = (pgno-1)*(i64)pPager->pageSize;
 | 
			
		||||
@@ -2282,7 +2282,7 @@ static int pagerRollbackLog(Pager *pPager){
 | 
			
		||||
  ** also copied into the backup databases) as part of this transaction,
 | 
			
		||||
  ** the backups must be restarted.
 | 
			
		||||
  */
 | 
			
		||||
  if( sqlite3LogDirty(pPager->pLog) ){
 | 
			
		||||
  if( sqlite3WalDirty(pPager->pLog) ){
 | 
			
		||||
    sqlite3BackupRestart(pPager->pBackup);
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
@@ -2294,7 +2294,7 @@ static int pagerRollbackLog(Pager *pPager){
 | 
			
		||||
  **   + Reload page content from the database (if refcount>0).
 | 
			
		||||
  */
 | 
			
		||||
  pPager->dbSize = pPager->dbOrigSize;
 | 
			
		||||
  rc = sqlite3LogUndo(pPager->pLog, pagerUndoCallback, (void *)pPager);
 | 
			
		||||
  rc = sqlite3WalUndo(pPager->pLog, pagerUndoCallback, (void *)pPager);
 | 
			
		||||
  pList = sqlite3PcacheDirtyList(pPager->pPCache);
 | 
			
		||||
  while( pList && rc==SQLITE_OK ){
 | 
			
		||||
    PgHdr *pNext = pList->pDirty;
 | 
			
		||||
@@ -2738,7 +2738,7 @@ int sqlite3PagerPagecount(Pager *pPager, int *pnPage){
 | 
			
		||||
    i64 n = 0;              /* File size in bytes returned by OsFileSize() */
 | 
			
		||||
 | 
			
		||||
    if( pagerUseLog(pPager) ){
 | 
			
		||||
      sqlite3LogDbsize(pPager->pLog, &nPage);
 | 
			
		||||
      sqlite3WalDbsize(pPager->pLog, &nPage);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    if( nPage==0 ){
 | 
			
		||||
@@ -2923,7 +2923,7 @@ int sqlite3PagerClose(Pager *pPager){
 | 
			
		||||
  sqlite3BeginBenignMalloc();
 | 
			
		||||
  pPager->errCode = 0;
 | 
			
		||||
  pPager->exclusiveMode = 0;
 | 
			
		||||
  sqlite3LogClose(pPager->pLog, pPager->fd, 
 | 
			
		||||
  sqlite3WalClose(pPager->pLog, pPager->fd, 
 | 
			
		||||
    (pPager->noSync ? 0 : pPager->sync_flags), pTmp
 | 
			
		||||
  );
 | 
			
		||||
  pPager->pLog = 0;
 | 
			
		||||
@@ -3270,7 +3270,7 @@ static int subjournalPage(PgHdr *pPg){
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/*
 | 
			
		||||
** This function is a wrapper around sqlite3LogFrames(). As well as logging
 | 
			
		||||
** This function is a wrapper around sqlite3WalFrames(). As well as logging
 | 
			
		||||
** the contents of the list of pages headed by pList (connected by pDirty),
 | 
			
		||||
** this function notifies any active backup processes that the pages have
 | 
			
		||||
** changed. 
 | 
			
		||||
@@ -3285,7 +3285,7 @@ static int pagerLogFrames(
 | 
			
		||||
  int rc;                         /* Return code */
 | 
			
		||||
 | 
			
		||||
  assert( pPager->pLog );
 | 
			
		||||
  rc = sqlite3LogFrames(pPager->pLog, 
 | 
			
		||||
  rc = sqlite3WalFrames(pPager->pLog, 
 | 
			
		||||
      pPager->pageSize, pList, nTruncate, isCommit, sync_flags
 | 
			
		||||
  );
 | 
			
		||||
  if( rc==SQLITE_OK && pPager->pBackup ){
 | 
			
		||||
@@ -3838,7 +3838,7 @@ static int pagerOpenSnapshot(Pager *pPager){
 | 
			
		||||
 | 
			
		||||
  assert( pagerUseLog(pPager) );
 | 
			
		||||
 | 
			
		||||
  rc = sqlite3LogOpenSnapshot(pPager->pLog, &changed);
 | 
			
		||||
  rc = sqlite3WalOpenSnapshot(pPager->pLog, &changed);
 | 
			
		||||
  if( rc==SQLITE_OK ){
 | 
			
		||||
    int dummy;
 | 
			
		||||
    if( changed ){
 | 
			
		||||
@@ -4456,7 +4456,7 @@ int sqlite3PagerBegin(Pager *pPager, int exFlag, int subjInMemory){
 | 
			
		||||
      ** The busy-handler is not invoked if another connection already
 | 
			
		||||
      ** holds the write-lock. If possible, the upper layer will call it.
 | 
			
		||||
      */
 | 
			
		||||
      rc = sqlite3LogWriteLock(pPager->pLog, 1);
 | 
			
		||||
      rc = sqlite3WalWriteLock(pPager->pLog, 1);
 | 
			
		||||
      if( rc==SQLITE_OK ){
 | 
			
		||||
        pPager->dbOrigSize = pPager->dbSize;
 | 
			
		||||
        pPager->state = PAGER_RESERVED;
 | 
			
		||||
@@ -5777,7 +5777,7 @@ int sqlite3PagerCheckpoint(Pager *pPager){
 | 
			
		||||
  int rc = SQLITE_OK;
 | 
			
		||||
  if( pPager->pLog ){
 | 
			
		||||
    u8 *zBuf = (u8 *)pPager->pTmpSpace;
 | 
			
		||||
    rc = sqlite3LogCheckpoint(pPager->pLog, pPager->fd, 
 | 
			
		||||
    rc = sqlite3WalCheckpoint(pPager->pLog, pPager->fd, 
 | 
			
		||||
        (pPager->noSync ? 0 : pPager->sync_flags),
 | 
			
		||||
        zBuf, pPager->xBusyHandler, pPager->pBusyHandlerArg
 | 
			
		||||
    );
 | 
			
		||||
@@ -5786,7 +5786,7 @@ int sqlite3PagerCheckpoint(Pager *pPager){
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
int sqlite3PagerLogCallback(Pager *pPager){
 | 
			
		||||
  return sqlite3LogCallback(pPager->pLog);
 | 
			
		||||
  return sqlite3WalCallback(pPager->pLog);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/*
 | 
			
		||||
@@ -5806,7 +5806,7 @@ int sqlite3PagerOpenLog(Pager *pPager, int *pisOpen){
 | 
			
		||||
    ** (e.g. due to malloc() failure), unlock the database file and 
 | 
			
		||||
    ** return an error code.
 | 
			
		||||
    */
 | 
			
		||||
    rc = sqlite3LogOpen(pPager->pVfs, pPager->zFilename, &pPager->pLog);
 | 
			
		||||
    rc = sqlite3WalOpen(pPager->pVfs, pPager->zFilename, &pPager->pLog);
 | 
			
		||||
    if( rc==SQLITE_OK ){
 | 
			
		||||
      pPager->journalMode = PAGER_JOURNALMODE_WAL;
 | 
			
		||||
    }
 | 
			
		||||
@@ -5843,7 +5843,7 @@ int sqlite3PagerCloseLog(Pager *pPager){
 | 
			
		||||
      rc = pagerHasWAL(pPager, &logexists);
 | 
			
		||||
    }
 | 
			
		||||
    if( rc==SQLITE_OK && logexists ){
 | 
			
		||||
      rc = sqlite3LogOpen(pPager->pVfs, pPager->zFilename, &pPager->pLog);
 | 
			
		||||
      rc = sqlite3WalOpen(pPager->pVfs, pPager->zFilename, &pPager->pLog);
 | 
			
		||||
    }
 | 
			
		||||
  }
 | 
			
		||||
    
 | 
			
		||||
@@ -5853,7 +5853,7 @@ int sqlite3PagerCloseLog(Pager *pPager){
 | 
			
		||||
  if( rc==SQLITE_OK && pPager->pLog ){
 | 
			
		||||
    rc = sqlite3OsLock(pPager->fd, SQLITE_LOCK_EXCLUSIVE);
 | 
			
		||||
    if( rc==SQLITE_OK ){
 | 
			
		||||
      rc = sqlite3LogClose(pPager->pLog, pPager->fd,
 | 
			
		||||
      rc = sqlite3WalClose(pPager->pLog, pPager->fd,
 | 
			
		||||
        (pPager->noSync ? 0 : pPager->sync_flags), 
 | 
			
		||||
        (u8*)pPager->pTmpSpace
 | 
			
		||||
      );
 | 
			
		||||
 
 | 
			
		||||
@@ -57,7 +57,7 @@
 | 
			
		||||
** not the same as the iCheck1 and iCheck2 fields of the LogSummaryHdr.
 | 
			
		||||
*/
 | 
			
		||||
 | 
			
		||||
#include "log.h"
 | 
			
		||||
#include "wal.h"
 | 
			
		||||
 | 
			
		||||
#include <unistd.h>
 | 
			
		||||
#include <fcntl.h>
 | 
			
		||||
@@ -1006,7 +1006,7 @@ static int logSummaryInit(
 | 
			
		||||
** were to do this just after this client opened one of these files, the
 | 
			
		||||
** system would be badly broken.
 | 
			
		||||
*/
 | 
			
		||||
int sqlite3LogOpen(
 | 
			
		||||
int sqlite3WalOpen(
 | 
			
		||||
  sqlite3_vfs *pVfs,              /* vfs module to open log file with */
 | 
			
		||||
  const char *zDb,                /* Name of database file */
 | 
			
		||||
  Log **ppLog                     /* OUT: Allocated Log handle */
 | 
			
		||||
@@ -1264,7 +1264,7 @@ static int logCheckpoint(
 | 
			
		||||
/*
 | 
			
		||||
** Close a connection to a log file.
 | 
			
		||||
*/
 | 
			
		||||
int sqlite3LogClose(
 | 
			
		||||
int sqlite3WalClose(
 | 
			
		||||
  Log *pLog,                      /* Log to close */
 | 
			
		||||
  sqlite3_file *pFd,              /* Database file */
 | 
			
		||||
  int sync_flags,                 /* Flags to pass to OsSync() (or 0) */
 | 
			
		||||
@@ -1444,7 +1444,7 @@ int logSummaryReadHdr(Log *pLog, int *pChanged){
 | 
			
		||||
** is left unmodified. This is used by the pager layer to determine whether 
 | 
			
		||||
** or not any cached pages may be safely reused.
 | 
			
		||||
*/
 | 
			
		||||
int sqlite3LogOpenSnapshot(Log *pLog, int *pChanged){
 | 
			
		||||
int sqlite3WalOpenSnapshot(Log *pLog, int *pChanged){
 | 
			
		||||
  int rc = SQLITE_OK;
 | 
			
		||||
  if( pLog->isLocked==0 ){
 | 
			
		||||
    int nAttempt;
 | 
			
		||||
@@ -1480,7 +1480,7 @@ int sqlite3LogOpenSnapshot(Log *pLog, int *pChanged){
 | 
			
		||||
    rc = logSummaryReadHdr(pLog, pChanged);
 | 
			
		||||
    if( rc!=SQLITE_OK ){
 | 
			
		||||
      /* An error occured while attempting log recovery. */
 | 
			
		||||
      sqlite3LogCloseSnapshot(pLog);
 | 
			
		||||
      sqlite3WalCloseSnapshot(pLog);
 | 
			
		||||
    }
 | 
			
		||||
  }
 | 
			
		||||
  return rc;
 | 
			
		||||
@@ -1489,7 +1489,7 @@ int sqlite3LogOpenSnapshot(Log *pLog, int *pChanged){
 | 
			
		||||
/*
 | 
			
		||||
** Unlock the current snapshot.
 | 
			
		||||
*/
 | 
			
		||||
void sqlite3LogCloseSnapshot(Log *pLog){
 | 
			
		||||
void sqlite3WalCloseSnapshot(Log *pLog){
 | 
			
		||||
  if( pLog->isLocked ){
 | 
			
		||||
    assert( pLog->isLocked==LOG_REGION_A || pLog->isLocked==LOG_REGION_D );
 | 
			
		||||
    logLockRegion(pLog, pLog->isLocked, LOG_UNLOCK);
 | 
			
		||||
@@ -1500,7 +1500,7 @@ void sqlite3LogCloseSnapshot(Log *pLog){
 | 
			
		||||
/* 
 | 
			
		||||
** Read a page from the log, if it is present. 
 | 
			
		||||
*/
 | 
			
		||||
int sqlite3LogRead(Log *pLog, Pgno pgno, int *pInLog, u8 *pOut){
 | 
			
		||||
int sqlite3WalRead(Log *pLog, Pgno pgno, int *pInLog, u8 *pOut){
 | 
			
		||||
  u32 iRead = 0;
 | 
			
		||||
  u32 *aData = pLog->pSummary->aData;
 | 
			
		||||
  int iFrame = (pLog->hdr.iLastPg & 0xFFFFFF00);
 | 
			
		||||
@@ -1566,7 +1566,7 @@ int sqlite3LogRead(Log *pLog, Pgno pgno, int *pInLog, u8 *pOut){
 | 
			
		||||
/* 
 | 
			
		||||
** Set *pPgno to the size of the database file (or zero, if unknown).
 | 
			
		||||
*/
 | 
			
		||||
void sqlite3LogDbsize(Log *pLog, Pgno *pPgno){
 | 
			
		||||
void sqlite3WalDbsize(Log *pLog, Pgno *pPgno){
 | 
			
		||||
  assert( pLog->isLocked );
 | 
			
		||||
  *pPgno = pLog->hdr.nPage;
 | 
			
		||||
}
 | 
			
		||||
@@ -1576,7 +1576,7 @@ void sqlite3LogDbsize(Log *pLog, Pgno *pPgno){
 | 
			
		||||
** Otherwise, if the caller is operating on a snapshot that has already
 | 
			
		||||
** been overwritten by another writer, SQLITE_BUSY is returned.
 | 
			
		||||
*/
 | 
			
		||||
int sqlite3LogWriteLock(Log *pLog, int op){
 | 
			
		||||
int sqlite3WalWriteLock(Log *pLog, int op){
 | 
			
		||||
  assert( pLog->isLocked );
 | 
			
		||||
  if( op ){
 | 
			
		||||
 | 
			
		||||
@@ -1636,7 +1636,7 @@ int sqlite3LogWriteLock(Log *pLog, int op){
 | 
			
		||||
** Otherwise, if the callback function does not return an error, this
 | 
			
		||||
** function returns SQLITE_OK.
 | 
			
		||||
*/
 | 
			
		||||
int sqlite3LogUndo(Log *pLog, int (*xUndo)(void *, Pgno), void *pUndoCtx){
 | 
			
		||||
int sqlite3WalUndo(Log *pLog, int (*xUndo)(void *, Pgno), void *pUndoCtx){
 | 
			
		||||
  int rc = SQLITE_OK;
 | 
			
		||||
  Pgno iMax = pLog->hdr.iLastPg;
 | 
			
		||||
  Pgno iFrame;
 | 
			
		||||
@@ -1652,7 +1652,7 @@ int sqlite3LogUndo(Log *pLog, int (*xUndo)(void *, Pgno), void *pUndoCtx){
 | 
			
		||||
/* 
 | 
			
		||||
** Return true if data has been written but not committed to the log file. 
 | 
			
		||||
*/
 | 
			
		||||
int sqlite3LogDirty(Log *pLog){
 | 
			
		||||
int sqlite3WalDirty(Log *pLog){
 | 
			
		||||
  assert( pLog->isWriteLocked );
 | 
			
		||||
  return( pLog->hdr.iLastPg!=((LogSummaryHdr*)pLog->pSummary->aData)->iLastPg );
 | 
			
		||||
}
 | 
			
		||||
@@ -1661,7 +1661,7 @@ int sqlite3LogDirty(Log *pLog){
 | 
			
		||||
** Write a set of frames to the log. The caller must hold at least a
 | 
			
		||||
** RESERVED lock on the database file.
 | 
			
		||||
*/
 | 
			
		||||
int sqlite3LogFrames(
 | 
			
		||||
int sqlite3WalFrames(
 | 
			
		||||
  Log *pLog,                      /* Log handle to write to */
 | 
			
		||||
  int nPgsz,                      /* Database page-size in bytes */
 | 
			
		||||
  PgHdr *pList,                   /* List of dirty pages to write */
 | 
			
		||||
@@ -1801,7 +1801,7 @@ int sqlite3LogFrames(
 | 
			
		||||
**   4. Zero the log-summary header (so new readers will ignore the log).
 | 
			
		||||
**   5. Drop the locks obtained in steps 1 and 2.
 | 
			
		||||
*/
 | 
			
		||||
int sqlite3LogCheckpoint(
 | 
			
		||||
int sqlite3WalCheckpoint(
 | 
			
		||||
  Log *pLog,                      /* Log connection */
 | 
			
		||||
  sqlite3_file *pFd,              /* File descriptor open on db file */
 | 
			
		||||
  int sync_flags,                 /* Flags to sync db file with (or 0) */
 | 
			
		||||
@@ -1839,7 +1839,7 @@ int sqlite3LogCheckpoint(
 | 
			
		||||
  return rc;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
int sqlite3LogCallback(Log *pLog){
 | 
			
		||||
int sqlite3WalCallback(Log *pLog){
 | 
			
		||||
  u32 ret = 0;
 | 
			
		||||
  if( pLog ){
 | 
			
		||||
    ret = pLog->iCallback;
 | 
			
		||||
@@ -1847,4 +1847,3 @@ int sqlite3LogCallback(Log *pLog){
 | 
			
		||||
  }
 | 
			
		||||
  return (int)ret;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@@ -14,8 +14,8 @@
 | 
			
		||||
** the implementation of each function in log.c for further details.
 | 
			
		||||
*/
 | 
			
		||||
 | 
			
		||||
#ifndef _LOG_H_
 | 
			
		||||
#define _LOG_H_
 | 
			
		||||
#ifndef _WAL_H_
 | 
			
		||||
#define _WAL_H_
 | 
			
		||||
 | 
			
		||||
#include "sqliteInt.h"
 | 
			
		||||
 | 
			
		||||
@@ -23,31 +23,31 @@
 | 
			
		||||
typedef struct Log Log;
 | 
			
		||||
 | 
			
		||||
/* Open and close a connection to a log file. */
 | 
			
		||||
int sqlite3LogOpen(sqlite3_vfs*, const char *zDb, Log **ppLog);
 | 
			
		||||
int sqlite3LogClose(Log *pLog, sqlite3_file *pFd, int sync_flags, u8 *zBuf);
 | 
			
		||||
int sqlite3WalOpen(sqlite3_vfs*, const char *zDb, Log **ppLog);
 | 
			
		||||
int sqlite3WalClose(Log *pLog, sqlite3_file *pFd, int sync_flags, u8 *zBuf);
 | 
			
		||||
 | 
			
		||||
/* Used by readers to open (lock) and close (unlock) a snapshot. */
 | 
			
		||||
int sqlite3LogOpenSnapshot(Log *pLog, int *);
 | 
			
		||||
void sqlite3LogCloseSnapshot(Log *pLog);
 | 
			
		||||
int sqlite3WalOpenSnapshot(Log *pLog, int *);
 | 
			
		||||
void sqlite3WalCloseSnapshot(Log *pLog);
 | 
			
		||||
 | 
			
		||||
/* Read a page from the log, if it is present. */
 | 
			
		||||
int sqlite3LogRead(Log *pLog, Pgno pgno, int *pInLog, u8 *pOut);
 | 
			
		||||
void sqlite3LogDbsize(Log *pLog, Pgno *pPgno);
 | 
			
		||||
int sqlite3WalRead(Log *pLog, Pgno pgno, int *pInLog, u8 *pOut);
 | 
			
		||||
void sqlite3WalDbsize(Log *pLog, Pgno *pPgno);
 | 
			
		||||
 | 
			
		||||
/* Obtain or release the WRITER lock. */
 | 
			
		||||
int sqlite3LogWriteLock(Log *pLog, int op);
 | 
			
		||||
int sqlite3WalWriteLock(Log *pLog, int op);
 | 
			
		||||
 | 
			
		||||
/* Undo any frames written (but not committed) to the log */
 | 
			
		||||
int sqlite3LogUndo(Log *pLog, int (*xUndo)(void *, Pgno), void *pUndoCtx);
 | 
			
		||||
int sqlite3WalUndo(Log *pLog, int (*xUndo)(void *, Pgno), void *pUndoCtx);
 | 
			
		||||
 | 
			
		||||
/* Return true if data has been written but not committed to the log file. */
 | 
			
		||||
int sqlite3LogDirty(Log *pLog);
 | 
			
		||||
int sqlite3WalDirty(Log *pLog);
 | 
			
		||||
 | 
			
		||||
/* Write a frame or frames to the log. */
 | 
			
		||||
int sqlite3LogFrames(Log *pLog, int, PgHdr *, Pgno, int, int);
 | 
			
		||||
int sqlite3WalFrames(Log *pLog, int, PgHdr *, Pgno, int, int);
 | 
			
		||||
 | 
			
		||||
/* Copy pages from the log to the database file */ 
 | 
			
		||||
int sqlite3LogCheckpoint(
 | 
			
		||||
int sqlite3WalCheckpoint(
 | 
			
		||||
  Log *pLog,                      /* Log connection */
 | 
			
		||||
  sqlite3_file *pFd,              /* File descriptor open on db file */
 | 
			
		||||
  int sync_flags,                 /* Flags to sync db file with (or 0) */
 | 
			
		||||
@@ -57,6 +57,6 @@ int sqlite3LogCheckpoint(
 | 
			
		||||
);
 | 
			
		||||
 | 
			
		||||
/* Return the value to pass to a log callback. Or 0 for no callback. */
 | 
			
		||||
int sqlite3LogCallback(Log *pLog);
 | 
			
		||||
int sqlite3WalCallback(Log *pLog);
 | 
			
		||||
 | 
			
		||||
#endif /* _LOG_H_ */
 | 
			
		||||
#endif /* _WAL_H_ */
 | 
			
		||||
@@ -93,7 +93,6 @@ foreach hdr {
 | 
			
		||||
   hash.h
 | 
			
		||||
   hwtime.h
 | 
			
		||||
   keywordhash.h
 | 
			
		||||
   log.h
 | 
			
		||||
   mutex.h
 | 
			
		||||
   opcodes.h
 | 
			
		||||
   os_common.h
 | 
			
		||||
@@ -110,6 +109,7 @@ foreach hdr {
 | 
			
		||||
   sqliteLimit.h
 | 
			
		||||
   vdbe.h
 | 
			
		||||
   vdbeInt.h
 | 
			
		||||
   wal.h
 | 
			
		||||
} {
 | 
			
		||||
  set available_hdr($hdr) 1
 | 
			
		||||
}
 | 
			
		||||
@@ -244,7 +244,7 @@ foreach file {
 | 
			
		||||
   pcache.c
 | 
			
		||||
   pcache1.c
 | 
			
		||||
   rowset.c
 | 
			
		||||
   log.c
 | 
			
		||||
   wal.c
 | 
			
		||||
   pager.c
 | 
			
		||||
 | 
			
		||||
   btmutex.c
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user