SQLite

Check-in [c1e04f1d4e]
Login

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

Overview
Comment:Fix bug in journal2.test.
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | experimental
Files: files | file ages | folders
SHA1: c1e04f1d4e8575ebc41b5b4403dbfe3f60d578dc
User & Date: dan 2010-06-17 11:36:28.000
Context
2010-06-17
16:44
A different fix to [fc62af4523]. When changing from journal_mode=PERSIST or TRINCATE to some other rollback mode, delete the journal file only if a RESERVED lock can be obtained on the database file first. (check-in: b9b11855e8 user: dan tags: experimental)
11:36
Fix bug in journal2.test. (check-in: c1e04f1d4e user: dan tags: experimental)
10:52
Merge trunk updates with experimental branch. Also add tests to journal2.test. (check-in: 9f6ea1de5a user: dan tags: experimental)
Changes
Unified Diff Show Whitespace Changes Patch
Changes to test/journal2.test.
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
  # IO error to every attempt to modify the file-system. Otherwise, return
  # SQLITE_OK.
  #
  if {[info exists ::tvfs_error_on_write]} {
    if {[lsearch {xDelete xWrite xTruncate} $method]>=0} {
      return SQLITE_IOERR 
    }
    return SQLITE_OK
  }

  # The rest of this command only deals with xOpen(), xClose() and xDelete()
  # operations on journal files. If this invocation does not represent such
  # an operation, return with no further ado.
  #
  set f [file tail $filename]







<







43
44
45
46
47
48
49

50
51
52
53
54
55
56
  # IO error to every attempt to modify the file-system. Otherwise, return
  # SQLITE_OK.
  #
  if {[info exists ::tvfs_error_on_write]} {
    if {[lsearch {xDelete xWrite xTruncate} $method]>=0} {
      return SQLITE_IOERR 
    }

  }

  # The rest of this command only deals with xOpen(), xClose() and xDelete()
  # operations on journal files. If this invocation does not represent such
  # an operation, return with no further ado.
  #
  set f [file tail $filename]
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
  # one ore more open handles, return an error. The code in test_vfs.c
  # will not invoke the xDelete method of the "real" VFS in this case.
  #
  if {[info exists ::open_journals($f)]==0} { set ::open_journals($f) 0 }
  switch -- $method {
    xOpen   { incr ::open_journals($f) +1 }
    xClose  { incr ::open_journals($f) -1 }
    xDelete { if {$::open_journals($f)>0} { puts EEE;return SQLITE_IOERR } }
  }

  return ""
}


do_test journal2-1.1 {







|







65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
  # one ore more open handles, return an error. The code in test_vfs.c
  # will not invoke the xDelete method of the "real" VFS in this case.
  #
  if {[info exists ::open_journals($f)]==0} { set ::open_journals($f) 0 }
  switch -- $method {
    xOpen   { incr ::open_journals($f) +1 }
    xClose  { incr ::open_journals($f) -1 }
    xDelete { if {$::open_journals($f)>0} { return SQLITE_IOERR } }
  }

  return ""
}


do_test journal2-1.1 {
216
217
218
219
220
221
222

223




224
225
226
227
228
229
  do_test journal2-2.3 {
    expr {[file size test.db-journal] > 512}
  } {1}
  do_test journal2-2.3 {
    set ::oplog [list]
    execsql { PRAGMA journal_mode = WAL }
    set ::oplog

  } {xClose test.db-journal xDelete test.db-journal}




  db close
}

tvfs delete
finish_test








>
|
>
>
>
>






215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
  do_test journal2-2.3 {
    expr {[file size test.db-journal] > 512}
  } {1}
  do_test journal2-2.3 {
    set ::oplog [list]
    execsql { PRAGMA journal_mode = WAL }
    set ::oplog
  } [list                                              \
      xClose test.db-journal                           \
      xOpen test.db-journal xClose test.db-journal     \
      xOpen test.db-journal xClose test.db-journal     \
      xDelete test.db-journal                          \
  ]
  db close
}

tvfs delete
finish_test