From 7d4514a4e16322182a06b2e4e24fc6cd639cff79 Mon Sep 17 00:00:00 2001 From: dan Date: Thu, 15 Jul 2010 17:54:14 +0000 Subject: [PATCH] Handle the case where xShmMap returns SQLITE_BUSY. FossilOrigin-Name: 75f5354876c4300a8e53fe551dc837dd383d1e38 --- manifest | 12 ++++++------ manifest.uuid | 2 +- src/wal.c | 12 ++++++++++-- 3 files changed, 17 insertions(+), 9 deletions(-) diff --git a/manifest b/manifest index d0191b4abc..59bd74df4c 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C When\screating\sa\sjournal\sfile\son\sunix,\sattempt\sto\screate\sit\swith\sthe\ssame\spermissions\sas\sthe\sassociated\sdatabase\sfile. -D 2010-07-15T14:59:38 +C Handle\sthe\scase\swhere\sxShmMap\sreturns\sSQLITE_BUSY. +D 2010-07-15T17:54:15 F Makefile.arm-wince-mingw32ce-gcc fcd5e9cd67fe88836360bb4f9ef4cb7f8e2fb5a0 F Makefile.in ec08dc838fd8110fe24c92e5130bcd91cbb1ff2e F Makefile.linux-gcc d53183f4aa6a9192d249731c90dbdffbd2c68654 @@ -227,7 +227,7 @@ F src/vdbeblob.c 258a6010ba7a82b72b327fb24c55790655689256 F src/vdbemem.c 5e579abf6532001dfbee0e640dc34eae897a9807 F src/vdbetrace.c 864cef96919323482ebd9986f2132435115e9cc2 F src/vtab.c a0f8a40274e4261696ef57aa806de2776ab72cda -F src/wal.c 656d50bb0b64f79353110a0b50790edfc0da08e9 +F src/wal.c 66e9034aa9076ce2dbf9ac1ba9fbb9d52ef77c52 F src/wal.h 906c85760598b18584921fe08008435aa4eeeeb2 F src/walker.c 3112bb3afe1d85dc52317cb1d752055e9a781f8f F src/where.c 903a7828a0a7de03b5d0f1b5eff222d8d5b138f1 @@ -836,7 +836,7 @@ F tool/speedtest2.tcl ee2149167303ba8e95af97873c575c3e0fab58ff F tool/speedtest8.c 2902c46588c40b55661e471d7a86e4dd71a18224 F tool/speedtest8inst1.c 293327bc76823f473684d589a8160bde1f52c14e F tool/vdbe-compress.tcl d70ea6d8a19e3571d7ab8c9b75cba86d1173ff0f -P dea7d33b2d7d25280a31a2b9c1573f4292b81187 -R 68b8490911573c353c565f7397abe3e4 +P a121cd80c5ac94e5977bc3164d2500e0ea132fed +R b291f8d91c6eb25a36e00bd7f65fa871 U dan -Z 3d98b70e949007093904a9e0327dbd7d +Z 6941f09d52700154471a2c362441f818 diff --git a/manifest.uuid b/manifest.uuid index dd18395806..773df51172 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -a121cd80c5ac94e5977bc3164d2500e0ea132fed \ No newline at end of file +75f5354876c4300a8e53fe551dc837dd383d1e38 \ No newline at end of file diff --git a/src/wal.c b/src/wal.c index 769db036da..261bed1963 100644 --- a/src/wal.c +++ b/src/wal.c @@ -1866,8 +1866,16 @@ static int walTryBeginRead(Wal *pWal, int *pChanged, int useWal, int cnt){ ** WAL_RETRY this routine will be called again and will probably be ** right on the second iteration. */ - rc = walLockShared(pWal, WAL_RECOVER_LOCK); - if( rc==SQLITE_OK ){ + if( pWal->apWiData[0]==0 ){ + /* This branch is taken when the xShmMap() method returns SQLITE_BUSY. + ** We assume this is a transient condition, so return WAL_RETRY. The + ** xShmMap() implementation used by the default unix and win32 VFS + ** modules may return SQLITE_BUSY due to a race condition in the + ** code that determines whether or not the shared-memory region + ** must be zeroed before the requested page is returned. + */ + rc = WAL_RETRY; + }else if( SQLITE_OK==(rc = walLockShared(pWal, WAL_RECOVER_LOCK)) ){ walUnlockShared(pWal, WAL_RECOVER_LOCK); rc = WAL_RETRY; }else if( rc==SQLITE_BUSY ){