SQLite

Check-in [74f5d3b07f]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Do not allow the use of WAL mode with nolock=1 because it does not work.
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 74f5d3b07f6e5e977858c73957c6f9337ae3ca3e
User & Date: drh 2016-03-11 23:07:30.911
Context
2016-03-12
16:32
Fix handling of strings that contain zero tokens in fts5. And other problems found by fuzzing. (check-in: 72b3ff0f0d user: dan tags: trunk)
2016-03-11
23:07
Do not allow the use of WAL mode with nolock=1 because it does not work. (check-in: 74f5d3b07f user: drh tags: trunk)
15:25
Tweak the amalgamation autoconf files so that the --disable-static-shell option works again. (check-in: 83efcdebfa user: dan tags: trunk)
Changes
Unified Diff Ignore Whitespace Patch
Changes to src/pager.c.
7163
7164
7165
7166
7167
7168
7169

7170
7171
7172
7173
7174
7175
7176

/*
** Return true if the underlying VFS for the given pager supports the
** primitives necessary for write-ahead logging.
*/
int sqlite3PagerWalSupported(Pager *pPager){
  const sqlite3_io_methods *pMethods = pPager->fd->pMethods;

  return pPager->exclusiveMode || (pMethods->iVersion>=2 && pMethods->xShmMap);
}

/*
** Attempt to take an exclusive lock on the database file. If a PENDING lock
** is obtained instead, immediately release it.
*/







>







7163
7164
7165
7166
7167
7168
7169
7170
7171
7172
7173
7174
7175
7176
7177

/*
** Return true if the underlying VFS for the given pager supports the
** primitives necessary for write-ahead logging.
*/
int sqlite3PagerWalSupported(Pager *pPager){
  const sqlite3_io_methods *pMethods = pPager->fd->pMethods;
  if( pPager->noLock ) return 0;
  return pPager->exclusiveMode || (pMethods->iVersion>=2 && pMethods->xShmMap);
}

/*
** Attempt to take an exclusive lock on the database file. If a PENDING lock
** is obtained instead, immediately release it.
*/
Changes to test/nolock.test.
178
179
180
181
182
183
184
































185
       xCheckReservedLock $::tvfs_calls(xCheckReservedLock) \
       xAccess $::tvfs_calls(xAccess)
} {xLock 0 xUnlock 0 xCheckReservedLock 0 xAccess 0}

db2 close
db close
tvfs delete
































finish_test







>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>

178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
       xCheckReservedLock $::tvfs_calls(xCheckReservedLock) \
       xAccess $::tvfs_calls(xAccess)
} {xLock 0 xUnlock 0 xCheckReservedLock 0 xAccess 0}

db2 close
db close
tvfs delete

# 2016-03-11:  Make sure all works when transitioning to WAL mode under nolock.
#
do_test nolock-4.1 {
  forcedelete test.db
  sqlite3 db file:test.db?nolock=1 -uri 1
  db eval {
     PRAGMA journal_mode=WAL;
     CREATE TABLE t1(x);
     INSERT INTO t1 VALUES('youngling');
     SELECT * FROM t1;
  }
} {delete youngling}
db close

do_test nolock-4.2 {
  forcedelete test.db
  sqlite3 db test.db
  db eval {
    PRAGMA journal_mode=WAL;
    CREATE TABLE t1(x);
    INSERT INTO t1 VALUES('catbird');
    SELECT * FROM t1;
  }
} {wal catbird}
do_test nolock-4.3 {
  db close
  sqlite3 db file:test.db?nolock=1 -uri 1
  set rc [catch {db eval {SELECT * FROM t1}} msg]
  lappend rc $msg
} {1 {unable to open database file}}

finish_test