System.Data.SQLite
Check-in [70c11fc93f]
Not logged in

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

Overview
Comment:Enhance stress test workload diagnostic messages.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | threadAbortProtect
Files: files | file ages | folders
SHA1: 70c11fc93fae40f7ebd086af693a2179e097dfd3
User & Date: mistachkin 2012-10-12 14:09:14
Context
2012-10-12
16:09
Add a LogMessage method overload to the SQLiteConnection class that takes a SQLiteErrorCode. check-in: d874518f31 user: mistachkin tags: threadAbortProtect
14:09
Enhance stress test workload diagnostic messages. check-in: 70c11fc93f user: mistachkin tags: threadAbortProtect
13:40
Logging related enhancements to stress test. check-in: 738abc1a0b user: mistachkin tags: threadAbortProtect
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to Tests/stress.eagle.

150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
...
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
...
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
...
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
...
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
...
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
...
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
...
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
...
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
...
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
...
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
...
429
430
431
432
433
434
435

436








437
438
439
440
441
442
443
...
469
470
471
472
473
474
475

476








477
478
479
480
481
482
483
484
485
486
487
488
...
489
490
491
492
493
494
495

496








497
498
499
500
501
502
503
...
529
530
531
532
533
534
535

536








537
538
539
540
541
542
543
544
545
546
547
548
...
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
...
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
    #
    lappend ::times(1) [lindex [time {
      setupDb $dstFileName "" "" "" "" "" true false
      if {[catch {
        for {set index 2} {$index <= $count} {incr index} {
          sql execute $db [appendArgs \
              "CREATE TABLE IF NOT EXISTS t" $index "(x PRIMARY KEY, y, z);"]
          showTest 1
        }
      } error]} then {
        if {[expectedError $error]} then {
          showTest *
        } else {
          failTest $error
        }
      }
      cleanupDb $dstFileName db false true false
    }] 0]
  }]
................................................................................
    #
    lappend ::times(2) [lindex [time {
      setupDb $dstFileName "" "" "" "" "" true false
      if {[catch {
        for {set index 2} {$index <= $count} {incr index} {
          sql execute $db [appendArgs \
              "DROP TABLE IF EXISTS t" $index \;]
          showTest 2
        }
      } error]} then {
        if {[expectedError $error]} then {
          showTest *
        } else {
          failTest $error
        }
      }
      cleanupDb $dstFileName db false true false
    }] 0]
  }]
................................................................................
    #
    lappend ::times(3) [lindex [time {
      setupDb $dstFileName "" "" "" "" "" true false
      if {[catch {
        for {set index 1} {$index <= $count} {incr index} {
          sql execute -execute reader $db [appendArgs \
              "SELECT x, y FROM " $table " WHERE z = 'small';"]
          showTest 3
        }
      } error]} then {
        if {[expectedError $error]} then {
          showTest *
        } else {
          failTest $error
        }
      }
      cleanupDb $dstFileName db false true false
    }] 0]
  }]
................................................................................
    #
    lappend ::times(4) [lindex [time {
      setupDb $dstFileName "" "" "" "" "" true false
      if {[catch {
        for {set index 1} {$index <= $count} {incr index} {
          sql execute -execute reader $db [appendArgs \
              "SELECT x, y FROM " $table " WHERE z = 'big';"]
          showTest 4
        }
      } error]} then {
        if {[expectedError $error]} then {
          showTest *
        } else {
          failTest $error
        }
      }
      cleanupDb $dstFileName db false true false
    }] 0]
  }]
................................................................................
      if {[catch {
        for {set index 1} {$index <= $count} {incr index} {
          sql execute $db [appendArgs \
              "INSERT INTO " $table "(x, y, z) VALUES('" \
              [format %lX [expr {random()}]] "', '" \
              [base64 encode -- [expr {randstr(10000)}]] \
              "', 'small');"]
          showTest 5
        }
      } error]} then {
        if {[expectedError $error]} then {
          showTest *
        } else {
          failTest $error
        }
      }
      cleanupDb $dstFileName db false true false
    }] 0]
  }]
