System.Data.SQLite

Check-in [23636c00e9]
Login

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

Overview
Comment:Enhancements to the stress test.
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 23636c00e9485f12d32631905231b96091767f3d
User & Date: mistachkin 2018-01-04 17:40:09.950
Context
2018-01-04
17:43
Fix harmless typo in the stress test. check-in: 5cb45326c1 user: mistachkin tags: trunk
17:40
Enhancements to the stress test. check-in: 23636c00e9 user: mistachkin tags: trunk
2017-12-18
13:00
Adjust the test constraints impacted by Mono 5.4. check-in: c4a0c9d86c user: mistachkin tags: trunk
Changes
Unified Diff Ignore Whitespace Patch
Changes to Tests/stress.eagle.
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
  proc setupWorkloadMemDb { fileName varName } {
    #
    # NOTE: This should be an in-memory database; therefore, skip attempting
    #       to delete the underlying database file as that would not make any
    #       sense.  Also, disable use of "PRAGMA temp_store_directory" when
    #       setting up the new connection because it is not thread-safe.
    #

    uplevel 1 [list setupDb $fileName "" "" "" "" "" false false true false \
        $varName true]





  }

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

  proc setupWorkloadFileDb { fileName varName } {
    #
    # NOTE: Skip attempting to delete the underlying database file.  Also,
    #       disable use of "PRAGMA temp_store_directory" when setting up
    #       the new connection because it is not thread-safe.
    #

    uplevel 1 [list setupDb $fileName $::journalMode "" "" "" "" true false \
        false false $varName true]

























  }

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

  proc formatWorkloadResult { index } {
    set result [appendArgs "---- iterations for workload (" $index "): "]








>
|

>
>
>
>
>










>
|

>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>







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
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
  proc setupWorkloadMemDb { fileName varName } {
    #
    # NOTE: This should be an in-memory database; therefore, skip attempting
    #       to delete the underlying database file as that would not make any
    #       sense.  Also, disable use of "PRAGMA temp_store_directory" when
    #       setting up the new connection because it is not thread-safe.
    #
    uplevel 1 [list setupDb \
        $fileName "" "" "" "" "" false false true false \
        $varName true]

    if {[string length $::pageSize] > 0} then {
      sql execute [uplevel 1 set $varName] [appendArgs \
          "PRAGMA page_size=" $::pageSize \;]
    }
  }

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

  proc setupWorkloadFileDb { fileName varName } {
    #
    # NOTE: Skip attempting to delete the underlying database file.  Also,
    #       disable use of "PRAGMA temp_store_directory" when setting up
    #       the new connection because it is not thread-safe.
    #
    uplevel 1 [list setupDb \
        $fileName $::journalMode "" "" "" "" true false \
        false false $varName true]

    if {[string length $::pageSize] > 0} then {
      sql execute [uplevel 1 set $varName] [appendArgs \
          "PRAGMA page_size=" $::pageSize \;]
    }
  }

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

  proc beginTransaction { db } {
    set sql $::beginTransaction

    if {[string length $sql] > 0} then {
      sql execute $db $sql
    }
  }

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

  proc endTransaction { db } {
    set sql $::endTransaction

    if {[string length $sql] > 0} then {
      sql execute $db $sql
    }
  }

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

  proc formatWorkloadResult { index } {
    set result [appendArgs "---- iterations for workload (" $index "): "]

331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347

348
349
350
351
352


353
354
355
356
357
358
359

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

  #
  # NOTE: Setup the default values for the tunable workload parameters.  Any,
  #       all, or none of these may be overriden via the command line.
  #
  set count(0) 3;         # Workload repeat count (i.e. total full runs).
  set count(1) 5;         # Workload iteration count (within a run).
  set count(2) 200;       # Workload iteration delay (milliseconds).
  set count(3) 57;        # Workload "small" data chunk size, in bytes.
  set count(4) 10000;     # Workload "big" data chunk size, in bytes.
  set count(5) 209715200; # Maximum heap memory to exclude at one time.
  set count(6) 15;        # Workload auxiliary iteration count (within a run).
  set count(7) 100;       # Workload auxiliary iteration delay (milliseconds).
  set count(8) 5000;      # Workload auxiliary data value (for use by run).
  set journalMode "";     # Initial journal mode for database files.

  set noWorkload [list];  # Workloads to be omitted from the run, by index.
  set priorities [list];  # Dictionary of workload thread priorities.
  set exitOnFail false;   # Halt testing and exit process on test failure?
  set coTaskMem true;     # Use AllocCoTaskMem/FreeCoTaskMem for memory?
  set noTrace false;      # Disable SQLite trace logging to a file?



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

  #
  # NOTE: If command line arguments to the test suite are available, process
  #       them for any options that are applicable to this test (i.e. any of
  #       the tunable workload parameters listed above).







|
|
|
|
|
|
|
|
|
|
>
|
|
|
|
|
>
>







363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394

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

  #
  # NOTE: Setup the default values for the tunable workload parameters.  Any,
  #       all, or none of these may be overriden via the command line.
  #
  set count(0) 3;          # Workload repeat count (i.e. total full runs).
  set count(1) 5;          # Workload iteration count (within a run).
  set count(2) 200;        # Workload iteration delay (milliseconds).
  set count(3) 57;         # Workload "small" data chunk size, in bytes.
  set count(4) 10000;      # Workload "big" data chunk size, in bytes.
  set count(5) 209715200;  # Maximum heap memory to exclude at one time.
  set count(6) 15;         # Workload auxiliary iteration count (within a run).
  set count(7) 100;        # Workload auxiliary iteration delay (milliseconds).
  set count(8) 5000;       # Workload auxiliary data value (for use by run).
  set journalMode "";      # Initial journal mode for database files.
  set pageSize "";         # Initial page size for database files.
  set noWorkload [list];   # Workloads to be omitted from the run, by index.
  set priorities [list];   # Dictionary of workload thread priorities.
  set exitOnFail false;    # Halt testing and exit process on test failure?
  set coTaskMem true;      # Use AllocCoTaskMem/FreeCoTaskMem for memory?
  set noTrace false;       # Disable SQLite trace logging to a file?
  set beginTransaction ""; # SQL to execute before modifying the database.
  set endTransaction "";   # SQL to execute after modifying the database.

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

  #
  # NOTE: If command line arguments to the test suite are available, process
  #       them for any options that are applicable to this test (i.e. any of
  #       the tunable workload parameters listed above).
367
368
369
370
371
372
373

374
375
376
377
378


379
380
381
382
383
384
385
386
387
388
389

390
391
392
393
394


395
396
397
398
399
400
401
        [list null MustHaveIntegerValue -1 -1 -count3 $count(3)] \
        [list null MustHaveIntegerValue -1 -1 -count4 $count(4)] \
        [list null MustHaveIntegerValue -1 -1 -count5 $count(5)] \
        [list null MustHaveIntegerValue -1 -1 -count6 $count(6)] \
        [list null MustHaveIntegerValue -1 -1 -count7 $count(7)] \
        [list null MustHaveIntegerValue -1 -1 -count8 $count(8)] \
        [list null MustHaveValue -1 -1 -journalMode $journalMode] \

        [list null MustHaveListValue -1 -1 -noWorkload $noWorkload] \
        [list null MustHaveListValue -1 -1 -priorities $priorities] \
        [list null MustHaveBooleanValue -1 -1 -exitOnFail $exitOnFail] \
        [list null MustHaveBooleanValue -1 -1 -coTaskMem $coTaskMem] \
        [list null MustHaveBooleanValue -1 -1 -noTrace $noTrace]] $argv



    set count(0) $options(-count0,value)
    set count(1) $options(-count1,value)
    set count(2) $options(-count2,value)
    set count(3) $options(-count3,value)
    set count(4) $options(-count4,value)
    set count(5) $options(-count5,value)
    set count(6) $options(-count6,value)
    set count(7) $options(-count7,value)
    set count(8) $options(-count8,value)
    set journalMode $options(-journalMode,value)

    set noWorkload $options(-noWorkload,value)
    set priorities $options(-priorities,value)
    set exitOnFail $options(-exitOnFail,value)
    set coTaskMem $options(-coTaskMem,value)
    set noTrace $options(-noTrace,value)


  }

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

  #
  # NOTE: Load custom per-user and/or per-host test settings.  Currently, this
  #       is done after processing the command line options.  The settings file







