SQLite

Check-in [eba171e980]
Login

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

Overview
Comment:Update a couple of test cases to account for the fact that ROLLBACK does not always abort all running SELECT statements.
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | branch-3.8.7
Files: files | file ages | folders
SHA1: eba171e980fa4491dfee9d7e4df50c87a0ebbf87
User & Date: dan 2014-11-17 15:22:08.993
Context
2014-11-18
20:16
Update a couple of test cases to account for the fact that ROLLBACK does not always abort all running SELECT statements. (check-in: abccda769a user: drh tags: trunk)
2014-11-17
15:32
Fix a bug in the sqlite3TripAllCursors() routine that prevents it from reporting errors. It is unknown at this time whether or not this omission can result in any incorrect result in an actual query. (check-in: 42588207ff user: drh tags: branch-3.8.7)
15:22
Update a couple of test cases to account for the fact that ROLLBACK does not always abort all running SELECT statements. (check-in: eba171e980 user: dan tags: branch-3.8.7)
2014-11-14
15:42
Do not automatically remove the DISTINCT keyword from "a IN (SELECT DISTINCT ...)" expressions. Fix for [db87229497]. (check-in: 98457a57d6 user: drh tags: branch-3.8.7)
Changes
Side-by-Side Diff Ignore Whitespace Patch
Changes to test/ioerr2.test.
108
109
110
111
112
113
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
108
109
110
111
112
113
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







+
+
+
+
+
+


















-
+







    set ::sqlite_io_error_pending $::N

    foreach {::go res} [catchsql $sql] {}
    check_db ioerr2-4.[expr {$bPersist+2}].$::N
  }
}

# When this test was written, an IO error within the UPDATE statement caused
# a rollback, which tripped all read-cursors, causing the outer SELECT to
# fail with "abort due to ROLLBACK". Now, the loop continues until the UPDATE
# is run successfully. At this point the next IO error occurs within the 
# SELECT - throwing the "disk I/O error" that the test case now expects.
#
do_test ioerr2-5 {
  execsql {
    CREATE TABLE t2 AS SELECT * FROM t1;
    PRAGMA temp_store = memory;
  }
  set ::sqlite_io_error_persist 0
  set ::go 1
  set rc [catch {
    for {set ::N 2} {$::N<200} {incr ::N} {
      db eval {SELECT * FROM t1 WHERE rowid IN (1, 5, 10, 15, 20)} {
        set ::sqlite_io_error_hit 0
        set ::sqlite_io_error_pending $::N
        set sql {UPDATE t2 SET b = randstr(400,400)}
        foreach {::go res} [catchsql $sql] {}
      }
    }
  } msg]
  list $rc $msg
} {1 {abort due to ROLLBACK}}
} {1 {disk I/O error}} ;# used to be "{1 {abort due to ROLLBACK}}"

if {$::tcl_platform(platform) == "unix"} {
  # Cause the call to xAccess used by [pragma temp_store_directory] to
  # determine if the specified directory is writable to fail. This causes
  # SQLite to report "not a writable directory", which is probably the
  # right answer.
  #
Changes to test/shared_err.test.
442
443
444
445
446
447
448





449
450
451


452
453
454
455
456
457
458
442
443
444
445
446
447
448
449
450
451
452
453
454
455

456
457
458
459
460
461
462
463
464







+
+
+
+
+


-
+
+







      ($rc1=="SQLITE_ERROR" && $rc2=="SQLITE_NOMEM") ||
      ($rc1=="SQLITE_ERROR" && $rc2=="SQLITE_IOERR") ||
      ($rc1=="SQLITE_ERROR" && $rc2=="SQLITE_CORRUPT")
    }
  } {1}
  db2 close
}

# When this test case was written, OOM errors in write statements would 
# cause transaction rollback, which would trip cursors in other statements,
# aborting them. This no longer happens.
#
do_test shared_malloc-8.X {
  # Test that one or more queries were aborted due to the malloc() failure.
  expr $::aborted>=1
  # expr $::aborted>=1
  expr $::aborted==0
} {1}

# This test is designed to catch a specific bug that was present during
# development of 3.5.0. If a malloc() failed while setting the page-size,
# a buffer (Pager.pTmpSpace) was being freed. This could cause a seg-fault
# later if another connection tried to use the pager.
#