................................................................................
      setupDb $dstFileName "" "" "" "" "" true false
      if {[catch {
        for {set index 1} {$index <= $count} {incr index} {
          sql execute $db [appendArgs \
              "INSERT INTO " $table "(x, y, z) VALUES('" \
              [format %lX [expr {random()}]] \
              "', RANDOMBLOB(10000000), 'big');"]
          showTest 6
        }
      } error]} then {
        if {[expectedError $error]} then {
          showTest *
        } else {
          failTest $error
        }
      }
      cleanupDb $dstFileName db false true false
    }] 0]
  }]
................................................................................
    lappend ::times(7) [lindex [time {
      setupDb $dstFileName "" "" "" "" "" true false
      if {[catch {
        for {set index 1} {$index <= $count} {incr index} {
          sql execute $db [appendArgs "UPDATE " $table \
              " SET y = '" [base64 encode -- [expr {randstr(10000)}]] \
              "' WHERE x LIKE '" [format %X $index] "%' AND z = 'small';"]
          showTest 7
        }
      } error]} then {
        if {[expectedError $error]} then {
          showTest *
        } else {
          failTest $error
        }
      }
      cleanupDb $dstFileName db false true false
    }] 0]
  }]
................................................................................
    lappend ::times(8) [lindex [time {
      setupDb $dstFileName "" "" "" "" "" true false
      if {[catch {
        for {set index 1} {$index <= $count} {incr index} {
          sql execute $db [appendArgs "UPDATE " $table \
              " SET y = RANDOMBLOB(10000000) WHERE x LIKE '" \
              [format %X $index] "%' AND z = 'big';"]
          showTest 8
        }
      } error]} then {
        if {[expectedError $error]} then {
          showTest *
        } else {
          failTest $error
        }
      }
      cleanupDb $dstFileName db false true false
    }] 0]
  }]
................................................................................
    #
    lappend ::times(9) [lindex [time {
      setupDb $dstFileName "" "" "" "" "" true false
      if {[catch {
        for {set index 1} {$index <= $count} {incr index} {
          sql execute $db [appendArgs "DELETE FROM " $table \
              " WHERE x LIKE '" [format %X $index] "%' AND z = 'small';"]
          showTest 9
        }
      } error]} then {
        if {[expectedError $error]} then {
          showTest *
        } else {
          failTest $error
        }
      }
      cleanupDb $dstFileName db false true false
    }] 0]
  }]
................................................................................
    #
    lappend ::times(10) [lindex [time {
      setupDb $dstFileName "" "" "" "" "" true false
      if {[catch {
        for {set index 1} {$index <= $count} {incr index} {
          sql execute $db [appendArgs "DELETE FROM " $table \
              " WHERE x LIKE '" [format %X $index] "%' AND z = 'big';"]
          showTest A
        }
      } error]} then {
        if {[expectedError $error]} then {
          showTest *
        } else {
          failTest $error
        }
      }
      cleanupDb $dstFileName db false true false
    }] 0]
  }]
................................................................................
    # NOTE: Workload #11, VACUUM statement.
    #
    lappend ::times(11) [lindex [time {
      setupDb $dstFileName "" "" "" "" "" true false
      if {[catch {
        for {set index 1} {$index <= $count} {incr index} {
          sql execute $db "VACUUM;"
          showTest B
        }
      } error]} then {
        if {[expectedError $error]} then {
          showTest *
        } else {
          failTest $error
        }
      }
      cleanupDb $dstFileName db false true false
    }] 0]
  }]
