/ Check-in [30d01344]
Login

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

Overview
Comment:Do not attempt to set journal_mode=wal on :memory: or temp file databases.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | wal
Files: files | file ages | folders
SHA1: 30d0134454734fd9335896372c30a903e9adcc64
User & Date: dan 2010-04-26 17:42:56
Context
2010-04-27
01:56
Merge in recent changes from the trunk check-in: 7a0ac682 user: drh tags: wal
2010-04-26
17:42
Do not attempt to set journal_mode=wal on :memory: or temp file databases. check-in: 30d01344 user: dan tags: wal
16:57
Fixes for problems with small caches and SAVEPOINT rollback in WAL mode. check-in: 6a944f02 user: dan tags: wal
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to src/vdbe.c.

5226
5227
5228
5229
5230
5231
5232






5233
5234
5235
5236
5237
5238
5239
       || eNew==PAGER_JOURNALMODE_QUERY
  );
  assert( pOp->p1>=0 && pOp->p1<db->nDb );
  assert( (p->btreeMask & (1<<pOp->p1))!=0 );

  pBt = db->aDb[pOp->p1].pBt;
  pPager = sqlite3BtreePager(pBt);







  if( eNew!=PAGER_JOURNALMODE_QUERY ){
    int eOld = sqlite3PagerJournalMode(pPager, PAGER_JOURNALMODE_QUERY);
    if( (eNew!=eOld)
     && (eOld==PAGER_JOURNALMODE_WAL || eNew==PAGER_JOURNALMODE_WAL)
    ){
      if( !db->autoCommit || db->activeVdbeCnt>1 ){







>
>
>
>
>
>







5226
5227
5228
5229
5230
5231
5232
5233
5234
5235
5236
5237
5238
5239
5240
5241
5242
5243
5244
5245
       || eNew==PAGER_JOURNALMODE_QUERY
  );
  assert( pOp->p1>=0 && pOp->p1<db->nDb );
  assert( (p->btreeMask & (1<<pOp->p1))!=0 );

  pBt = db->aDb[pOp->p1].pBt;
  pPager = sqlite3BtreePager(pBt);

  if( 0==sqlite3Strlen30(sqlite3BtreeGetFilename(pBt)) 
   && eNew==PAGER_JOURNALMODE_WAL 
  ){
    eNew = PAGER_JOURNALMODE_QUERY;
  }

  if( eNew!=PAGER_JOURNALMODE_QUERY ){
    int eOld = sqlite3PagerJournalMode(pPager, PAGER_JOURNALMODE_QUERY);
    if( (eNew!=eOld)
     && (eOld==PAGER_JOURNALMODE_WAL || eNew==PAGER_JOURNALMODE_WAL)
    ){
      if( !db->autoCommit || db->activeVdbeCnt>1 ){

Changes to test/savepoint6.test.

21
22
23
24
25
26
27


28
29
30
31
32
33
34
...
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265

set DATABASE_SCHEMA {
    PRAGMA auto_vacuum = incremental;
    CREATE TABLE t1(x, y);
    CREATE UNIQUE INDEX i1 ON t1(x);
    CREATE INDEX i2 ON t1(y);
}



#--------------------------------------------------------------------------
# In memory database state.
#
# ::lSavepoint is a list containing one entry for each active savepoint. The
# first entry in the list corresponds to the most recently opened savepoint.
# Each entry consists of two elements:
................................................................................
  do_test savepoint6-$testname.setup {
    savepoint one
    insert_rows [random_integers 100 1000]
    release one
    checkdb
  } {ok}
  
  for {set i 0} {$i < 50} {incr i} {
    do_test savepoint6-$testname.$i.1 {
      savepoint_op
      checkdb
    } {ok}
  
    do_test savepoint6-$testname.$i.2 {
      database_op







>
>







 







|







21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
...
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267

set DATABASE_SCHEMA {
    PRAGMA auto_vacuum = incremental;
    CREATE TABLE t1(x, y);
    CREATE UNIQUE INDEX i1 ON t1(x);
    CREATE INDEX i2 ON t1(y);
}

set ::ITERATIONS 1000

#--------------------------------------------------------------------------
# In memory database state.
#
# ::lSavepoint is a list containing one entry for each active savepoint. The
# first entry in the list corresponds to the most recently opened savepoint.
# Each entry consists of two elements:
................................................................................
  do_test savepoint6-$testname.setup {
    savepoint one
    insert_rows [random_integers 100 1000]
    release one
    checkdb
  } {ok}
  
  for {set i 0} {$i < $::ITERATIONS} {incr i} {
    do_test savepoint6-$testname.$i.1 {
      savepoint_op
      checkdb
    } {ok}
  
    do_test savepoint6-$testname.$i.2 {
      database_op

Changes to test/walmode.test.

135
136
137
138
139
140
141
142
143
144
145




























































































146
147
} {delete}
do_test walmode-4.10 {
  catchsql { PRAGMA main.journal_mode = wal } db
} {1 {database is locked}}
do_test walmode-4.11 {
  execsql { PRAGMA main.journal_mode } db
} {delete}


catch { db close }
catch { db2 close }




























































































finish_test








<
<


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


135
136
137
138
139
140
141


142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
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
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
} {delete}
do_test walmode-4.10 {
  catchsql { PRAGMA main.journal_mode = wal } db
} {1 {database is locked}}
do_test walmode-4.11 {
  execsql { PRAGMA main.journal_mode } db
} {delete}


catch { db close }
catch { db2 close }

# Test that it is not possible to change a temporary or in-memory database
# to WAL mode. WAL mode is for persistent file-backed databases only.
#
#   walmode-5.1.*: Try to set journal_mode=WAL on [sqlite3 db :memory:] database.
#   walmode-5.2.*: Try to set journal_mode=WAL on [sqlite3 db ""] database.
#   walmode-5.3.*: Try to set temp.journal_mode=WAL.
#
do_test walmode-5.1.1 {
  sqlite3 db :memory:
  execsql { PRAGMA main.journal_mode }
} {memory}
do_test walmode-5.1.2 {
  execsql { PRAGMA main.journal_mode = wal }
} {memory}
do_test walmode-5.1.3 {
  execsql {
    BEGIN;
      CREATE TABLE t1(a, b);
      INSERT INTO t1 VALUES(1, 2);
    COMMIT;
    SELECT * FROM t1;
    PRAGMA main.journal_mode;
  }
} {1 2 memory}
do_test walmode-5.1.4 {
  execsql { PRAGMA main.journal_mode = wal }
} {memory}
do_test walmode-5.1.5 {
  execsql { 
    INSERT INTO t1 VALUES(3, 4);
    SELECT * FROM t1;
    PRAGMA main.journal_mode;
  }
} {1 2 3 4 memory}

do_test walmode-5.2.1 {
  sqlite3 db ""
  execsql { PRAGMA main.journal_mode }
} {delete}
do_test walmode-5.2.2 {
  execsql { PRAGMA main.journal_mode = wal }
} {delete}
do_test walmode-5.2.3 {
  execsql {
    BEGIN;
      CREATE TABLE t1(a, b);
      INSERT INTO t1 VALUES(1, 2);
    COMMIT;
    SELECT * FROM t1;
    PRAGMA main.journal_mode;
  }
} {1 2 delete}
do_test walmode-5.2.4 {
  execsql { PRAGMA main.journal_mode = wal }
} {delete}
do_test walmode-5.2.5 {
  execsql { 
    INSERT INTO t1 VALUES(3, 4);
    SELECT * FROM t1;
    PRAGMA main.journal_mode;
  }
} {1 2 3 4 delete}

do_test walmode-5.3.1 {
  sqlite3 db test.db
  execsql { PRAGMA temp.journal_mode }
} {delete}
do_test walmode-5.3.2 {
  execsql { PRAGMA temp.journal_mode = wal }
} {delete}
do_test walmode-5.3.3 {
  execsql {
    BEGIN;
      CREATE TEMP TABLE t1(a, b);
      INSERT INTO t1 VALUES(1, 2);
    COMMIT;
    SELECT * FROM t1;
    PRAGMA temp.journal_mode;
  }
} {1 2 delete}
do_test walmode-5.3.4 {
  execsql { PRAGMA temp.journal_mode = wal }
} {delete}
do_test walmode-5.3.5 {
  execsql { 
    INSERT INTO t1 VALUES(3, 4);
    SELECT * FROM t1;
    PRAGMA temp.journal_mode;
  }
} {1 2 3 4 delete}

finish_test