mirror of
https://github.com/sqlite/sqlite.git
synced 2025-11-15 11:41:13 +03:00
Merge two wal leaves.
FossilOrigin-Name: 23c0e6c3f333e878fe5a2ae5d61df0d765f437b4
This commit is contained in:
20
manifest
20
manifest
@@ -1,5 +1,5 @@
|
|||||||
C Add\sthe\ssqlite3_wal_checkpoint()\sand\ssqlite3_wal_autocheckpoint()\sAPIs.
|
C Merge\stwo\swal\sleaves.
|
||||||
D 2010-05-03T08:04:49
|
D 2010-05-03T08:19:34
|
||||||
F Makefile.arm-wince-mingw32ce-gcc fcd5e9cd67fe88836360bb4f9ef4cb7f8e2fb5a0
|
F Makefile.arm-wince-mingw32ce-gcc fcd5e9cd67fe88836360bb4f9ef4cb7f8e2fb5a0
|
||||||
F Makefile.in d83a0ffef3dcbfb08b410a6c6dd6c009ec9167fb
|
F Makefile.in d83a0ffef3dcbfb08b410a6c6dd6c009ec9167fb
|
||||||
F Makefile.linux-gcc d53183f4aa6a9192d249731c90dbdffbd2c68654
|
F Makefile.linux-gcc d53183f4aa6a9192d249731c90dbdffbd2c68654
|
||||||
@@ -150,7 +150,7 @@ F src/os.c 8bc63cf91e9802e2b807198e54e50227fa889306
|
|||||||
F src/os.h 534b082c3cb349ad05fa6fa0b06087e022af282c
|
F src/os.h 534b082c3cb349ad05fa6fa0b06087e022af282c
|
||||||
F src/os_common.h 0d6ee583b6ee3185eb9d951f890c6dd03021a08d
|
F src/os_common.h 0d6ee583b6ee3185eb9d951f890c6dd03021a08d
|
||||||
F src/os_os2.c 8ad77a418630d7dee91d1bb04f79c2096301d3a0
|
F src/os_os2.c 8ad77a418630d7dee91d1bb04f79c2096301d3a0
|
||||||
F src/os_unix.c bb8b65d92a79b4b1311fad7cae8a697dea0b8838
|
F src/os_unix.c 5c821e4eb04093102d901c22f40341bc1d30aef0
|
||||||
F src/os_win.c a8fc01d8483be472e495793c01064fd87e56a5c1
|
F src/os_win.c a8fc01d8483be472e495793c01064fd87e56a5c1
|
||||||
F src/pager.c e9c7fe979b32a3c5bf4216d8fbe1cf8beff8a1b8
|
F src/pager.c e9c7fe979b32a3c5bf4216d8fbe1cf8beff8a1b8
|
||||||
F src/pager.h 934b598583a9d936bb13c37d62a2fe68ac48781c
|
F src/pager.h 934b598583a9d936bb13c37d62a2fe68ac48781c
|
||||||
@@ -166,7 +166,7 @@ F src/resolve.c ac5f1a713cd1ae77f08b83cc69581e11bf5ae6f9
|
|||||||
F src/rowset.c 69afa95a97c524ba6faf3805e717b5b7ae85a697
|
F src/rowset.c 69afa95a97c524ba6faf3805e717b5b7ae85a697
|
||||||
F src/select.c c03d8a0565febcde8c6a12c5d77d065fddae889b
|
F src/select.c c03d8a0565febcde8c6a12c5d77d065fddae889b
|
||||||
F src/shell.c c40427c7245535a04a9cb4a417b6cc05c022e6a4
|
F src/shell.c c40427c7245535a04a9cb4a417b6cc05c022e6a4
|
||||||
F src/sqlite.h.in dcf9cfc4e9c75d00b822d1a0d07f28cb970932bf
|
F src/sqlite.h.in 8097161ad63e2a00e26217da43327d396371c2e5
|
||||||
F src/sqlite3ext.h 69dfb8116af51b84a029cddb3b35062354270c89
|
F src/sqlite3ext.h 69dfb8116af51b84a029cddb3b35062354270c89
|
||||||
F src/sqliteInt.h 1f81585797162269a0f18b77c815d552dad636c2
|
F src/sqliteInt.h 1f81585797162269a0f18b77c815d552dad636c2
|
||||||
F src/sqliteLimit.h 3afab2291762b5d09ae20c18feb8e9fa935a60a6
|
F src/sqliteLimit.h 3afab2291762b5d09ae20c18feb8e9fa935a60a6
|
||||||
@@ -188,7 +188,7 @@ F src/test_backup.c c129c91127e9b46e335715ae2e75756e25ba27de
|
|||||||
F src/test_btree.c 47cd771250f09cdc6e12dda5bc71bc0b3abc96e2
|
F src/test_btree.c 47cd771250f09cdc6e12dda5bc71bc0b3abc96e2
|
||||||
F src/test_config.c 6210f501d358bde619ae761f06f123529c6ba24f
|
F src/test_config.c 6210f501d358bde619ae761f06f123529c6ba24f
|
||||||
F src/test_demovfs.c da81a5f7785bb352bda7911c332a983ec4f17f27
|
F src/test_demovfs.c da81a5f7785bb352bda7911c332a983ec4f17f27
|
||||||
F src/test_devsym.c c05024cd179603181cde66d0ff83ce81e146f6de
|
F src/test_devsym.c 3d324248b80f31b3b29ab9bca39c4d856a2c9160
|
||||||
F src/test_func.c 13b582345fb1185a93e46c53310fae8547dcce20
|
F src/test_func.c 13b582345fb1185a93e46c53310fae8547dcce20
|
||||||
F src/test_hexio.c 1237f000ec7a491009b1233f5c626ea71bce1ea2
|
F src/test_hexio.c 1237f000ec7a491009b1233f5c626ea71bce1ea2
|
||||||
F src/test_init.c 5d624ffd0409d424cf9adbfe1f056b200270077c
|
F src/test_init.c 5d624ffd0409d424cf9adbfe1f056b200270077c
|
||||||
@@ -198,7 +198,7 @@ F src/test_journal.c 0537fcf9d4ecb394ec8b27d887a004ecaab85f16
|
|||||||
F src/test_loadext.c df586c27176e3c2cb2e099c78da67bf14379a56e
|
F src/test_loadext.c df586c27176e3c2cb2e099c78da67bf14379a56e
|
||||||
F src/test_malloc.c 2842c922b8e8d992aba722214952204ca025b411
|
F src/test_malloc.c 2842c922b8e8d992aba722214952204ca025b411
|
||||||
F src/test_mutex.c ce06b59aca168cd8c520b77159a24352a7469bd3
|
F src/test_mutex.c ce06b59aca168cd8c520b77159a24352a7469bd3
|
||||||
F src/test_onefile.c 1d098e7446d89087def7d20e0cdb77a0713ed1bf
|
F src/test_onefile.c d9585f6e2056868f208b0c21378a05b68c9ceae2
|
||||||
F src/test_osinst.c f5d1a4ee8b80fc58d1430c56146de748584013a9
|
F src/test_osinst.c f5d1a4ee8b80fc58d1430c56146de748584013a9
|
||||||
F src/test_pcache.c 7bf828972ac0d2403f5cfa4cd14da41f8ebe73d8
|
F src/test_pcache.c 7bf828972ac0d2403f5cfa4cd14da41f8ebe73d8
|
||||||
F src/test_schema.c 8c06ef9ddb240c7a0fcd31bc221a6a2aade58bf0
|
F src/test_schema.c 8c06ef9ddb240c7a0fcd31bc221a6a2aade58bf0
|
||||||
@@ -221,7 +221,7 @@ F src/vdbeblob.c 5327132a42a91e8b7acfb60b9d2c3b1c5c863e0e
|
|||||||
F src/vdbemem.c 2a82f455f6ca6f78b59fb312f96054c04ae0ead1
|
F src/vdbemem.c 2a82f455f6ca6f78b59fb312f96054c04ae0ead1
|
||||||
F src/vdbetrace.c 864cef96919323482ebd9986f2132435115e9cc2
|
F src/vdbetrace.c 864cef96919323482ebd9986f2132435115e9cc2
|
||||||
F src/vtab.c a0f8a40274e4261696ef57aa806de2776ab72cda
|
F src/vtab.c a0f8a40274e4261696ef57aa806de2776ab72cda
|
||||||
F src/wal.c 4a9b7fb028059992dfe51d23f0ced78064459c84
|
F src/wal.c dadd533e0103883f72bf541eaf1ef34adb4e3c99
|
||||||
F src/wal.h d6d4a6809151e30bed5b01dd05cf27858f5a7bc8
|
F src/wal.h d6d4a6809151e30bed5b01dd05cf27858f5a7bc8
|
||||||
F src/walker.c 3112bb3afe1d85dc52317cb1d752055e9a781f8f
|
F src/walker.c 3112bb3afe1d85dc52317cb1d752055e9a781f8f
|
||||||
F src/where.c 75fee9e255b62f773fcadd1d1f25b6f63ac7a356
|
F src/where.c 75fee9e255b62f773fcadd1d1f25b6f63ac7a356
|
||||||
@@ -808,7 +808,7 @@ F tool/speedtest2.tcl ee2149167303ba8e95af97873c575c3e0fab58ff
|
|||||||
F tool/speedtest8.c 2902c46588c40b55661e471d7a86e4dd71a18224
|
F tool/speedtest8.c 2902c46588c40b55661e471d7a86e4dd71a18224
|
||||||
F tool/speedtest8inst1.c 293327bc76823f473684d589a8160bde1f52c14e
|
F tool/speedtest8inst1.c 293327bc76823f473684d589a8160bde1f52c14e
|
||||||
F tool/vdbe-compress.tcl d70ea6d8a19e3571d7ab8c9b75cba86d1173ff0f
|
F tool/vdbe-compress.tcl d70ea6d8a19e3571d7ab8c9b75cba86d1173ff0f
|
||||||
P 6af2dca75b8139134ea394c1d71aefc6523f02e9
|
P 9803196dec85e3aa4105cc477e9cfe98d370e486 94dea5f9c11a68564220cec76ac3fae2ba90e907
|
||||||
R c94ad925a665396e6feea1ca0a681bf5
|
R 788341a84b9fc72cb664689f96e77759
|
||||||
U dan
|
U dan
|
||||||
Z 86d18456fd55c8daa32a6607f2d982a8
|
Z 74b01ac5f69a8df35f22fcc654a97307
|
||||||
|
|||||||
@@ -1 +1 @@
|
|||||||
9803196dec85e3aa4105cc477e9cfe98d370e486
|
23c0e6c3f333e878fe5a2ae5d61df0d765f437b4
|
||||||
@@ -4923,7 +4923,15 @@ static void unixShmPurge(void){
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
** Open a shared-memory area. This implementation uses mmapped files.
|
** Open a shared-memory area. This particular implementation uses
|
||||||
|
** mmapped files.
|
||||||
|
**
|
||||||
|
** zName is a filename used to identify the shared-memory area. The
|
||||||
|
** implementation does not (and perhaps should not) use this name
|
||||||
|
** directly, but rather use it as a template for finding an appropriate
|
||||||
|
** name for the shared-memory storage. In this implementation, the
|
||||||
|
** string "-index" is appended to zName and used as the name of the
|
||||||
|
** mmapped file.
|
||||||
**
|
**
|
||||||
** When opening a new shared-memory file, if no other instances of that
|
** When opening a new shared-memory file, if no other instances of that
|
||||||
** file are currently open, in this process or in other processes, then
|
** file are currently open, in this process or in other processes, then
|
||||||
@@ -4931,25 +4939,38 @@ static void unixShmPurge(void){
|
|||||||
*/
|
*/
|
||||||
static int unixShmOpen(
|
static int unixShmOpen(
|
||||||
sqlite3_vfs *pVfs, /* The VFS */
|
sqlite3_vfs *pVfs, /* The VFS */
|
||||||
const char *zName, /* Name of file to mmap */
|
const char *zName, /* Base name of file to mmap */
|
||||||
sqlite3_shm **pShm /* Write the unixShm object created here */
|
sqlite3_shm **pShm /* Write the unixShm object created here */
|
||||||
){
|
){
|
||||||
struct unixShm *p = 0; /* The connection to be opened */
|
struct unixShm *p = 0; /* The connection to be opened */
|
||||||
struct unixShmFile *pFile = 0; /* The underlying mmapped file */
|
struct unixShmFile *pFile = 0; /* The underlying mmapped file */
|
||||||
int rc; /* Result code */
|
int rc; /* Result code */
|
||||||
struct unixFileId fid; /* Unix file identifier */
|
struct unixFileId fid; /* Unix file identifier */
|
||||||
|
struct unixShmFile *pNew; /* Newly allocated pFile */
|
||||||
struct stat sStat; /* Result from stat() an fstat() */
|
struct stat sStat; /* Result from stat() an fstat() */
|
||||||
|
int nName; /* Size of zName in bytes */
|
||||||
|
|
||||||
/* Allocate space for the new sqlite3_shm object */
|
/* Allocate space for the new sqlite3_shm object. Also speculatively
|
||||||
|
** allocate space for a new unixShmFile and filename.
|
||||||
|
*/
|
||||||
p = sqlite3_malloc( sizeof(*p) );
|
p = sqlite3_malloc( sizeof(*p) );
|
||||||
if( p==0 ) return SQLITE_NOMEM;
|
if( p==0 ) return SQLITE_NOMEM;
|
||||||
memset(p, 0, sizeof(*p));
|
memset(p, 0, sizeof(*p));
|
||||||
|
nName = strlen(zName);
|
||||||
|
pNew = sqlite3_malloc( sizeof(*pFile) + nName + 10 );
|
||||||
|
if( pNew==0 ){
|
||||||
|
rc = SQLITE_NOMEM;
|
||||||
|
goto shm_open_err;
|
||||||
|
}
|
||||||
|
memset(pNew, 0, sizeof(*pNew));
|
||||||
|
pNew->zFilename = (char*)&pNew[1];
|
||||||
|
sqlite3_snprintf(nName+10, pNew->zFilename, "%s-index", zName);
|
||||||
|
|
||||||
/* Look to see if there is an existing unixShmFile that can be used.
|
/* Look to see if there is an existing unixShmFile that can be used.
|
||||||
** If no matching unixShmFile currently exists, create a new one.
|
** If no matching unixShmFile currently exists, create a new one.
|
||||||
*/
|
*/
|
||||||
unixEnterMutex();
|
unixEnterMutex();
|
||||||
rc = stat(zName, &sStat);
|
rc = stat(pNew->zFilename, &sStat);
|
||||||
if( rc==0 ){
|
if( rc==0 ){
|
||||||
memset(&fid, 0, sizeof(fid));
|
memset(&fid, 0, sizeof(fid));
|
||||||
fid.dev = sStat.st_dev;
|
fid.dev = sStat.st_dev;
|
||||||
@@ -4958,16 +4979,11 @@ static int unixShmOpen(
|
|||||||
if( memcmp(&pFile->fid, &fid, sizeof(fid))==0 ) break;
|
if( memcmp(&pFile->fid, &fid, sizeof(fid))==0 ) break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if( pFile==0 ){
|
if( pFile ){
|
||||||
int nName = strlen(zName);
|
sqlite3_free(pNew);
|
||||||
pFile = sqlite3_malloc( sizeof(*pFile) + nName + 1 );
|
}else{
|
||||||
if( pFile==0 ){
|
pFile = pNew;
|
||||||
rc = SQLITE_NOMEM;
|
pNew = 0;
|
||||||
goto shm_open_err;
|
|
||||||
}
|
|
||||||
memset(pFile, 0, sizeof(*pFile));
|
|
||||||
pFile->zFilename = (char*)&pFile[1];
|
|
||||||
memcpy(pFile->zFilename, zName, nName+1);
|
|
||||||
pFile->h = -1;
|
pFile->h = -1;
|
||||||
pFile->pNext = unixShmFileList;
|
pFile->pNext = unixShmFileList;
|
||||||
unixShmFileList = pFile;
|
unixShmFileList = pFile;
|
||||||
@@ -4983,7 +4999,7 @@ static int unixShmOpen(
|
|||||||
goto shm_open_err;
|
goto shm_open_err;
|
||||||
}
|
}
|
||||||
|
|
||||||
pFile->h = open(zName, O_RDWR|O_CREAT, 0664);
|
pFile->h = open(pFile->zFilename, O_RDWR|O_CREAT, 0664);
|
||||||
if( pFile->h<0 ){
|
if( pFile->h<0 ){
|
||||||
rc = SQLITE_CANTOPEN_BKPT;
|
rc = SQLITE_CANTOPEN_BKPT;
|
||||||
goto shm_open_err;
|
goto shm_open_err;
|
||||||
@@ -5033,15 +5049,17 @@ shm_open_err:
|
|||||||
unixShmPurge();
|
unixShmPurge();
|
||||||
sqlite3_free(p);
|
sqlite3_free(p);
|
||||||
sqlite3_free(pFile);
|
sqlite3_free(pFile);
|
||||||
|
sqlite3_free(pNew);
|
||||||
*pShm = 0;
|
*pShm = 0;
|
||||||
unixLeaveMutex();
|
unixLeaveMutex();
|
||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
** Close a connectioon to shared-memory.
|
** Close a connection to shared-memory. Delete the underlying
|
||||||
|
** storage if deleteFlag is true.
|
||||||
*/
|
*/
|
||||||
static int unixShmClose(sqlite3_shm *pSharedMem){
|
static int unixShmClose(sqlite3_shm *pSharedMem, int deleteFlag){
|
||||||
unixShm *p; /* The connection to be closed */
|
unixShm *p; /* The connection to be closed */
|
||||||
unixShmFile *pFile; /* The underlying shared-memory file */
|
unixShmFile *pFile; /* The underlying shared-memory file */
|
||||||
unixShm **pp; /* For looping over sibling connections */
|
unixShm **pp; /* For looping over sibling connections */
|
||||||
@@ -5069,6 +5087,7 @@ static int unixShmClose(sqlite3_shm *pSharedMem){
|
|||||||
assert( pFile->nRef>0 );
|
assert( pFile->nRef>0 );
|
||||||
pFile->nRef--;
|
pFile->nRef--;
|
||||||
if( pFile->nRef==0 ){
|
if( pFile->nRef==0 ){
|
||||||
|
if( deleteFlag ) unlink(pFile->zFilename);
|
||||||
unixShmPurge();
|
unixShmPurge();
|
||||||
}
|
}
|
||||||
unixLeaveMutex();
|
unixLeaveMutex();
|
||||||
@@ -5348,13 +5367,6 @@ static int unixShmLock(
|
|||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
** Delete a shared-memory segment from the system.
|
|
||||||
*/
|
|
||||||
static int unixShmDelete(sqlite3_vfs *pVfs, const char *zName){
|
|
||||||
return pVfs->xDelete(pVfs, zName, 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
#else
|
#else
|
||||||
# define unixShmOpen 0
|
# define unixShmOpen 0
|
||||||
# define unixShmSize 0
|
# define unixShmSize 0
|
||||||
@@ -5362,7 +5374,6 @@ static int unixShmDelete(sqlite3_vfs *pVfs, const char *zName){
|
|||||||
# define unixShmRelease 0
|
# define unixShmRelease 0
|
||||||
# define unixShmLock 0
|
# define unixShmLock 0
|
||||||
# define unixShmClose 0
|
# define unixShmClose 0
|
||||||
# define unixShmDelete 0
|
|
||||||
#endif /* #ifndef SQLITE_OMIT_WAL */
|
#endif /* #ifndef SQLITE_OMIT_WAL */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -6587,11 +6598,8 @@ int sqlite3_os_init(void){
|
|||||||
unixShmSize, /* xShmSize */ \
|
unixShmSize, /* xShmSize */ \
|
||||||
unixShmGet, /* xShmGet */ \
|
unixShmGet, /* xShmGet */ \
|
||||||
unixShmRelease, /* xShmRelease */ \
|
unixShmRelease, /* xShmRelease */ \
|
||||||
0, /* xShmPush */ \
|
|
||||||
0, /* xShmPull */ \
|
|
||||||
unixShmLock, /* xShmLock */ \
|
unixShmLock, /* xShmLock */ \
|
||||||
unixShmClose, /* xShmClose */ \
|
unixShmClose, /* xShmClose */ \
|
||||||
unixShmDelete, /* xShmDelete */ \
|
|
||||||
0, /* xRename */ \
|
0, /* xRename */ \
|
||||||
0, /* xCurrentTimeInt64 */ \
|
0, /* xCurrentTimeInt64 */ \
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -847,11 +847,8 @@ struct sqlite3_vfs {
|
|||||||
int (*xShmSize)(sqlite3_shm*, int reqSize, int *pNewSize);
|
int (*xShmSize)(sqlite3_shm*, int reqSize, int *pNewSize);
|
||||||
int (*xShmGet)(sqlite3_shm*, int reqMapSize, int *pMapSize, void**);
|
int (*xShmGet)(sqlite3_shm*, int reqMapSize, int *pMapSize, void**);
|
||||||
int (*xShmRelease)(sqlite3_shm*);
|
int (*xShmRelease)(sqlite3_shm*);
|
||||||
int (*xShmPush)(sqlite3_shm*);
|
|
||||||
int (*xShmPull)(sqlite3_shm*);
|
|
||||||
int (*xShmLock)(sqlite3_shm*, int desiredLock, int *gotLock);
|
int (*xShmLock)(sqlite3_shm*, int desiredLock, int *gotLock);
|
||||||
int (*xShmClose)(sqlite3_shm*);
|
int (*xShmClose)(sqlite3_shm*, int deleteFlag);
|
||||||
int (*xShmDelete)(sqlite3_vfs*, const char *zName);
|
|
||||||
int (*xRename)(sqlite3_vfs*, const char *zOld, const char *zNew, int dirSync);
|
int (*xRename)(sqlite3_vfs*, const char *zOld, const char *zNew, int dirSync);
|
||||||
int (*xCurrentTimeInt64)(sqlite3_vfs*, sqlite3_int64*);
|
int (*xCurrentTimeInt64)(sqlite3_vfs*, sqlite3_int64*);
|
||||||
/*
|
/*
|
||||||
|
|||||||
@@ -73,8 +73,7 @@ static int devsymShmSize(sqlite3_shm *, int , int *);
|
|||||||
static int devsymShmGet(sqlite3_shm *, int , int *, void **);
|
static int devsymShmGet(sqlite3_shm *, int , int *, void **);
|
||||||
static int devsymShmRelease(sqlite3_shm *);
|
static int devsymShmRelease(sqlite3_shm *);
|
||||||
static int devsymShmLock(sqlite3_shm *, int , int *);
|
static int devsymShmLock(sqlite3_shm *, int , int *);
|
||||||
static int devsymShmClose(sqlite3_shm *);
|
static int devsymShmClose(sqlite3_shm *, int);
|
||||||
static int devsymShmDelete(sqlite3_vfs *, const char *);
|
|
||||||
|
|
||||||
static sqlite3_vfs devsym_vfs = {
|
static sqlite3_vfs devsym_vfs = {
|
||||||
2, /* iVersion */
|
2, /* iVersion */
|
||||||
@@ -106,11 +105,8 @@ static sqlite3_vfs devsym_vfs = {
|
|||||||
devsymShmSize,
|
devsymShmSize,
|
||||||
devsymShmGet,
|
devsymShmGet,
|
||||||
devsymShmRelease,
|
devsymShmRelease,
|
||||||
0,
|
|
||||||
0,
|
|
||||||
devsymShmLock,
|
devsymShmLock,
|
||||||
devsymShmClose,
|
devsymShmClose,
|
||||||
devsymShmDelete,
|
|
||||||
0,
|
0,
|
||||||
0,
|
0,
|
||||||
};
|
};
|
||||||
@@ -378,11 +374,8 @@ static int devsymShmRelease(sqlite3_shm *p){
|
|||||||
static int devsymShmLock(sqlite3_shm *p, int desiredLock, int *gotLock){
|
static int devsymShmLock(sqlite3_shm *p, int desiredLock, int *gotLock){
|
||||||
return g.pVfs->xShmLock(p, desiredLock, gotLock);
|
return g.pVfs->xShmLock(p, desiredLock, gotLock);
|
||||||
}
|
}
|
||||||
static int devsymShmClose(sqlite3_shm *p){
|
static int devsymShmClose(sqlite3_shm *p, int deleteFlag){
|
||||||
return g.pVfs->xShmClose(p);
|
return g.pVfs->xShmClose(p, deleteFlag);
|
||||||
}
|
|
||||||
static int devsymShmDelete(sqlite3_vfs *pVfs, const char *zName){
|
|
||||||
return g.pVfs->xShmDelete(g.pVfs, zName);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -400,7 +393,6 @@ void devsym_register(int iDeviceChar, int iSectorSize){
|
|||||||
devsym_vfs.xShmRelease = (g.pVfs->xShmRelease ? devsymShmRelease : 0);
|
devsym_vfs.xShmRelease = (g.pVfs->xShmRelease ? devsymShmRelease : 0);
|
||||||
devsym_vfs.xShmLock = (g.pVfs->xShmLock ? devsymShmLock : 0);
|
devsym_vfs.xShmLock = (g.pVfs->xShmLock ? devsymShmLock : 0);
|
||||||
devsym_vfs.xShmClose = (g.pVfs->xShmClose ? devsymShmClose : 0);
|
devsym_vfs.xShmClose = (g.pVfs->xShmClose ? devsymShmClose : 0);
|
||||||
devsym_vfs.xShmDelete = (g.pVfs->xShmDelete ? devsymShmDelete : 0);
|
|
||||||
sqlite3_vfs_register(&devsym_vfs, 0);
|
sqlite3_vfs_register(&devsym_vfs, 0);
|
||||||
}
|
}
|
||||||
if( iDeviceChar>=0 ){
|
if( iDeviceChar>=0 ){
|
||||||
|
|||||||
@@ -201,8 +201,6 @@ static fs_vfs_t fs_vfs = {
|
|||||||
fsCurrentTime, /* xCurrentTime */
|
fsCurrentTime, /* xCurrentTime */
|
||||||
0, /* xShmOpen */
|
0, /* xShmOpen */
|
||||||
0, /* xShmSize */
|
0, /* xShmSize */
|
||||||
0, /* xShmPush */
|
|
||||||
0, /* xShmPull */
|
|
||||||
0, /* xShmLock */
|
0, /* xShmLock */
|
||||||
0, /* xShmClose */
|
0, /* xShmClose */
|
||||||
0, /* xShmDelete */
|
0, /* xShmDelete */
|
||||||
|
|||||||
19
src/wal.c
19
src/wal.c
@@ -133,6 +133,7 @@ struct Wal {
|
|||||||
u8 lockState; /* SQLITE_SHM_xxxx constant showing lock state */
|
u8 lockState; /* SQLITE_SHM_xxxx constant showing lock state */
|
||||||
u8 readerType; /* SQLITE_SHM_READ or SQLITE_SHM_READ_FULL */
|
u8 readerType; /* SQLITE_SHM_READ or SQLITE_SHM_READ_FULL */
|
||||||
WalIndexHdr hdr; /* Wal-index for current snapshot */
|
WalIndexHdr hdr; /* Wal-index for current snapshot */
|
||||||
|
char *zName; /* Name of underlying storage */
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@@ -590,24 +591,23 @@ int sqlite3WalOpen(
|
|||||||
/* Allocate an instance of struct Wal to return. */
|
/* Allocate an instance of struct Wal to return. */
|
||||||
*ppWal = 0;
|
*ppWal = 0;
|
||||||
nWal = strlen(zDb);
|
nWal = strlen(zDb);
|
||||||
pRet = (Wal*)sqlite3MallocZero(sizeof(Wal) + pVfs->szOsFile + nWal+11);
|
pRet = (Wal*)sqlite3MallocZero(sizeof(Wal) + pVfs->szOsFile + nWal+5);
|
||||||
if( !pRet ) goto wal_open_out;
|
if( !pRet ) goto wal_open_out;
|
||||||
pRet->pVfs = pVfs;
|
pRet->pVfs = pVfs;
|
||||||
pRet->pFd = (sqlite3_file *)&pRet[1];
|
pRet->pFd = (sqlite3_file *)&pRet[1];
|
||||||
zWal = pVfs->szOsFile + (char*)pRet->pFd;
|
pRet->zName = zWal = pVfs->szOsFile + (char*)pRet->pFd;
|
||||||
sqlite3_snprintf(nWal+11, zWal, "%s-wal-index", zDb);
|
sqlite3_snprintf(nWal+5, zWal, "%s-wal", zDb);
|
||||||
rc = pVfs->xShmOpen(pVfs, zWal, &pRet->pWIndex);
|
rc = pVfs->xShmOpen(pVfs, zWal, &pRet->pWIndex);
|
||||||
if( rc ) goto wal_open_out;
|
if( rc ) goto wal_open_out;
|
||||||
|
|
||||||
/* Open file handle on the write-ahead log file. */
|
/* Open file handle on the write-ahead log file. */
|
||||||
zWal[nWal+4] = 0;
|
|
||||||
flags = (SQLITE_OPEN_READWRITE|SQLITE_OPEN_CREATE|SQLITE_OPEN_MAIN_JOURNAL);
|
flags = (SQLITE_OPEN_READWRITE|SQLITE_OPEN_CREATE|SQLITE_OPEN_MAIN_JOURNAL);
|
||||||
rc = sqlite3OsOpen(pVfs, zWal, pRet->pFd, flags, &flags);
|
rc = sqlite3OsOpen(pVfs, zWal, pRet->pFd, flags, &flags);
|
||||||
|
|
||||||
wal_open_out:
|
wal_open_out:
|
||||||
if( rc!=SQLITE_OK ){
|
if( rc!=SQLITE_OK ){
|
||||||
if( pRet ){
|
if( pRet ){
|
||||||
pVfs->xShmClose(pRet->pWIndex);
|
pVfs->xShmClose(pRet->pWIndex, 0);
|
||||||
sqlite3OsClose(pRet->pFd);
|
sqlite3OsClose(pRet->pFd);
|
||||||
sqlite3_free(pRet);
|
sqlite3_free(pRet);
|
||||||
}
|
}
|
||||||
@@ -805,15 +805,10 @@ int sqlite3WalClose(
|
|||||||
walIndexUnmap(pWal);
|
walIndexUnmap(pWal);
|
||||||
}
|
}
|
||||||
|
|
||||||
pWal->pVfs->xShmClose(pWal->pWIndex);
|
pWal->pVfs->xShmClose(pWal->pWIndex, isDelete);
|
||||||
sqlite3OsClose(pWal->pFd);
|
sqlite3OsClose(pWal->pFd);
|
||||||
if( isDelete ){
|
if( isDelete ){
|
||||||
int nWal;
|
sqlite3OsDelete(pWal->pVfs, pWal->zName, 0);
|
||||||
char *zWal = &((char *)pWal->pFd)[pWal->pVfs->szOsFile];
|
|
||||||
sqlite3OsDelete(pWal->pVfs, zWal, 0);
|
|
||||||
nWal = sqlite3Strlen30(zWal);
|
|
||||||
memcpy(&zWal[nWal], "-index", 7);
|
|
||||||
pWal->pVfs->xShmDelete(pWal->pVfs, zWal);
|
|
||||||
}
|
}
|
||||||
sqlite3_free(pWal);
|
sqlite3_free(pWal);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user