................................................................................
    #
    # NOTE: Workload #12, backup to in-memory database.
    #
    lappend ::times(12) [lindex [time {
      for {set index 1} {$index <= $count} {incr index} {
        if {[string is integer -strict $::compiled(12)]} then {
          set id $::compiled(12); # NOTE: Already compiled.

          object invoke _Dynamic${id}.Test${id} BackupAndGetData








        } else {
          set id [object invoke Interpreter.GetActive NextId]
          set code [compileCSharpWith [subst {
            using System;
            using System.Data.SQLite;
            using System.Text;

................................................................................
                  // do nothing.
                }
              }
            }
          }] true true true results errors System.Data.SQLite.dll]
          if {$code eq "Ok"} then {
            set ::compiled(12) $id; # NOTE: Compiled OK.

            object invoke _Dynamic${id}.Test${id} BackupAndGetData








          } else {
            error $errors
          }
        }
        showTest C
      }
    }] 0]
  }]

  #############################################################################

  set workload(13) [list [list srcFileName dstFileName table count] {
................................................................................
    #
    # NOTE: Workload #13, backup from an in-memory database.
    #
    lappend ::times(13) [lindex [time {
      for {set index 1} {$index <= $count} {incr index} {
        if {[string is integer -strict $::compiled(13)]} then {
          set id $::compiled(13); # NOTE: Already compiled.

          object invoke _Dynamic${id}.Test${id} BackupAndGetData








        } else {
          set id [object invoke Interpreter.GetActive NextId]
          set code [compileCSharpWith [subst {
            using System;
            using System.Data.SQLite;
            using System.Text;

................................................................................
                  // do nothing.
                }
              }
            }
          }] true true true results errors System.Data.SQLite.dll]
          if {$code eq "Ok"} then {
            set ::compiled(13) $id; # NOTE: Compiled OK.

            object invoke _Dynamic${id}.Test${id} BackupAndGetData








          } else {
            error $errors
          }
        }
        showTest D
      }
    }] 0]
  }]

  #############################################################################

  set workload(14) [list [list srcFileName dstFileName table count] {
................................................................................
    lappend ::times(14) [lindex [time {
      setupDb $dstFileName "" "" "" "" "" true false
      if {[catch {
        for {set index 1} {$index <= $count} {incr index} {
          set result [sql execute -execute scalar $db \
              "PRAGMA integrity_check;"]
          if {$result eq "ok"} then {
            showTest E
          } else {
            error [appendArgs "integrity check failed: " $result]
          }
        }
      } error]} then {
        if {[expectedError $error]} then {
          showTest *
        } else {
          failTest $error
        }
      }
      cleanupDb $dstFileName db false true false
    }] 0]
  }]
................................................................................
    #
    # NOTE: Workload #15, force managed garbage collection
    #
    lappend ::times(15) [lindex [time {
      if {[catch {
        for {set index 1} {$index <= $count} {incr index} {
          collectGarbage $::test_channel
          showTest F
        }
      } error]} then {
        if {[expectedError $error]} then {
          showTest *
        } else {
          failTest $error
        }
      }
    }] 0]
  }]
} -body {







|



|







 







|



|







 







|



|







 







|



|







 







|



|







 







|



|







 







|



|







 







|



|







 







|



|







 







|



|







 







|



|







 







>
|
>
>
>
>
>
>
>
>







 







>
|
>
>
>
>
>
>
>
>




<







 







>
|
>
>
>
>
>
>
>
>







 







>
|
>
>
>
>
>
>
>
>




<







 







|






|







 







|



|







150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
...
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
...
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
...
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
...
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
...
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
...
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
...
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
...
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
...
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
...
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
...
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
...
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498

499
500
501
502
503
504
505
...
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
...
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575

576
577
578
579
580
581
582
...
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
...
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
    #
    lappend ::times(1) [lindex [time {
      setupDb $dstFileName "" "" "" "" "" true false
      if {[catch {
        for {set index 2} {$index <= $count} {incr index} {
          sql execute $db [appendArgs \
              "CREATE TABLE IF NOT EXISTS t" $index "(x PRIMARY KEY, y, z);"]
          showTest A
        }
      } error]} then {
        if {[expectedError $error]} then {
          showTest a
        } else {
          failTest $error
        }
      }
      cleanupDb $dstFileName db false true false
    }] 0]
  }]
................................................................................
    #
    lappend ::times(2) [lindex [time {
      setupDb $dstFileName "" "" "" "" "" true false
      if {[catch {
        for {set index 2} {$index <= $count} {incr index} {
          sql execute $db [appendArgs \
              "DROP TABLE IF EXISTS t" $index \;]
          showTest B
        }
      } error]} then {
        if {[expectedError $error]} then {
          showTest b
        } else {
          failTest $error
        }
      }
      cleanupDb $dstFileName db false true false
    }] 0]
  }]
................................................................................
    #
    lappend ::times(3) [lindex [time {
      setupDb $dstFileName "" "" "" "" "" true false
      if {[catch {
        for {set index 1} {$index <= $count} {incr index} {
          sql execute -execute reader $db [appendArgs \
              "SELECT x, y FROM " $table " WHERE z = 'small';"]
          showTest C
        }
      } error]} then {
        if {[expectedError $error]} then {
          showTest c
        } else {
          failTest $error
        }
      }
      cleanupDb $dstFileName db false true false
    }] 0]
  }]