>




|
>
>











>





>
>







402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
        [list null MustHaveIntegerValue -1 -1 -count3 $count(3)] \
        [list null MustHaveIntegerValue -1 -1 -count4 $count(4)] \
        [list null MustHaveIntegerValue -1 -1 -count5 $count(5)] \
        [list null MustHaveIntegerValue -1 -1 -count6 $count(6)] \
        [list null MustHaveIntegerValue -1 -1 -count7 $count(7)] \
        [list null MustHaveIntegerValue -1 -1 -count8 $count(8)] \
        [list null MustHaveValue -1 -1 -journalMode $journalMode] \
        [list null MustHaveIntegerValue -1 -1 -pageSize $pageSize] \
        [list null MustHaveListValue -1 -1 -noWorkload $noWorkload] \
        [list null MustHaveListValue -1 -1 -priorities $priorities] \
        [list null MustHaveBooleanValue -1 -1 -exitOnFail $exitOnFail] \
        [list null MustHaveBooleanValue -1 -1 -coTaskMem $coTaskMem] \
        [list null MustHaveBooleanValue -1 -1 -noTrace $noTrace] \
        [list null MustHaveValue -1 -1 -beginTransaction $beginTransaction] \
        [list null MustHaveValue -1 -1 -endTransaction $endTransaction]] $argv

    set count(0) $options(-count0,value)
    set count(1) $options(-count1,value)
    set count(2) $options(-count2,value)
    set count(3) $options(-count3,value)
    set count(4) $options(-count4,value)
    set count(5) $options(-count5,value)
    set count(6) $options(-count6,value)
    set count(7) $options(-count7,value)
    set count(8) $options(-count8,value)
    set journalMode $options(-journalMode,value)
    set pageSize $options(-pageSize,value)
    set noWorkload $options(-noWorkload,value)
    set priorities $options(-priorities,value)
    set exitOnFail $options(-exitOnFail,value)
    set coTaskMem $options(-coTaskMem,value)
    set noTrace $options(-noTrace,value)
    set beginTransaction $options(-beginTransaction,value)
    set endTransaction $options(-endTransaction,value)
  }

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

  #
  # NOTE: Load custom per-user and/or per-host test settings.  Currently, this
  #       is done after processing the command line options.  The settings file
439
440
441
442
443
444
445


446








447






448
449
450
451
452
453
454
  #        to is not accessed by any connection within the process, not just
  #        the specific connection that was passed to sqlite3_backup_init()."
  #
  #       The only reasonable way that this test can guarantee this condition
  #       is to disable the backup tests when shared-cache mode is being used
  #       for testing.
  #


  if {[hasRuntimeOption sharedCache]} then {








    lappend noWorkload 12 13; # TODO: Update if the workload numbers change.






  }

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

  tputs $test_channel [appendArgs \
      "---- workloads will repeat " $count(0) " time(s)\n"]








>
>

>
>
>
>
>
>
>
>
|
>
>
>
>
>
>







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
  #        to is not accessed by any connection within the process, not just
  #        the specific connection that was passed to sqlite3_backup_init()."
  #
  #       The only reasonable way that this test can guarantee this condition
  #       is to disable the backup tests when shared-cache mode is being used
  #       for testing.
  #
  # TODO: Update these if the workload numbers change.
  #
  if {[hasRuntimeOption sharedCache]} then {
    lappend noWorkload 12; # NOTE: Backup to in-memory database.
    lappend noWorkload 13; # NOTE: Backup from in-memory database.
  }

  #
  # NOTE: Omit some workloads if we are only interested in data manipulation
  #       (DML) statements.
  #
  # TODO: Update these if the workload numbers change.
  #
  if {[hasRuntimeOption dmlOnly]} then {
    lappend noWorkload  1; # NOTE: CREATE TABLE
    lappend noWorkload  2; # NOTE: DROP TABLE
    lappend noWorkload 17; # NOTE: PRAGMA journal_mode
    lappend noWorkload 22; # NOTE: PRAGMA default_cache_size
  }

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

  tputs $test_channel [appendArgs \
      "---- workloads will repeat " $count(0) " time(s)\n"]

480
481
482
483
484
485
486




