/ Check-in [b425b998]
Login

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

Overview
Comment:Merge latest trunk changes, including the fixes for test file walprotocol.test.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | apple-osx
Files: files | file ages | folders
SHA3-256: b425b99811b331d3eb531251a1fb4c883648cb56d7e0fec8eb1870ab3b123d50
User & Date: dan 2017-11-30 07:56:43
Context
2017-12-05
15:00
Merge latest trunk changes, including the compilation fix for builds that define both SQLITE_ENABLE_MULTITHREADED_CHECKS and SQLITE_ENABLE_API_ARMOUR. check-in: 2cb5d2a9 user: dan tags: apple-osx
2017-11-30
07:56
Merge latest trunk changes, including the fixes for test file walprotocol.test. check-in: b425b998 user: dan tags: apple-osx
07:55
Update test file walprotocol.test to account for the changes in the wal locking protocol. check-in: 64e56700 user: dan tags: trunk
2017-11-28
13:48
Merge the snapshots-always-lock-the-wal-file change into this branch. check-in: 3ec976e0 user: dan tags: apple-osx
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to src/trigger.c.

   871    871       if( iEndTrigger ){
   872    872         sqlite3VdbeResolveLabel(v, iEndTrigger);
   873    873       }
   874    874       sqlite3VdbeAddOp0(v, OP_Halt);
   875    875       VdbeComment((v, "End: %s.%s", pTrigger->zName, onErrorText(orconf)));
   876    876   
   877    877       transferParseError(pParse, pSubParse);
   878         -    if( db->mallocFailed==0 ){
          878  +    if( db->mallocFailed==0 && pParse->nErr==0 ){
   879    879         pProgram->aOp = sqlite3VdbeTakeOpArray(v, &pProgram->nOp, &pTop->nMaxArg);
   880    880       }
   881    881       pProgram->nMem = pSubParse->nMem;
   882    882       pProgram->nCsr = pSubParse->nTab;
   883    883       pProgram->token = (void *)pTrigger;
   884    884       pPrg->aColmask[0] = pSubParse->oldmask;
   885    885       pPrg->aColmask[1] = pSubParse->newmask;

Changes to test/triggerG.test.

    57     57                       WHERE xx.a IN (1,2,3,4)
    58     58                         AND yy.a IN (2,3,4,5);
    59     59     END;
    60     60   
    61     61     INSERT INTO t3 VALUES(2);
    62     62     SELECT b FROM t2 ORDER BY b;
    63     63   } {20202 20203 20302 20303 30202 30203 30302 30303 40202 40203 40302 40303 50202 50203 50302 50303}
           64  +
           65  +# At one point the following was causing an assert() to fail.
           66  +#
           67  +do_execsql_test 300 {
           68  +  CREATE TABLE t4(x);
           69  +  CREATE TRIGGER tr4 AFTER INSERT ON t4 BEGIN
           70  +    SELECT 0x2147483648e0e0099 AS y WHERE y;
           71  +  END;
           72  +}
           73  +
           74  +do_catchsql_test 310 {
           75  +  INSERT INTO t4 VALUES(1);
           76  +} {1 {hex literal too big: 0x2147483648e0e0099}}
    64     77   
    65     78   finish_test