................................................................................
    #
    lappend ::times(4) [lindex [time {
      setupDb $dstFileName "" "" "" "" "" true false
      if {[catch {
        for {set index 1} {$index <= $count} {incr index} {
          sql execute -execute reader $db [appendArgs \
              "SELECT x, y FROM " $table " WHERE z = 'big';"]
          showTest D
        }
      } error]} then {
        if {[expectedError $error]} then {
          showTest d
        } else {
          failTest $error
        }
      }
      cleanupDb $dstFileName db false true false
    }] 0]
  }]
................................................................................
      if {[catch {
        for {set index 1} {$index <= $count} {incr index} {
          sql execute $db [appendArgs \
              "INSERT INTO " $table "(x, y, z) VALUES('" \
              [format %lX [expr {random()}]] "', '" \
              [base64 encode -- [expr {randstr(10000)}]] \
              "', 'small');"]
          showTest E
        }
      } error]} then {
        if {[expectedError $error]} then {
          showTest e
        } else {
          failTest $error
        }
      }
      cleanupDb $dstFileName db false true false
    }] 0]
  }]
................................................................................
      setupDb $dstFileName "" "" "" "" "" true false
      if {[catch {
        for {set index 1} {$index <= $count} {incr index} {
          sql execute $db [appendArgs \
              "INSERT INTO " $table "(x, y, z) VALUES('" \
              [format %lX [expr {random()}]] \
              "', RANDOMBLOB(10000000), 'big');"]
          showTest F
        }
      } error]} then {
        if {[expectedError $error]} then {
          showTest f
        } else {
          failTest $error
        }
      }
      cleanupDb $dstFileName db false true false
    }] 0]
  }]
................................................................................
    lappend ::times(7) [lindex [time {
      setupDb $dstFileName "" "" "" "" "" true false
      if {[catch {
        for {set index 1} {$index <= $count} {incr index} {
          sql execute $db [appendArgs "UPDATE " $table \
              " SET y = '" [base64 encode -- [expr {randstr(10000)}]] \
              "' WHERE x LIKE '" [format %X $index] "%' AND z = 'small';"]
          showTest G
        }
      } error]} then {
        if {[expectedError $error]} then {
          showTest g
        } else {
          failTest $error
        }
      }
      cleanupDb $dstFileName db false true false
    }] 0]
  }]
................................................................................
    lappend ::times(8) [lindex [time {
      setupDb $dstFileName "" "" "" "" "" true false
      if {[catch {
        for {set index 1} {$index <= $count} {incr index} {
          sql execute $db [appendArgs "UPDATE " $table \
              " SET y = RANDOMBLOB(10000000) WHERE x LIKE '" \
              [format %X $index] "%' AND z = 'big';"]
          showTest H
        }
      } error]} then {
        if {[expectedError $error]} then {
          showTest h
        } else {
          failTest $error
        }
      }
      cleanupDb $dstFileName db false true false
    }] 0]
  }]
................................................................................
    #
    lappend ::times(9) [lindex [time {
      setupDb $dstFileName "" "" "" "" "" true false
      if {[catch {
        for {set index 1} {$index <= $count} {incr index} {
          sql execute $db [appendArgs "DELETE FROM " $table \
              " WHERE x LIKE '" [format %X $index] "%' AND z = 'small';"]
          showTest I
        }
      } error]} then {
        if {[expectedError $error]} then {
          showTest i
        } else {
          failTest $error
        }
      }
      cleanupDb $dstFileName db false true false
    }] 0]
  }]
................................................................................
    #
    lappend ::times(10) [lindex [time {
      setupDb $dstFileName "" "" "" "" "" true false
      if {[catch {
        for {set index 1} {$index <= $count} {incr index} {
          sql execute $db [appendArgs "DELETE FROM " $table \
              " WHERE x LIKE '" [format %X $index] "%' AND z = 'big';"]
          showTest J
        }
      } error]} then {
        if {[expectedError $error]} then {
          showTest j
        } else {
          failTest $error
        }
      }
      cleanupDb $dstFileName db false true false
    }] 0]
  }]