487
488
489
490
491
492
493
      "---- workloads will have an auxiliary data value of " \
      $count(8) \n]

  tputs $test_channel [appendArgs \
      "---- the initial journal mode is " \
      [expr {[llength $journalMode] > 0 ? $journalMode : "none"}] \n]





  tputs $test_channel [appendArgs \
      "---- workloads to be skipped... " \
      [expr {[llength $noWorkload] > 0 ? $noWorkload : "none"}] \n]

  tputs $test_channel [appendArgs \
      "---- workloads priority overrides... " \
      [expr {[llength $priorities] > 0 ? $priorities : "none"}] \n]







>
>
>
>







537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
      "---- workloads will have an auxiliary data value of " \
      $count(8) \n]

  tputs $test_channel [appendArgs \
      "---- the initial journal mode is " \
      [expr {[llength $journalMode] > 0 ? $journalMode : "none"}] \n]

  tputs $test_channel [appendArgs \
      "---- the initial page size is " \
      [expr {[llength $pageSize] > 0 ? $pageSize : "none"}] \n]

  tputs $test_channel [appendArgs \
      "---- workloads to be skipped... " \
      [expr {[llength $noWorkload] > 0 ? $noWorkload : "none"}] \n]

  tputs $test_channel [appendArgs \
      "---- workloads priority overrides... " \
      [expr {[llength $priorities] > 0 ? $priorities : "none"}] \n]
501
502
503
504
505
506
507










508
509
510
511
512
513
514
      "---- the " [expr {$coTaskMem ? "CoTaskMem" : "SQLite"}] \
      " allocator will be used to exclude heap memory\n"]

  tputs $test_channel [appendArgs \
      "---- trace logging to a file is " \
      [expr {$noTrace ? "disabled" : "enabled"}] \n]











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

  #
  # NOTE: Create the workload priority array based on the priority list seen
  #       on the command line, if any.
  #
  array set priority $priorities







>
>
>
>
>
>
>
>
>
>







