/ Check-in [ae7c5ed1]
Login
SQLite training in Houston TX on 2019-11-05 (details)
Part of the 2019 Tcl Conference

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

Overview
Comment:Add the "-external" option to the tserver_test.tcl program..
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | begin-concurrent-pnu-wal2
Files: files | file ages | folders
SHA3-256: ae7c5ed15d5d549326bf570c8f03b49e8e601e7389bf8d702d0d7db0c0570ee8
User & Date: dan 2019-01-04 19:25:22
Wiki:begin-concurrent-pnu-wal2
Context
2019-01-04
19:39
Fix the experimental sqlite3_wal_info() API so that it works with wal2 mode. check-in: 079daedb user: dan tags: begin-concurrent-pnu-wal2
19:25
Add the "-external" option to the tserver_test.tcl program.. check-in: ae7c5ed1 user: dan tags: begin-concurrent-pnu-wal2
17:12
Update the "tserver" program to report the amount of time spent in COMMIT commands. check-in: cf494b41 user: dan tags: begin-concurrent-pnu-wal2
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to tool/tserver_test.tcl.

13
14
15
16
17
18
19

20
21
22
23
24
25
26
..
33
34
35
36
37
38
39

40
41
42
43
44
45
46
..
77
78
79
80
81
82
83


84
85
86
87
88
89
90
...
147
148
149
150
151
152
153

154
155
156
157
158
159
160
...
169
170
171
172
173
174
175


176
177
178
179
180
181
182
set O(-mode)      wal2
set O(-tserver)   "./tserver"
set O(-seconds)   20
set O(-writers)   1
set O(-readers)   0
set O(-integrity) 0
set O(-verbose)   0



proc error_out {err} {
  puts stderr $err
  exit -1
}

................................................................................
  puts stderr "  -rows <number of rows>                (default: 5000000)"
  puts stderr "  -tserver <path to tserver executable> (default: ./tserver)"
  puts stderr "  -seconds <time to run for in seconds> (default: 20)"
  puts stderr "  -writers <number of writer clients>   (default: 1)"
  puts stderr "  -readers <number of reader clients>   (default: 0)"
  puts stderr "  -integrity <number of IC clients>     (default: 0)"
  puts stderr "  -verbose 0|1                          (default: 0)"

  exit -1
}

for {set i 0} {$i < [llength $argv]} {incr i} {
  set opt ""
  set arg [lindex $argv $i]
  set n [expr [string length $arg]-1]
................................................................................

#--------------------------------------------------------------------------
# Create and populate the required test database, if it is not already 
# present in the file-system.
#
proc create_test_database {} {
  global O



  if {[file exists $O(-database)]} {
    sqlite3 db $O(-database)

    # Check the schema looks Ok.
    set s [db one {
      SELECT group_concat(name||pk, '.') FROM pragma_table_info('t1');
................................................................................
#
#   tserver_start
#   tserver_stop
#
set ::tserver {}
proc tserver_start {} {
  global O

  set cmd "|$O(-tserver) -vfs unix-excl "
  if {$O(-mode)=="wal2"} {
    append cmd " -walautocheckpoint 0 "
  }
  append cmd "$O(-database)"
  set ::tserver [open $cmd]
  fconfigure $::tserver -blocking 0
................................................................................
  set line [gets $::tserver]
  if {$line != "" && $O(-verbose)} {
    puts "tserver: $line"
  }
}

proc tserver_stop {} {


  close $::tserver
  set fd [socket localhost 9999]
  puts $fd ".stop"
  close $fd
}
#-------------------------------------------------------------------------








>







 







>







 







>
>







 







>







 







>
>







13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
..
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
..
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
...
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
...
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
set O(-mode)      wal2
set O(-tserver)   "./tserver"
set O(-seconds)   20
set O(-writers)   1
set O(-readers)   0
set O(-integrity) 0
set O(-verbose)   0
set O(-external)   0


proc error_out {err} {
  puts stderr $err
  exit -1
}

................................................................................
  puts stderr "  -rows <number of rows>                (default: 5000000)"
  puts stderr "  -tserver <path to tserver executable> (default: ./tserver)"
  puts stderr "  -seconds <time to run for in seconds> (default: 20)"
  puts stderr "  -writers <number of writer clients>   (default: 1)"
  puts stderr "  -readers <number of reader clients>   (default: 0)"
  puts stderr "  -integrity <number of IC clients>     (default: 0)"
  puts stderr "  -verbose 0|1                          (default: 0)"
  puts stderr "  -external 0|1                         (default: 0)"
  exit -1
}

for {set i 0} {$i < [llength $argv]} {incr i} {
  set opt ""
  set arg [lindex $argv $i]
  set n [expr [string length $arg]-1]
................................................................................

#--------------------------------------------------------------------------
# Create and populate the required test database, if it is not already 
# present in the file-system.
#
proc create_test_database {} {
  global O

  if {$O(-external)} return

  if {[file exists $O(-database)]} {
    sqlite3 db $O(-database)

    # Check the schema looks Ok.
    set s [db one {
      SELECT group_concat(name||pk, '.') FROM pragma_table_info('t1');
................................................................................
#
#   tserver_start
#   tserver_stop
#
set ::tserver {}
proc tserver_start {} {
  global O
  if {$O(-external)} return
  set cmd "|$O(-tserver) -vfs unix-excl "
  if {$O(-mode)=="wal2"} {
    append cmd " -walautocheckpoint 0 "
  }
  append cmd "$O(-database)"
  set ::tserver [open $cmd]
  fconfigure $::tserver -blocking 0
................................................................................
  set line [gets $::tserver]
  if {$line != "" && $O(-verbose)} {
    puts "tserver: $line"
  }
}

proc tserver_stop {} {
  global O
  if {$O(-external)} return
  close $::tserver
  set fd [socket localhost 9999]
  puts $fd ".stop"
  close $fd
}
#-------------------------------------------------------------------------