/ Check-in [0eed1521]
Login

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

Overview
Comment:Fix a problem on this branch causing some page-level read-locks to be omitted.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | begin-concurrent
Files: files | file ages | folders
SHA3-256: 0eed152162b4721f7aaba8b480426476978a869e9578f100fca7b1d32942fe1a
User & Date: dan 2017-05-18 20:47:31
Wiki:begin-concurrent
Context
2017-05-19
19:57
Invoke sqlite3_log() in response to irregularities surrounding the Pager.pAllRead bit-vector. check-in: 9527089b user: dan tags: begin-concurrent
2017-05-18
20:47
Fix a problem on this branch causing some page-level read-locks to be omitted. check-in: 0eed1521 user: dan tags: begin-concurrent
2017-05-15
17:34
Merge the latest changes from trunk. check-in: 14ea8400 user: drh tags: begin-concurrent
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to src/pager.c.

1791
1792
1793
1794
1795
1796
1797

1798
1799
1800
1801
1802
1803
1804
** SQLITE_OK if successful, or an SQLite error code (SQLITE_NOMEM) if an error
** occurs.
*/
int sqlite3PagerBeginConcurrent(Pager *pPager){
  int rc = SQLITE_OK;
  if( pPager->pAllRead==0 ){
    pPager->pAllRead = sqlite3BitvecCreate(pPager->dbSize);

    if( pPager->pAllRead==0 ){
      rc = SQLITE_NOMEM;
    }
  }
  return rc;
}








>







1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
** SQLITE_OK if successful, or an SQLite error code (SQLITE_NOMEM) if an error
** occurs.
*/
int sqlite3PagerBeginConcurrent(Pager *pPager){
  int rc = SQLITE_OK;
  if( pPager->pAllRead==0 ){
    pPager->pAllRead = sqlite3BitvecCreate(pPager->dbSize);
    pPager->dbOrigSize = pPager->dbSize;
    if( pPager->pAllRead==0 ){
      rc = SQLITE_NOMEM;
    }
  }
  return rc;
}

Changes to test/concurrent.test.

521
522
523
524
525
526
527
528






























529
530
    sql2 { INSERT INTO tt VALUES(2, randomblob(6000)) }
  } {}

  do_test 5.$tn.3 {
    sql1 { COMMIT }
  } {}
}































finish_test









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


521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
    sql2 { INSERT INTO tt VALUES(2, randomblob(6000)) }
  } {}

  do_test 5.$tn.3 {
    sql1 { COMMIT }
  } {}
}

do_multiclient_test tn {
  do_test 6.$tn.1 {
    sql1 {
      PRAGMA journal_mode = wal;
      CREATE TABLE t1(a INTEGER PRIMARY KEY, b);
      CREATE TABLE t2(a INTEGER PRIMARY KEY, b);
      INSERT INTO t1 VALUES(1, 'one');
      INSERT INTO t2 VALUES(2, 'two');
    }
  } {wal}

  do_test 6.$tn.2 {
    sql2 {
      BEGIN CONCURRENT;
        SELECT * FROM t2;
        INSERT INTO t1 VALUES(3, 'three');
    }
  } {2 two}

  do_test 6.$tn.3 {
    sql1 {
      INSERT INTO t2 VALUES(3, 'three');
    }
  } {}

  do_test 6.$tn.2 {
    list [catch { sql2 { COMMIT } } msg] $msg
  } {1 {database is locked}}
}

finish_test