SQLite4
Check-in [5dfd8651df]
Not logged in

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

Overview
Comment:Add test file lsm3.test, which should have been added a few days ago.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 5dfd8651df51d4c28e895ecc604e8e0a640a4852
User & Date: dan 2013-02-05 09:52:35
Context
2013-02-05
16:03
Change the BLOCK_SIZE, AUTOFLUSH and AUTOCHECKPOINT lsm_config() options to work in KB instead of bytes. This matches the user guide. check-in: 340c9dcd22 user: dan tags: trunk
09:52
Add test file lsm3.test, which should have been added a few days ago. check-in: 5dfd8651df user: dan tags: trunk
2013-02-02
16:45
Fix LSM single-process mode so that it holds an exclusive lock on the database file - preventing connections from within external processes. check-in: d6bd08ca0e user: dan tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Added test/lsm3.test.



















































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
# 2012 November 02
#
# The author disclaims copyright to this source code.  In place of
# a legal notice, here is a blessing:
#
#    May you do good and not evil.
#    May you find forgiveness for yourself and forgive others.
#    May you share freely, never taking more than you give.
#
#***********************************************************************
#
# This file tests that the LSM_CONFIG_MULTIPLE_PROCESSES parameter seems
# to work as documented.
#
set testdir [file dirname $argv0]
source $testdir/tester.tcl
source $testdir/lock_common.tcl
set testprefix lsm3
db close

do_multiclient_test tn {

  # The [do_multiclient_test] command automatically opens a connection
  # in each process (or three connections in this process). We don't want
  # them in this case.
  code1 { db close }
  code2 { db2 close }
  code3 { db3 close }

  if { $tn==1 } {
    set locked {1 {database is locked}}
  } else {
    set locked {0 {}}
  }

  # Open a single-process connection to the database from an external
  # process (if $tn==1, otherwise open it from within the current 
  # process).
  code2 { sqlite4 db2 file:test.db?lsm_multiple_processes=0 }

  # Try to open some other connections to the database file, both in multi
  # and single process mode. If ($tn==1), then all such attempts fail. Or,
  # if ($tn==2), they all succeed.
  do_test $tn.1 {
    catch { db close }
    list [catch {sqlite4 db file:test.db?lsm_multiple_processes=0} msg] $msg
  } $locked
  do_test $tn.2 {
    catch { db close }
    list [catch {sqlite4 db file:test.db?lsm_multiple_processes=0} msg] $msg
  } $locked
  do_test $tn.3 {
    catch { db close }
    list [catch {sqlite4 db file:test.db?lsm_multiple_processes=1} msg] $msg
  } $locked
  do_test $tn.4 {
    catch { db close }
    list [catch {sqlite4 db file:test.db?lsm_multiple_processes=1} msg] $msg
  } $locked

  # Now open a connection from an external process in multi-proc mode.
  # Observe that further connections are allowed if they are from within
  # the same process or if the LSM_CONFIG_MULTIPLE_PROCESSES parameter
  # is set to true.
  code2 { 
    db2 close
    sqlite4 db2 file:test.db
  }

  do_test $tn.5 {
    catch { db close }
    list [catch {sqlite4 db file:test.db?lsm_multiple_processes=0} msg] $msg
  } $locked
  do_test $tn.6 {
    catch { db close }
    list [catch {sqlite4 db file:test.db?lsm_multiple_processes=0} msg] $msg
  } $locked
  do_test $tn.7 {
    catch { db close }
    list [catch {sqlite4 db file:test.db?lsm_multiple_processes=1} msg] $msg
  } {0 {}}
  do_test $tn.8 {
    catch { db close }
    list [catch {sqlite4 db file:test.db?lsm_multiple_processes=1} msg] $msg
  } {0 {}}
}


finish_test