SQLite

Check-in [4256072399]
Login

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

Overview
Comment:Add a more rigorous test case for the bug fixed by the previous commit on this branch.
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | begin-concurrent
Files: files | file ages | folders
SHA3-256: 4256072399f44f48ed0856aa8112226af6feaf8676923612bde6cea239ebf920
User & Date: dan 2017-08-12 14:06:15.050
Context
2017-09-12
20:09
Add the highly-experimental "PRAGMA noop_update=TRUE" command. (check-in: afe45271b9 user: drh tags: begin-concurrent-pnu)
2017-08-24
10:10
Test BEGIN CONCURRENT transactions that consist entirely of read-only statements. (check-in: c3fe1f4b7e user: dan tags: begin-concurrent)
2017-08-12
14:06
Add a more rigorous test case for the bug fixed by the previous commit on this branch. (check-in: 4256072399 user: dan tags: begin-concurrent)
2017-08-11
21:16
Fix a problem allowing a conflicting transaction to be committed in the case where more than one 32KB shared-memory page has been written to since the transaction was started. (check-in: 38dd9b50fe user: dan tags: begin-concurrent)
Changes
Unified Diff Ignore Whitespace Patch
Changes to test/concurrent.test.
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586

      CREATE TABLE t3(a INTEGER PRIMARY KEY, b);
      WITH s(i) AS ( VALUES(1) UNION ALL SELECT i+1 FROM s WHERE i<100) 
      INSERT INTO t3 SELECT NULL, randomblob(400) FROM s;

      CREATE TABLE t4(a INTEGER PRIMARY KEY, b);

      PRAGMA wal_checkpoint;
    }
    set {} {}
  } {}

  do_test 7.$tn.2 {
    sql2 {
      BEGIN CONCURRENT;







<







572
573
574
575
576
577
578

579
580
581
582
583
584
585

      CREATE TABLE t3(a INTEGER PRIMARY KEY, b);
      WITH s(i) AS ( VALUES(1) UNION ALL SELECT i+1 FROM s WHERE i<100) 
      INSERT INTO t3 SELECT NULL, randomblob(400) FROM s;

      CREATE TABLE t4(a INTEGER PRIMARY KEY, b);


    }
    set {} {}
  } {}

  do_test 7.$tn.2 {
    sql2 {
      BEGIN CONCURRENT;
611
612
613
614
615
616
617
618


619





























620
    csql2 { COMMIT } 
  } {1 {database is locked}}

  do_test 7.$tn.6 {
    csql3 { COMMIT } 
  } {1 {database is locked}}

}
































finish_test







|
>
>

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

610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
    csql2 { COMMIT } 
  } {1 {database is locked}}

  do_test 7.$tn.6 {
    csql3 { COMMIT } 
  } {1 {database is locked}}


  csql2 ROLLBACK
  csql3 ROLLBACK

  # The following test works with $tn==1 (sql2 and sql3 use separate 
  # processes), but is quite slow. So only run it with $tn==2 (all
  # connections in the same process).
  #
  if {$tn==2} {
    do_test 7.$tn.7 {
      for {set i 1} {$i < 10000} {incr i} {
        sql3 { 
          PRAGMA wal_checkpoint;
          BEGIN CONCURRENT;
          SELECT * FROM t3;
          INSERT INTO t4 VALUES(1, 2);
        }

        sql1 {
          UPDATE t2 SET b = randomblob(400) WHERE rowid <= $i;
          UPDATE t3 SET b = randomblob(400) WHERE rowid = 1;
        }

        if {[csql3 COMMIT]!={1 {database is locked}}} {
          error "Failed at i=$i"
        }
        csql3 ROLLBACK
      }
    } {}
  }

}

finish_test