................................................................................
    # NOTE: Workload #11, VACUUM statement.
    #
    lappend ::times(11) [lindex [time {
      setupDb $dstFileName "" "" "" "" "" true false
      if {[catch {
        for {set index 1} {$index <= $count} {incr index} {
          sql execute $db "VACUUM;"
          showTest K
        }
      } error]} then {
        if {[expectedError $error]} then {
          showTest k
        } else {
          failTest $error
        }
      }
      cleanupDb $dstFileName db false true false
    }] 0]
  }]
................................................................................
    #
    # NOTE: Workload #12, backup to in-memory database.
    #
    lappend ::times(12) [lindex [time {
      for {set index 1} {$index <= $count} {incr index} {
        if {[string is integer -strict $::compiled(12)]} then {
          set id $::compiled(12); # NOTE: Already compiled.
          if {[catch {
            object invoke _Dynamic${id}.Test${id} BackupAndGetData
            showTest L
          } error]} then {
            if {[expectedError $error]} then {
              showTest l
            } else {
              failTest $error
            }
          }
        } else {
          set id [object invoke Interpreter.GetActive NextId]
          set code [compileCSharpWith [subst {
            using System;
            using System.Data.SQLite;
            using System.Text;

................................................................................
                  // do nothing.
                }
              }
            }
          }] true true true results errors System.Data.SQLite.dll]
          if {$code eq "Ok"} then {
            set ::compiled(12) $id; # NOTE: Compiled OK.
            if {[catch {
              object invoke _Dynamic${id}.Test${id} BackupAndGetData
              showTest L
            } error]} then {
              if {[expectedError $error]} then {
                showTest l
              } else {
                failTest $error
              }
            }
          } else {
            error $errors
          }
        }

      }
    }] 0]
  }]

  #############################################################################

  set workload(13) [list [list srcFileName dstFileName table count] {
................................................................................
    #
    # NOTE: Workload #13, backup from an in-memory database.
    #
    lappend ::times(13) [lindex [time {
      for {set index 1} {$index <= $count} {incr index} {
        if {[string is integer -strict $::compiled(13)]} then {
          set id $::compiled(13); # NOTE: Already compiled.
          if {[catch {
            object invoke _Dynamic${id}.Test${id} BackupAndGetData
            showTest M
          } error]} then {
            if {[expectedError $error]} then {
              showTest m
            } else {
              failTest $error
            }
          }
        } else {
          set id [object invoke Interpreter.GetActive NextId]
          set code [compileCSharpWith [subst {
            using System;
            using System.Data.SQLite;
            using System.Text;

................................................................................
                  // do nothing.
                }
              }
            }
          }] true true true results errors System.Data.SQLite.dll]
          if {$code eq "Ok"} then {
            set ::compiled(13) $id; # NOTE: Compiled OK.
            if {[catch {
              object invoke _Dynamic${id}.Test${id} BackupAndGetData
              showTest M
            } error]} then {
              if {[expectedError $error]} then {
                showTest m
              } else {
                failTest $error
              }
            }
          } else {
            error $errors
          }
        }

      }
    }] 0]
  }]

  #############################################################################

  set workload(14) [list [list srcFileName dstFileName table count] {
................................................................................
    lappend ::times(14) [lindex [time {
      setupDb $dstFileName "" "" "" "" "" true false
      if {[catch {
        for {set index 1} {$index <= $count} {incr index} {
          set result [sql execute -execute scalar $db \
              "PRAGMA integrity_check;"]
          if {$result eq "ok"} then {
            showTest N
          } else {
            error [appendArgs "integrity check failed: " $result]
          }
        }
      } error]} then {
        if {[expectedError $error]} then {
          showTest n
        } else {
          failTest $error
        }
      }
      cleanupDb $dstFileName db false true false
    }] 0]
  }]
................................................................................
    #
    # NOTE: Workload #15, force managed garbage collection
    #
    lappend ::times(15) [lindex [time {
      if {[catch {
        for {set index 1} {$index <= $count} {incr index} {
          collectGarbage $::test_channel
          showTest O
        }
      } error]} then {
        if {[expectedError $error]} then {
          showTest o
        } else {
          failTest $error
        }
      }
    }] 0]
  }]
} -body {