/ Check-in [83e6a75e]
Login

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

Overview
Comment:Fix ioerr5.test so that it works with the new pcache module. (CVS 5636)
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1:83e6a75e7d70b4b01f0892924d7a8a49d5ef6bf2
User & Date: danielk1977 2008-08-28 18:35:34
Context
2008-08-29
02:14
Avoid reevaluating WHERE and ORDER BY expressions that alias terms in the result set. Ticket #3343. Note that aliased GROUP BY expressions are still evaluated twice. (CVS 5637) check-in: ab0292ca user: drh tags: trunk
2008-08-28
18:35
Fix ioerr5.test so that it works with the new pcache module. (CVS 5636) check-in: 83e6a75e user: danielk1977 tags: trunk
17:46
Partial fix for a bug in recovery from xStress failures in pcache. (CVS 5635) check-in: 44193b92 user: drh tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to test/ioerr5.test.

10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
..
73
74
75
76
77
78
79

80
81
82
83
84
85
86
...
113
114
115
116
117
118
119

120
121
122
123













124
125
126
127
128
129
130
131
132
#***********************************************************************
#
# This file tests that if sqlite3_release_memory() is called to reclaim
# memory from a pager that is in the error-state, SQLite does not 
# incorrectly write dirty pages out to the database (not safe to do
# once the pager is in error state).
#
# $Id: ioerr5.test,v 1.4 2008/07/12 14:52:20 drh Exp $

set testdir [file dirname $argv0]
source $testdir/tester.tcl

ifcapable !memorymanage||!shared_cache {
  finish_test
  return
................................................................................
#
do_test ioerr5-1.0 {
  opendatabases
  execsql { CREATE TABLE A(Id INTEGER, Name TEXT) }
} {}

foreach locking_mode {normal exclusive} {

  for {set iFail 1} {$iFail<200} {incr iFail} {
    sqlite3_soft_heap_limit 1048576
    opendatabases
    execsql { pragma locking_mode=exclusive }
    set nRow [db one {SELECT count(*) FROM a}]
  
    # Dirty (at least) one of the pages in the cache.
................................................................................

    # Set a very low soft-limit and then try to compile an SQL statement 
    # from UTF-16 text. To do this, SQLite will need to reclaim memory
    # from the pager that is in error state. Including that associated
    # with the dirty page.
    #
    do_test ioerr5-1.$locking_mode-$iFail.3 {

      sqlite3_soft_heap_limit 1024
      compilesql16 "SELECT 10"
      set bt [btree_from_db db]
      array set stats [btree_pager_stats $bt]













      set stats(page)
    } {0}

    # Ensure that nothing was written to the database while reclaiming
    # memory from the pager in error state.
    #
    do_test ioerr5-1.$locking_mode-$iFail.4 {
      set fd [open test.db]
      fconfigure $fd -translation binary -encoding binary







|







 







>







 







>


<

>
>
>
>
>
>
>
>
>
>
>
>
>
|
|







10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
..
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
...
114
115
116
117
118
119
120
121
122
123

124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
#***********************************************************************
#
# This file tests that if sqlite3_release_memory() is called to reclaim
# memory from a pager that is in the error-state, SQLite does not 
# incorrectly write dirty pages out to the database (not safe to do
# once the pager is in error state).
#
# $Id: ioerr5.test,v 1.5 2008/08/28 18:35:34 danielk1977 Exp $

set testdir [file dirname $argv0]
source $testdir/tester.tcl

ifcapable !memorymanage||!shared_cache {
  finish_test
  return
................................................................................
#
do_test ioerr5-1.0 {
  opendatabases
  execsql { CREATE TABLE A(Id INTEGER, Name TEXT) }
} {}

foreach locking_mode {normal exclusive} {
  set nPage 2
  for {set iFail 1} {$iFail<200} {incr iFail} {
    sqlite3_soft_heap_limit 1048576
    opendatabases
    execsql { pragma locking_mode=exclusive }
    set nRow [db one {SELECT count(*) FROM a}]
  
    # Dirty (at least) one of the pages in the cache.
................................................................................

    # Set a very low soft-limit and then try to compile an SQL statement 
    # from UTF-16 text. To do this, SQLite will need to reclaim memory
    # from the pager that is in error state. Including that associated
    # with the dirty page.
    #
    do_test ioerr5-1.$locking_mode-$iFail.3 {
      set bt [btree_from_db db]
      sqlite3_soft_heap_limit 1024
      compilesql16 "SELECT 10"

      array set stats [btree_pager_stats $bt]

      # If the pager made it all the way to PAGER_SYNCED state, then 
      # both in-memory pages are clean. Following the calls to 
      # release_memory() that were made as part of the [compilesql16]
      # above, there will be zero pages left in the cache.
      #
      # If the pager did not make it as far as PAGER_SYNCED, the two
      # in memory pages are still dirty. So there will be 2 pages left
      # in the cache following the release_memory() calls.
      #
      if {$stats(state)==5} {
        set nPage 0
      }
      expr {$stats(page)==$nPage}
    } {1}

    # Ensure that nothing was written to the database while reclaiming
    # memory from the pager in error state.
    #
    do_test ioerr5-1.$locking_mode-$iFail.4 {
      set fd [open test.db]
      fconfigure $fd -translation binary -encoding binary