Changes to test/walprotocol.test.

    48     48   do_test 1.1 {
    49     49     testvfs T
    50     50     T filter xShmLock 
    51     51     T script lock_callback
    52     52     set ::locks [list]
    53     53     sqlite3 db test.db -vfs T
    54     54     execsql { SELECT * FROM x }
    55         -  lrange $::locks 0 3
    56         -} [list {0 1 lock exclusive} {1 7 lock exclusive}      \
    57         -        {1 7 unlock exclusive} {0 1 unlock exclusive}  \
           55  +  lrange $::locks 0 5
           56  +} [list {0 1 lock exclusive} {1 2 lock exclusive} {4 4 lock exclusive} \
           57  +        {1 2 unlock exclusive} {4 4 unlock exclusive} {0 1 unlock exclusive}  \
    58     58   ]
    59     59   do_test 1.2 {
    60     60     db close
    61     61     set ::locks [list]
    62     62     sqlite3 db test.db -vfs T
    63     63     execsql { SELECT * FROM x }
    64         -  lrange $::locks 0 3
    65         -} [list {0 1 lock exclusive} {1 7 lock exclusive}      \
    66         -        {1 7 unlock exclusive} {0 1 unlock exclusive}  \
           64  +  lrange $::locks 0 5
           65  +} [list {0 1 lock exclusive} {1 2 lock exclusive} {4 4 lock exclusive} \
           66  +        {1 2 unlock exclusive} {4 4 unlock exclusive} {0 1 unlock exclusive}  \
    67     67   ]
    68     68   proc lock_callback {method filename handle lock} {
    69         -  if {$lock == "1 7 lock exclusive"} { return SQLITE_BUSY }
           69  +  if {$lock == "1 2 lock exclusive"} { return SQLITE_BUSY }
    70     70     return SQLITE_OK
    71     71   }
    72     72   puts "# Warning: This next test case causes SQLite to call xSleep(1) 100 times."
    73     73   puts "# Normally this equates to a delay of roughly 10 seconds, but if SQLite"
    74     74   puts "# is built on unix without HAVE_USLEEP defined, it may be much longer."
    75     75   do_test 1.3 {
    76     76     db close
................................................................................
    81     81   
    82     82   puts "# Warning: Same again!"
    83     83   proc lock_callback {method filename handle lock} {
    84     84     if {$lock == "0 1 lock exclusive"} { return SQLITE_BUSY }
    85     85     return SQLITE_OK
    86     86   }
    87     87   do_test 1.4 {
           88  +  db close
           89  +  set ::locks [list]
           90  +  sqlite3 db test.db -vfs T
           91  +  catchsql { SELECT * FROM x }
           92  +} {1 {locking protocol}}
           93  +
           94  +puts "# Warning: Third time!"
           95  +proc lock_callback {method filename handle lock} {
           96  +  if {$lock == "4 4 lock exclusive"} { return SQLITE_BUSY }
           97  +  return SQLITE_OK
           98  +}
           99  +do_test 1.5 {
    88    100     db close
    89    101     set ::locks [list]
    90    102     sqlite3 db test.db -vfs T
    91    103     catchsql { SELECT * FROM x }
    92    104   } {1 {locking protocol}}
    93    105   db close
    94    106   T delete
................................................................................
   131    143   faultsim_save_and_close
   132    144   testvfs T -default 1
   133    145   faultsim_restore_and_reopen
   134    146   T filter xShmLock
   135    147   T script lock_callback
   136    148   
   137    149   proc lock_callback {method file handle spec} {
   138         -  if {$spec == "1 7 unlock exclusive"} {
          150  +  if {$spec == "1 2 unlock exclusive"} {
   139    151       T filter {}
   140    152       set ::r [catchsql { SELECT * FROM b } db2]
   141    153     }
   142    154   }
   143    155   sqlite3 db test.db
   144    156   sqlite3 db2 test.db
          157  +puts "# Warning: Another slow test!"
   145    158   do_test 2.5 {
   146    159     execsql { SELECT * FROM b }
   147    160   } {Tehran Qom Markazi Qazvin Gilan Ardabil}
   148    161   do_test 2.6 {
   149    162     set ::r
   150    163   } {1 {locking protocol}}
   151    164   
................................................................................
   153    166   db2 close
   154    167   
   155    168   faultsim_restore_and_reopen
   156    169   sqlite3 db2 test.db
   157    170   T filter xShmLock
   158    171   T script lock_callback
   159    172   proc lock_callback {method file handle spec} {
   160         -  if {$spec == "1 7 unlock exclusive"} {
          173  +  if {$spec == "1 2 unlock exclusive"} {
   161    174       T filter {}
   162    175       set ::r [catchsql { SELECT * FROM b } db2]
   163    176     }
   164    177   }
   165    178   unset ::r
          179  +puts "# Warning: Last one!"
   166    180   do_test 2.7 {
   167    181     execsql { SELECT * FROM b }
   168    182   } {Tehran Qom Markazi Qazvin Gilan Ardabil}
   169    183   do_test 2.8 {
   170    184     set ::r
   171    185   } {1 {locking protocol}}
   172    186   
   173    187   db close
   174    188   db2 close
   175    189   T delete
   176    190   
   177    191   finish_test