562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
      "---- the " [expr {$coTaskMem ? "CoTaskMem" : "SQLite"}] \
      " allocator will be used to exclude heap memory\n"]

  tputs $test_channel [appendArgs \
      "---- trace logging to a file is " \
      [expr {$noTrace ? "disabled" : "enabled"}] \n]

  tputs $test_channel [appendArgs \
      "---- begin transaction SQL is " \
      [expr {[string length $beginTransaction] > 0 ? \
      [appendArgs \" $beginTransaction \"] : "none"}] \n]

  tputs $test_channel [appendArgs \
      "---- end transaction SQL is " \
      [expr {[string length $endTransaction] > 0 ? \
      [appendArgs \" $endTransaction \"] : "none"}] \n]

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

  #
  # NOTE: Create the workload priority array based on the priority list seen
  #       on the command line, if any.
  #
  array set priority $priorities
574
575
576
577
578
579
580
581

582
583
584
585
586
587
588
      System.Threading.EventWaitHandle false ManualReset]

  #############################################################################
  #                              WORKLOAD #1 (A)                              #
  #############################################################################

  set workload(1) [list \
      [list srcFileName dstFileName table count1 count2 count3] {

    #
    # NOTE: Workload #1, CREATE TABLE statements.
    #
    waitTest A
    lappend ::times(1) [lindex [time {
      initTest A
      setupWorkloadFileDb $dstFileName db







|
>







645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
      System.Threading.EventWaitHandle false ManualReset]

  #############################################################################
  #                              WORKLOAD #1 (A)                              #
  #############################################################################

  set workload(1) [list \
      [list srcFileName dstFileName table count1 count2 count3 \
            count4 count5 count6 count7] {
    #
    # NOTE: Workload #1, CREATE TABLE statements.
    #
    waitTest A
    lappend ::times(1) [lindex [time {
      initTest A
      setupWorkloadFileDb $dstFileName db
606
607
608
609
610
611
612
613

614
615
616
617
618
619
620
  }]

  #############################################################################
  #                              WORKLOAD #2 (B)                              #
  #############################################################################

  set workload(2) [list \
      [list srcFileName dstFileName table count1 count2 count3] {

    #
    # NOTE: Workload #2, DROP TABLE statements.
    #
    waitTest B
    lappend ::times(2) [lindex [time {
      initTest B
      setupWorkloadFileDb $dstFileName db







|
>







678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
  }]

  #############################################################################
  #                              WORKLOAD #2 (B)                              #
  #############################################################################

  set workload(2) [list \
      [list srcFileName dstFileName table count1 count2 count3 \
            count4 count5 count6 count7] {
    #
    # NOTE: Workload #2, DROP TABLE statements.
    #
    waitTest B
    lappend ::times(2) [lindex [time {
      initTest B
      setupWorkloadFileDb $dstFileName db
637
638
639
640
641
642
643
644

645
646
647
648
649
650
651
  }]

  #############################################################################
  #                              WORKLOAD #3 (C)                              #
  #############################################################################

  set workload(3) [list \
      [list srcFileName dstFileName table count1 count2 count3] {

    #
    # NOTE: Workload #3, "small" SELECT statements.
    #
    waitTest C
    lappend ::times(3) [lindex [time {
      initTest C
      setupWorkloadFileDb $dstFileName db







|
>







710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
  }]

  #############################################################################
  #                              WORKLOAD #3 (C)                              #
  #############################################################################

  set workload(3) [list \
      [list srcFileName dstFileName table count1 count2 count3 \
            count4 count5 count6 count7] {
    #
    # NOTE: Workload #3, "small" SELECT statements.
    #
    waitTest C
    lappend ::times(3) [lindex [time {
      initTest C
      setupWorkloadFileDb $dstFileName db
675
676
677
678
679
680
681
682

683
684
685
686
687
688
689
  }]

  #############################################################################
  #                              WORKLOAD #4 (D)                              #
  #############################################################################

  set workload(4) [list \
      [list srcFileName dstFileName table count1 count2 count3] {

    #
    # NOTE: Workload #4, "big" SELECT statements.
    #
    waitTest D
    lappend ::times(4) [lindex [time {
      initTest D
      setupWorkloadFileDb $dstFileName db







|
>







749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
  }]

  #############################################################################
  #                              WORKLOAD #4 (D)                              #
  #############################################################################

  set workload(4) [list \
      [list srcFileName dstFileName table count1 count2 count3 \
            count4 count5 count6 count7] {
    #
    # NOTE: Workload #4, "big" SELECT statements.
    #
    waitTest D
    lappend ::times(4) [lindex [time {
      initTest D
      setupWorkloadFileDb $dstFileName db
713
714
715
716
717
718
719
720

721
722
723
724
725
726
727
728
729

730
731
732
733

734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753

754
755
756
757
758
759
760
761
762

763
764
765

766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785

786
787
788
789
790
791
792
793
794

795
796
797

798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817

818
819
820
821
822
823
824
825
826

827
828
829

830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849

850
851
852
853
854
855
856
857
858

859
860

861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880

881
882
883
884
885
886
887
888
889

890
891

892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911

912
913
914
915
916
917
918
  }]

  #############################################################################
  #                              WORKLOAD #5 (E)                              #
  #############################################################################

  set workload(5) [list \
      [list srcFileName dstFileName table count1 count2 count3] {

    #
    # NOTE: Workload #5, "small" INSERT statements.
    #
    waitTest E
    lappend ::times(5) [lindex [time {
      initTest E
      setupWorkloadFileDb $dstFileName db
      for {set index 1} {$index <= $count1} {incr index} {
        if {[catch {

          sql execute $db [appendArgs "INSERT INTO " $table \
              "(x, y, z) VALUES('" [format %lX [expr {random()}]] \
              "', '" [base64 encode -- [expr {randstr($count2)}]] \
              "', 'small');"]

          showTest E
        } error]} then {
          if {[isExpectedError $error]} then {
            showTest e
          } else {
            failTest e $error
          }
        }
      }
      cleanupDb $dstFileName db false true false
      doneTest E
    }] 0]
  }]

  #############################################################################
  #                              WORKLOAD #6 (F)                              #
  #############################################################################

  set workload(6) [list \
      [list srcFileName dstFileName table count1 count2 count3] {

    #
    # NOTE: Workload #6, "big" INSERT statements.
    #
    waitTest F
    lappend ::times(6) [lindex [time {
      initTest F
      setupWorkloadFileDb $dstFileName db
      for {set index 1} {$index <= $count1} {incr index} {
        if {[catch {

          sql execute $db [appendArgs "INSERT INTO " $table \
              "(x, y, z) VALUES('" [format %lX [expr {random()}]] \
              "', RANDOMBLOB(" $count3 "), 'big');"]

          showTest F
        } error]} then {
          if {[isExpectedError $error]} then {
            showTest f
          } else {
            failTest f $error
          }
        }
      }
      cleanupDb $dstFileName db false true false
      doneTest F
    }] 0]
  }]

  #############################################################################
  #                              WORKLOAD #7 (G)                              #
  #############################################################################

  set workload(7) [list \
      [list srcFileName dstFileName table count1 count2 count3] {

    #
    # NOTE: Workload #7, "small" UPDATE statements.
    #
    waitTest G
    lappend ::times(7) [lindex [time {
      initTest G
      setupWorkloadFileDb $dstFileName db
      for {set index 1} {$index <= $count1} {incr index} {
        if {[catch {

          sql execute $db [appendArgs "UPDATE " $table \
              " SET y = '" [base64 encode -- [expr {randstr($count2)}]] \
              "' WHERE x LIKE '" [format %X $index] "%' AND z = 'small';"]

          showTest G
        } error]} then {
          if {[isExpectedError $error]} then {
            showTest g
          } else {
            failTest g $error
          }
        }
      }
      cleanupDb $dstFileName db false true false
      doneTest G
    }] 0]
  }]

  #############################################################################
  #                              WORKLOAD #8 (H)                              #
  #############################################################################

  set workload(8) [list \
      [list srcFileName dstFileName table count1 count2 count3] {

    #
    # NOTE: Workload #8, "big" UPDATE statements.
    #
    waitTest H
    lappend ::times(8) [lindex [time {
      initTest H
      setupWorkloadFileDb $dstFileName db
      for {set index 1} {$index <= $count1} {incr index} {
        if {[catch {

          sql execute $db [appendArgs "UPDATE " $table \
              " SET y = RANDOMBLOB(" $count3 ") WHERE x LIKE '" \
              [format %X $index] "%' AND z = 'big';"]

          showTest H
        } error]} then {
          if {[isExpectedError $error]} then {
            showTest h
          } else {
            failTest h $error
          }
        }
      }
      cleanupDb $dstFileName db false true false
      doneTest H
    }] 0]
  }]

  #############################################################################
  #                              WORKLOAD #9 (I)                              #
  #############################################################################

  set workload(9) [list \
      [list srcFileName dstFileName table count1 count2 count3] {

    #
    # NOTE: Workload #9, "small" DELETE statements.
    #
    waitTest I
    lappend ::times(9) [lindex [time {
      initTest I
      setupWorkloadFileDb $dstFileName db
      for {set index 1} {$index <= $count1} {incr index} {
        if {[catch {

          sql execute $db [appendArgs "DELETE FROM " $table \
              " WHERE x LIKE '" [format %X $index] "%' AND z = 'small';"]

          showTest I
        } error]} then {
          if {[isExpectedError $error]} then {
            showTest i
          } else {
            failTest i $error
          }
        }
      }
      cleanupDb $dstFileName db false true false
      doneTest I
    }] 0]
  }]

  #############################################################################
  #                              WORKLOAD #10 (J)                             #
  #############################################################################

  set workload(10) [list \
      [list srcFileName dstFileName table count1 count2 count3] {

    #
    # NOTE: Workload #10, "big" DELETE statements.
    #
    waitTest J
    lappend ::times(10) [lindex [time {
      initTest J
      setupWorkloadFileDb $dstFileName db
      for {set index 1} {$index <= $count1} {incr index} {
        if {[catch {

          sql execute $db [appendArgs "DELETE FROM " $table \
              " WHERE x LIKE '" [format %X $index] "%' AND z = 'big';"]

          showTest J
        } error]} then {
          if {[isExpectedError $error]} then {
            showTest j
          } else {
            failTest j $error
          }
        }
      }
      cleanupDb $dstFileName db false true false
      doneTest J
    }] 0]
  }]

  #############################################################################
  #                              WORKLOAD #11 (K)                             #
  #############################################################################

  set workload(11) [list \
      [list srcFileName dstFileName table count1 count2 count3] {

    #
    # NOTE: Workload #11, VACUUM statement.
    #
    waitTest K
    lappend ::times(11) [lindex [time {
      initTest K
      setupWorkloadFileDb $dstFileName db







|
>









>




>



















|
>









>



>



















|
>









>



>



















|
>









>



>



















|
>









>


>



















|
>









>


>



















|
>







788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
  }]

  #############################################################################
  #                              WORKLOAD #5 (E)                              #
  #############################################################################

  set workload(5) [list \
      [list srcFileName dstFileName table count1 count2 count3 \
            count4 count5 count6 count7] {
    #
    # NOTE: Workload #5, "small" INSERT statements.
    #
    waitTest E
    lappend ::times(5) [lindex [time {
      initTest E
      setupWorkloadFileDb $dstFileName db
      for {set index 1} {$index <= $count1} {incr index} {
        if {[catch {
          beginTransaction $db
          sql execute $db [appendArgs "INSERT INTO " $table \
              "(x, y, z) VALUES('" [format %lX [expr {random()}]] \
              "', '" [base64 encode -- [expr {randstr($count2)}]] \
              "', 'small');"]
          endTransaction $db
          showTest E
        } error]} then {
          if {[isExpectedError $error]} then {
            showTest e
          } else {
            failTest e $error
          }
        }
      }
      cleanupDb $dstFileName db false true false
      doneTest E
    }] 0]
  }]

  #############################################################################
  #                              WORKLOAD #6 (F)                              #
  #############################################################################

  set workload(6) [list \
      [list srcFileName dstFileName table count1 count2 count3 \
            count4 count5 count6 count7] {
    #
    # NOTE: Workload #6, "big" INSERT statements.
    #
    waitTest F
    lappend ::times(6) [lindex [time {
      initTest F
      setupWorkloadFileDb $dstFileName db
      for {set index 1} {$index <= $count1} {incr index} {
        if {[catch {
          beginTransaction $db
          sql execute $db [appendArgs "INSERT INTO " $table \
              "(x, y, z) VALUES('" [format %lX [expr {random()}]] \
              "', RANDOMBLOB(" $count3 "), 'big');"]
          endTransaction $db
          showTest F
        } error]} then {
          if {[isExpectedError $error]} then {
            showTest f
          } else {
            failTest f $error
          }
        }
      }
      cleanupDb $dstFileName db false true false
      doneTest F
    }] 0]
  }]

  #############################################################################
  #                              WORKLOAD #7 (G)                              #
  #############################################################################

  set workload(7) [list \
      [list srcFileName dstFileName table count1 count2 count3 \
            count4 count5 count6 count7] {
    #
    # NOTE: Workload #7, "small" UPDATE statements.
    #
    waitTest G
    lappend ::times(7) [lindex [time {
      initTest G
      setupWorkloadFileDb $dstFileName db
      for {set index 1} {$index <= $count1} {incr index} {
        if {[catch {
          beginTransaction $db
          sql execute $db [appendArgs "UPDATE " $table \
              " SET y = '" [base64 encode -- [expr {randstr($count2)}]] \
              "' WHERE x LIKE '" [format %X $index] "%' AND z = 'small';"]
          endTransaction $db
          showTest G
        } error]} then {
          if {[isExpectedError $error]} then {
            showTest g
          } else {
            failTest g $error
          }
        }
      }
      cleanupDb $dstFileName db false true false
      doneTest G
    }] 0]
  }]

  #############################################################################
  #                              WORKLOAD #8 (H)                              #
  #############################################################################

  set workload(8) [list \
      [list srcFileName dstFileName table count1 count2 count3 \
            count4 count5 count6 count7] {
    #
    # NOTE: Workload #8, "big" UPDATE statements.
    #
    waitTest H
    lappend ::times(8) [lindex [time {
      initTest H
      setupWorkloadFileDb $dstFileName db
      for {set index 1} {$index <= $count1} {incr index} {
        if {[catch {
          beginTransaction $db
          sql execute $db [appendArgs "UPDATE " $table \
              " SET y = RANDOMBLOB(" $count3 ") WHERE x LIKE '" \
              [format %X $index] "%' AND z = 'big';"]
          endTransaction $db
          showTest H
        } error]} then {
          if {[isExpectedError $error]} then {
            showTest h
          } else {
            failTest h $error
          }
        }
      }
      cleanupDb $dstFileName db false true false
      doneTest H
    }] 0]
  }]

  #############################################################################
  #                              WORKLOAD #9 (I)                              #
  #############################################################################

  set workload(9) [list \
      [list srcFileName dstFileName table count1 count2 count3 \
            count4 count5 count6 count7] {
    #
    # NOTE: Workload #9, "small" DELETE statements.
    #
    waitTest I
    lappend ::times(9) [lindex [time {
      initTest I
      setupWorkloadFileDb $dstFileName db
      for {set index 1} {$index <= $count1} {incr index} {
        if {[catch {
          beginTransaction $db
          sql execute $db [appendArgs "DELETE FROM " $table \
              " WHERE x LIKE '" [format %X $index] "%' AND z = 'small';"]
          endTransaction $db
          showTest I
        } error]} then {
          if {[isExpectedError $error]} then {
            showTest i
          } else {
            failTest i $error
          }
        }
      }
      cleanupDb $dstFileName db false true false
      doneTest I
    }] 0]
  }]

  #############################################################################
  #                              WORKLOAD #10 (J)                             #
  #############################################################################

  set workload(10) [list \
      [list srcFileName dstFileName table count1 count2 count3 \
            count4 count5 count6 count7] {
    #
    # NOTE: Workload #10, "big" DELETE statements.
    #
    waitTest J
    lappend ::times(10) [lindex [time {
      initTest J
      setupWorkloadFileDb $dstFileName db
      for {set index 1} {$index <= $count1} {incr index} {
        if {[catch {
          beginTransaction $db
          sql execute $db [appendArgs "DELETE FROM " $table \
              " WHERE x LIKE '" [format %X $index] "%' AND z = 'big';"]
          endTransaction $db
          showTest J
        } error]} then {
          if {[isExpectedError $error]} then {
            showTest j
          } else {
            failTest j $error
          }
        }
      }
      cleanupDb $dstFileName db false true false
      doneTest J
    }] 0]
  }]

  #############################################################################
  #                              WORKLOAD #11 (K)                             #
  #############################################################################

  set workload(11) [list \
      [list srcFileName dstFileName table count1 count2 count3 \
            count4 count5 count6 count7] {
    #
    # NOTE: Workload #11, VACUUM statement.
    #
    waitTest K
    lappend ::times(11) [lindex [time {
      initTest K
      setupWorkloadFileDb $dstFileName db
934
935
936
937
938
939
940
941

942
943
944
945
946
947
948
  }]

  #############################################################################
  #                              WORKLOAD #12 (L)                             #
  #############################################################################

  set workload(12) [list \
      [list srcFileName dstFileName table count1 count2 count3] {

    #
    # NOTE: Workload #12, backup to in-memory database.
    #
    waitTest L
    lappend ::times(12) [lindex [time {
      initTest L
      for {set index 1} {$index <= $count1} {incr index} {







|
>







1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
  }]

  #############################################################################
  #                              WORKLOAD #12 (L)                             #
  #############################################################################

  set workload(12) [list \
      [list srcFileName dstFileName table count1 count2 count3 \
            count4 count5 count6 count7] {
    #
    # NOTE: Workload #12, backup to in-memory database.
    #
    waitTest L
    lappend ::times(12) [lindex [time {
      initTest L
      for {set index 1} {$index <= $count1} {incr index} {
1016
1017
1018
1019
1020
1021
1022
1023

1024
1025
1026
1027
1028
1029
1030
  }]

  #############################################################################
  #                              WORKLOAD #13 (M)                             #
  #############################################################################

  set workload(13) [list \
      [list srcFileName dstFileName table count1 count2 count3] {

    #
    # NOTE: Workload #13, backup from an in-memory database.
    #
    waitTest M
    lappend ::times(13) [lindex [time {
      initTest M
      for {set index 1} {$index <= $count1} {incr index} {







|
>







1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
  }]

  #############################################################################
  #                              WORKLOAD #13 (M)                             #
  #############################################################################

  set workload(13) [list \
      [list srcFileName dstFileName table count1 count2 count3 \
            count4 count5 count6 count7] {
    #
    # NOTE: Workload #13, backup from an in-memory database.
    #
    waitTest M
    lappend ::times(13) [lindex [time {
      initTest M
      for {set index 1} {$index <= $count1} {incr index} {
1098
1099
1100
1101
1102
1103
1104
1105

1106
1107
1108
1109
1110
1111
1112
  }]

  #############################################################################
  #                              WORKLOAD #14 (N)                             #
  #############################################################################

  set workload(14) [list \
      [list srcFileName dstFileName table count1 count2 count3] {

    #
    # NOTE: Workload #14, PRAGMA integrity check statement.
    #
    waitTest N
    lappend ::times(14) [lindex [time {
      initTest N
      setupWorkloadFileDb $dstFileName db







|
>







1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
  }]

  #############################################################################
  #                              WORKLOAD #14 (N)                             #
  #############################################################################

  set workload(14) [list \
      [list srcFileName dstFileName table count1 count2 count3 \
            count4 count5 count6 count7] {
    #
    # NOTE: Workload #14, PRAGMA integrity check statement.
    #
    waitTest N
    lappend ::times(14) [lindex [time {
      initTest N
      setupWorkloadFileDb $dstFileName db
1132
1133
1134
1135
1136
1137
1138
1139

1140
1141
1142
1143
1144
1145
1146
  }]

  #############################################################################
  #                              WORKLOAD #15 (O)                             #
  #############################################################################

  set workload(15) [list \
      [list srcFileName dstFileName table count1 count2 count3] {

    #
    # NOTE: Workload #15, force managed garbage collection
    #
    waitTest O
    lappend ::times(15) [lindex [time {
      initTest O
      for {set index 1} {$index <= $count1} {incr index} {







|
>







1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
  }]

  #############################################################################
  #                              WORKLOAD #15 (O)                             #
  #############################################################################

  set workload(15) [list \
      [list srcFileName dstFileName table count1 count2 count3 \
            count4 count5 count6 count7] {
    #
    # NOTE: Workload #15, force managed garbage collection
    #
    waitTest O
    lappend ::times(15) [lindex [time {
      initTest O
      for {set index 1} {$index <= $count1} {incr index} {
1160
1161
1162
1163
1164
1165
1166
1167

1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
  }]

  #############################################################################
  #                              WORKLOAD #16 (P)                             #
  #############################################################################

  set workload(16) [list \
      [list srcFileName dstFileName table count1 count2 count3] {

    #
    # NOTE: Workload #16, allocate (exclude) some native heap memory
    #
    waitTest P
    lappend ::times(16) [lindex [time {
      initTest P
      set maxSize $::count(5)
      object invoke GC AddMemoryPressure $maxSize
      try {
        for {set index 1} {$index <= $count1} {incr index} {
          if {[catch {
            set size [expr {int(min($maxSize, abs($count3 * $index * 5.0)))}]
            set ptr [allocMem $size]; # throw
            useMem $ptr $size; delayTest -1 $count2







|
>






|







1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
  }]

  #############################################################################
  #                              WORKLOAD #16 (P)                             #
  #############################################################################

  set workload(16) [list \
      [list srcFileName dstFileName table count1 count2 count3 \
            count4 count5 count6 count7] {
    #
    # NOTE: Workload #16, allocate (exclude) some native heap memory
    #
    waitTest P
    lappend ::times(16) [lindex [time {
      initTest P
      set maxSize $count4
      object invoke GC AddMemoryPressure $maxSize
      try {
        for {set index 1} {$index <= $count1} {incr index} {
          if {[catch {
            set size [expr {int(min($maxSize, abs($count3 * $index * 5.0)))}]
            set ptr [allocMem $size]; # throw
            useMem $ptr $size; delayTest -1 $count2
1200
1201
1202
1203
1204
1205
1206
1207

1208
1209
1210
1211
1212
1213
1214
  }]

  #############################################################################
  #                              WORKLOAD #17 (Q)                             #
  #############################################################################

  set workload(17) [list \
      [list srcFileName dstFileName table count1 count2 count3] {

    #
    # NOTE: Workload #17, change the database journal mode
    #
    waitTest Q
    lappend ::times(17) [lindex [time {
      initTest Q
      setupWorkloadFileDb $dstFileName db







|
>







1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
  }]

  #############################################################################
  #                              WORKLOAD #17 (Q)                             #
  #############################################################################

  set workload(17) [list \
      [list srcFileName dstFileName table count1 count2 count3 \
            count4 count5 count6 count7] {
    #
    # NOTE: Workload #17, change the database journal mode
    #
    waitTest Q
    lappend ::times(17) [lindex [time {
      initTest Q
      setupWorkloadFileDb $dstFileName db
1231
1232
1233
1234
1235
1236
1237
1238

1239
1240
1241
1242
1243
1244
1245
1246
1247




1248
1249
1250
1251
1252
1253
1254
  }]

  #############################################################################
  #                              WORKLOAD #18 (R)                             #
  #############################################################################

  set workload(18) [list \
      [list srcFileName dstFileName table count1 count2 count3] {

    #
    # NOTE: Workload #18, execute queries against the in-memory database
    #
    waitTest R
    lappend ::times(18) [lindex [time {
      initTest R
      setupWorkloadMemDb $srcFileName db
      for {set index 1} {$index <= $count1} {incr index} {
        if {[catch {




          #
          # NOTE: Workload #18.3, "small" SELECT statements.
          #
          set reader [sql execute -execute reader \
              -format dataReader -alias $db [appendArgs \
              "SELECT x, y FROM " $table " WHERE z = 'small';"]]
          while {[$reader Read]} {







|
>









>
>
>
>







1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
  }]

  #############################################################################
  #                              WORKLOAD #18 (R)                             #
  #############################################################################

  set workload(18) [list \
      [list srcFileName dstFileName table count1 count2 count3 \
            count4 count5 count6 count7] {
    #
    # NOTE: Workload #18, execute queries against the in-memory database
    #
    waitTest R
    lappend ::times(18) [lindex [time {
      initTest R
      setupWorkloadMemDb $srcFileName db
      for {set index 1} {$index <= $count1} {incr index} {
        if {[catch {
          #
          # NOTE: Maybe start a new transaction.
          #
          beginTransaction $db
          #
          # NOTE: Workload #18.3, "small" SELECT statements.
          #
          set reader [sql execute -execute reader \
              -format dataReader -alias $db [appendArgs \
              "SELECT x, y FROM " $table " WHERE z = 'small';"]]
          while {[$reader Read]} {
1300
1301
1302
1303
1304
1305
1306




1307
1308
1309
1310
1311
1312
1313
          sql execute $db [appendArgs "DELETE FROM " $table \
              " WHERE x LIKE '" [format %X $index] "%' AND z = 'small';"]
          #
          # NOTE: Workload #18.10, "big" DELETE statements.
          #
          sql execute $db [appendArgs "DELETE FROM " $table \
              " WHERE x LIKE '" [format %X $index] "%' AND z = 'big';"]




          #
          # NOTE: Workload #18.11, VACUUM statement.
          #
          sql execute $db "VACUUM;"
          #
          # NOTE: Workload #18.14, PRAGMA integrity check statement.
          #







>
>
>
>







1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
          sql execute $db [appendArgs "DELETE FROM " $table \
              " WHERE x LIKE '" [format %X $index] "%' AND z = 'small';"]
          #
          # NOTE: Workload #18.10, "big" DELETE statements.
          #
          sql execute $db [appendArgs "DELETE FROM " $table \
              " WHERE x LIKE '" [format %X $index] "%' AND z = 'big';"]
          #
          # NOTE: Maybe end the current transaction.
          #
          endTransaction $db
          #
          # NOTE: Workload #18.11, VACUUM statement.
          #
          sql execute $db "VACUUM;"
          #
          # NOTE: Workload #18.14, PRAGMA integrity check statement.
          #
1331
1332
1333
1334
1335
1336
1337
1338

1339
1340
1341
1342
1343
1344
1345
  }]

  #############################################################################
  #                              WORKLOAD #19 (S)                             #
  #############################################################################

  set workload(19) [list \
      [list srcFileName dstFileName table count1 count2 count3] {

    #
    # NOTE: Workload #19, rapidly open/close connections, thread #1.
    #
    waitTest S
    lappend ::times(19) [lindex [time {
      initTest S
      for {set index 1} {$index <= $count1} {incr index} {







|
>







1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
  }]

  #############################################################################
  #                              WORKLOAD #19 (S)                             #
  #############################################################################

  set workload(19) [list \
      [list srcFileName dstFileName table count1 count2 count3 \
            count4 count5 count6 count7] {
    #
    # NOTE: Workload #19, rapidly open/close connections, thread #1.
    #
    waitTest S
    lappend ::times(19) [lindex [time {
      initTest S
      for {set index 1} {$index <= $count1} {incr index} {
1360
1361
1362
1363
1364
1365
1366
1367

1368
1369
1370
1371
1372
1373
1374
  }]

  #############################################################################
  #                              WORKLOAD #20 (T)                             #
  #############################################################################

  set workload(20) [list \
      [list srcFileName dstFileName table count1 count2 count3] {

    #
    # NOTE: Workload #20, rapidly open/close connections, thread #2.
    #
    waitTest T
    lappend ::times(20) [lindex [time {
      initTest T
      for {set index 1} {$index <= $count1} {incr index} {







|
>







1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
  }]

  #############################################################################
  #                              WORKLOAD #20 (T)                             #
  #############################################################################

  set workload(20) [list \
      [list srcFileName dstFileName table count1 count2 count3 \
            count4 count5 count6 count7] {
    #
    # NOTE: Workload #20, rapidly open/close connections, thread #2.
    #
    waitTest T
    lappend ::times(20) [lindex [time {
      initTest T
      for {set index 1} {$index <= $count1} {incr index} {
1389
1390
1391
1392
1393
1394
1395
1396

1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424

1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
  }]

  #############################################################################
  #                              WORKLOAD #21 (U)                             #
  #############################################################################

  set workload(21) [list \
      [list srcFileName dstFileName table count1 count2 count3] {

    #
    # NOTE: Workload #21, rapidly try to release all non-essential memory.
    #
    waitTest U
    lappend ::times(21) [lindex [time {
      initTest U
      for {set index 1} {$index <= $::count(6)} {incr index} {
        if {[catch {
          releaseMem -1
          showTestWithDelay U 0 $::count(7)
        } error]} then {
          if {[isExpectedError $error]} then {
            showTest u
          } else {
            failTest u $error
          }
        }
      }
      doneTest U
    }] 0]
  }]

  #############################################################################
  #                              WORKLOAD #22 (V)                             #
  #############################################################################

  set workload(22) [list \
      [list srcFileName dstFileName table count1 count2 count3] {

    #
    # NOTE: Workload #22, rapidly try to change the default cache size.
    #
    waitTest V
    lappend ::times(22) [lindex [time {
      initTest V
      setupWorkloadFileDb $dstFileName db
      for {set index 1} {$index <= $::count(6)} {incr index} {
        if {[catch {
          sql execute $db [appendArgs \
              "PRAGMA default_cache_size=" \
              [expr {int(rand() * $::count(8))}] \;]
          showTestWithDelay V 0 $::count(7)
        } error]} then {
          if {[isExpectedError $error]} then {
            showTest v
          } else {
            failTest v $error
          }
        }







|
>






|


|

















|
>







|



|
|







1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
  }]

  #############################################################################
  #                              WORKLOAD #21 (U)                             #
  #############################################################################

  set workload(21) [list \
      [list srcFileName dstFileName table count1 count2 count3 \
            count4 count5 count6 count7] {
    #
    # NOTE: Workload #21, rapidly try to release all non-essential memory.
    #
    waitTest U
    lappend ::times(21) [lindex [time {
      initTest U
      for {set index 1} {$index <= $count5} {incr index} {
        if {[catch {
          releaseMem -1
          showTestWithDelay U 0 $count6
        } error]} then {
          if {[isExpectedError $error]} then {
            showTest u
          } else {
            failTest u $error
          }
        }
      }
      doneTest U
    }] 0]
  }]

  #############################################################################
  #                              WORKLOAD #22 (V)                             #
  #############################################################################

  set workload(22) [list \
      [list srcFileName dstFileName table count1 count2 count3 \
            count4 count5 count6 count7] {
    #
    # NOTE: Workload #22, rapidly try to change the default cache size.
    #
    waitTest V
    lappend ::times(22) [lindex [time {
      initTest V
      setupWorkloadFileDb $dstFileName db
      for {set index 1} {$index <= $count5} {incr index} {
        if {[catch {
          sql execute $db [appendArgs \
              "PRAGMA default_cache_size=" \
              [expr {int(rand() * $count7)}] \;]
          showTestWithDelay V 0 $count6
        } error]} then {
          if {[isExpectedError $error]} then {
            showTest v
          } else {
            failTest v $error
          }
        }
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502

    sql execute $srcDb "CREATE INDEX IF NOT EXISTS i1 ON t1(y);"
    sql execute $db "CREATE INDEX IF NOT EXISTS i1 ON t1(y);"

    foreach index(1) [lsort -integer $workloadNames(enabled)] {
      set workloadCallbacks($index(1)) [list \
          apply $workload($index(1)) $fileName(1) $fileName(2) t1 $count(1) \
          $count(3) $count(4)]

      set thread($index(1)) [object create -alias System.Threading.Thread \
          $workloadCallbacks($index(1)) 1048576]

      $thread($index(1)) Name [appendArgs \
          [file rootname [file tail $fileName(2)]] " #" $index(1)]








|







1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615

    sql execute $srcDb "CREATE INDEX IF NOT EXISTS i1 ON t1(y);"
    sql execute $db "CREATE INDEX IF NOT EXISTS i1 ON t1(y);"

    foreach index(1) [lsort -integer $workloadNames(enabled)] {
      set workloadCallbacks($index(1)) [list \
          apply $workload($index(1)) $fileName(1) $fileName(2) t1 $count(1) \
          $count(3) $count(4) $count(5) $count(6) $count(7) $count(8)]

      set thread($index(1)) [object create -alias System.Threading.Thread \
          $workloadCallbacks($index(1)) 1048576]

      $thread($index(1)) Name [appendArgs \
          [file rootname [file tail $fileName(2)]] " #" $index(1)]

1618
1619
1620
1621
1622
1623
1624


1625
1626
1627
1628
1629
1630
1631
  rename showTest ""
  rename waitTest ""
  rename delayTest ""
  rename initTest ""
  rename isExpectedError ""
  rename formatWorkloadTime ""
  rename formatWorkloadResult ""


  rename setupWorkloadFileDb ""
  rename setupWorkloadMemDb ""

  catch {
    #
    # NOTE: We must clear the connection pool now because we intend
    #       to delete the databases for this test.







>
>







1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
  rename showTest ""
  rename waitTest ""
  rename delayTest ""
  rename initTest ""
  rename isExpectedError ""
  rename formatWorkloadTime ""
  rename formatWorkloadResult ""
  rename endTransaction ""
  rename beginTransaction ""
  rename setupWorkloadFileDb ""
  rename setupWorkloadMemDb ""

  catch {
    #
    # NOTE: We must clear the connection pool now because we intend
    #       to delete the databases for this test.
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
    cleanupLogging $logFileName
  }

  rename cleanupLogging ""
  rename setupLogging ""

  unset -nocomplain result thread index workload priority journalMode \
      noWorkload priorities srcDb db fileName compiled options count \
      times logFileName logListener event timeout connection \
      indicators iterations exitOnFail coTaskMem noTrace failures \
      status workloadNames workloadCallbacks
} -time true -constraints {eagle command.object monoBug40 command.sql\
compile.DATA SQLite System.Data.SQLite compileCSharp} -result {0}}

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

#
# NOTE: Report after test.







|
|
|
|







1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
    cleanupLogging $logFileName
  }

  rename cleanupLogging ""
  rename setupLogging ""

  unset -nocomplain result thread index workload priority journalMode \
      pageSize noWorkload priorities srcDb db fileName compiled options \
      count times logFileName logListener event timeout connection \
      indicators iterations exitOnFail coTaskMem noTrace beginTransaction \
      endTransaction failures status workloadNames workloadCallbacks
} -time true -constraints {eagle command.object monoBug40 command.sql\
compile.DATA SQLite System.Data.SQLite compileCSharp} -result {0}}

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

#
# NOTE: Report after test.