SQLite

Check-in [4894a5d210]
Login

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

Overview
Comment:Modify test_journal.c to work with pre-allocated databases.
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | experimental
Files: files | file ages | folders
SHA1: 4894a5d21044b169f412fef095e689cb8a8575dc
User & Date: dan 2010-08-06 09:43:04.000
Context
2010-08-06
12:00
Further updates to comments in pager.c. (check-in: 5f4c17a33f user: dan tags: experimental)
09:43
Modify test_journal.c to work with pre-allocated databases. (check-in: 4894a5d210 user: dan tags: experimental)
06:54
Fix a bug to do with deleting the journal file when exiting exclusive-locking mode. (check-in: 6217b607f0 user: dan tags: experimental)
Changes
Unified Diff Ignore Whitespace Patch
Changes to src/test_journal.c.
375
376
377
378
379
380
381









382
383
384
385
386
387
388

    stop_ioerr_simulation(&iSave, &iSave2);

    /* Read the database free-list. Add the page-number for each free-list
    ** leaf to the jt_file.pWritable bitvec.
    */
    rc = sqlite3OsRead(p, aData, pMain->nPagesize, 0);









    iTrunk = decodeUint32(&aData[32]);
    while( rc==SQLITE_OK && iTrunk>0 ){
      u32 nLeaf;
      u32 iLeaf;
      sqlite3_int64 iOff = (iTrunk-1)*pMain->nPagesize;
      rc = sqlite3OsRead(p, aData, pMain->nPagesize, iOff);
      nLeaf = decodeUint32(&aData[4]);







>
>
>
>
>
>
>
>
>







375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397

    stop_ioerr_simulation(&iSave, &iSave2);

    /* Read the database free-list. Add the page-number for each free-list
    ** leaf to the jt_file.pWritable bitvec.
    */
    rc = sqlite3OsRead(p, aData, pMain->nPagesize, 0);
    if( rc==SQLITE_OK ){
      u32 nDbsize = decodeUint32(&aData[28]);
      if( nDbsize>0 && memcmp(&aData[24], &aData[92], 4)==0 ){
        u32 iPg;
        for(iPg=nDbsize+1; iPg<=pMain->nPage; iPg++){
          sqlite3BitvecSet(pMain->pWritable, iPg);
        }
      }
    }
    iTrunk = decodeUint32(&aData[32]);
    while( rc==SQLITE_OK && iTrunk>0 ){
      u32 nLeaf;
      u32 iLeaf;
      sqlite3_int64 iOff = (iTrunk-1)*pMain->nPagesize;
      rc = sqlite3OsRead(p, aData, pMain->nPagesize, iOff);
      nLeaf = decodeUint32(&aData[4]);
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
  start_ioerr_simulation(iSave, iSave2);
  sqlite3_free(aPage);
  if( rc==SQLITE_IOERR_SHORT_READ ){
    rc = SQLITE_OK;
  }
  return rc;
}


/*
** Write data to an jt-file.
*/
static int jtWrite(
  sqlite3_file *pFile, 
  const void *zBuf, 







<







496
497
498
499
500
501
502

503
504
505
506
507
508
509
  start_ioerr_simulation(iSave, iSave2);
  sqlite3_free(aPage);
  if( rc==SQLITE_IOERR_SHORT_READ ){
    rc = SQLITE_OK;
  }
  return rc;
}


/*
** Write data to an jt-file.
*/
static int jtWrite(
  sqlite3_file *pFile, 
  const void *zBuf, 
Changes to test/fallocate.test.
64
65
66
67
68
69
70




71
72
73
74
75
76
77
do_test fallocate-1.8 { execsql { COMMIT } } {}


#-------------------------------------------------------------------------
# The following tests - fallocate-2.* - test that things work in WAL
# mode as well.
#




db close
file delete -force test.db
sqlite3 db test.db
file_control_chunksize_test db main [expr 32*1024]

do_test fallocate-2.1 {
  execsql {







>
>
>
>







64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
do_test fallocate-1.8 { execsql { COMMIT } } {}


#-------------------------------------------------------------------------
# The following tests - fallocate-2.* - test that things work in WAL
# mode as well.
#
set skipwaltests [expr {[permutation]=="journaltest"}]
ifcapable !wal { set skipwaltests 1 }

if {!$skipwaltests} {
db close
file delete -force test.db
sqlite3 db test.db
file_control_chunksize_test db main [expr 32*1024]

do_test fallocate-2.1 {
  execsql {
125
126
127
128
129
130
131


132
133
134
135
} {1}

do_test fallocate-2.8 {
  execsql { COMMIT } db2
  execsql { PRAGMA wal_checkpoint }
  file size test.db
} [expr 32*1024]




finish_test








>
>




129
130
131
132
133
134
135
136
137
138
139
140
141
} {1}

do_test fallocate-2.8 {
  execsql { COMMIT } db2
  execsql { PRAGMA wal_checkpoint }
  file size test.db
} [expr 32*1024]

}


finish_test