/ Check-in [92be06c1]
Login

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

Overview
Comment:Changing page size using VACUUM or backup is not allowed with a codec attached.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | see-testing
Files: files | file ages | folders
SHA1: 92be06c1a828d56652fa5269a3029f8cb029b2cd
User & Date: drh 2016-03-14 20:49:24
Context
2016-03-14
21:12
Update test scripts so that they work with SEE. check-in: f4693ba4 user: drh tags: trunk
20:49
Changing page size using VACUUM or backup is not allowed with a codec attached. Closed-Leaf check-in: 92be06c1 user: drh tags: see-testing
18:42
Merge test script fixes from trunk. check-in: ea1d2cdd user: drh tags: see-testing
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to test/pager1.test.

  1392   1392     testvfs tv -default 1
  1393   1393     tv sectorsize 4096
  1394   1394     faultsim_delete_and_reopen
  1395   1395   
  1396   1396     execsql { PRAGMA page_size = 1024 }
  1397   1397     for {set ii 0} {$ii < 4} {incr ii} { execsql "CREATE TABLE t${ii}(a, b)" }
  1398   1398   } {}
  1399         -do_test pager1-9.3.2 {
  1400         -  sqlite3 db2 test.db2
  1401         -
  1402         -  execsql {
  1403         -    PRAGMA page_size = 4096;
  1404         -    PRAGMA synchronous = OFF;
  1405         -    CREATE TABLE t1(a, b);
  1406         -    CREATE TABLE t2(a, b);
  1407         -  } db2
  1408         -
  1409         -  sqlite3_backup B db2 main db main
  1410         -  B step 30
  1411         -  list [B step 10000] [B finish]
  1412         -} {SQLITE_DONE SQLITE_OK}
  1413         -do_test pager1-9.3.3 {
  1414         -  db2 close
  1415         -  db close
  1416         -  tv delete
  1417         -  file size test.db2
  1418         -} [file size test.db]
         1399  +if {[nonzero_reserved_bytes]} {
         1400  +  # backup with a page size changes is not possible with the codec
         1401  +  #
         1402  +  do_test pager1-9.3.2codec {
         1403  +    sqlite3 db2 test.db2
         1404  +    execsql {
         1405  +      PRAGMA page_size = 4096;
         1406  +      PRAGMA synchronous = OFF;
         1407  +      CREATE TABLE t1(a, b);
         1408  +      CREATE TABLE t2(a, b);
         1409  +    } db2
         1410  +    sqlite3_backup B db2 main db main
         1411  +    B step 30
         1412  +    list [B step 10000] [B finish]
         1413  +  } {SQLITE_READONLY SQLITE_READONLY}
         1414  +  do_test pager1-9.3.3codec {
         1415  +    db2 close
         1416  +    db close
         1417  +    tv delete
         1418  +    file size test.db2
         1419  +  } [file size test.db2]
         1420  +} else {
         1421  +  do_test pager1-9.3.2 {
         1422  +    sqlite3 db2 test.db2
         1423  +    execsql {
         1424  +      PRAGMA page_size = 4096;
         1425  +      PRAGMA synchronous = OFF;
         1426  +      CREATE TABLE t1(a, b);
         1427  +      CREATE TABLE t2(a, b);
         1428  +    } db2
         1429  +    sqlite3_backup B db2 main db main
         1430  +    B step 30
         1431  +    list [B step 10000] [B finish]
         1432  +  } {SQLITE_DONE SQLITE_OK}
         1433  +  do_test pager1-9.3.3 {
         1434  +    db2 close
         1435  +    db close
         1436  +    tv delete
         1437  +    file size test.db2
         1438  +  } [file size test.db]
         1439  +}
  1419   1440   
  1420   1441   do_test pager1-9.4.1 {
  1421   1442     faultsim_delete_and_reopen
  1422   1443     sqlite3 db2 test.db2
  1423   1444     execsql {
  1424   1445       PRAGMA page_size = 4096;
  1425   1446       CREATE TABLE t1(a, b);
................................................................................
  2443   2464       PRAGMA auto_vacuum = full;
  2444   2465       PRAGMA locking_mode=exclusive;
  2445   2466       CREATE TABLE t1(a, b);
  2446   2467       INSERT INTO t1 VALUES(1, 2);
  2447   2468     }
  2448   2469     file size test.db
  2449   2470   } [expr 1024*3]
  2450         -do_test pager1-29.2 {
  2451         -  execsql {
  2452         -    PRAGMA page_size = 4096;
  2453         -    VACUUM;
  2454         -  }
  2455         -  file size test.db
  2456         -} [expr 4096*3]
         2471  +if {[nonzero_reserved_bytes]} {
         2472  +  # VACUUM with size changes is not possible with the codec.
         2473  +  do_test pager1-29.2 {
         2474  +    catchsql {
         2475  +      PRAGMA page_size = 4096;
         2476  +      VACUUM;
         2477  +    }
         2478  +  } {1 {attempt to write a readonly database}}
         2479  +} else {
         2480  +  do_test pager1-29.2 {
         2481  +    execsql {
         2482  +      PRAGMA page_size = 4096;
         2483  +      VACUUM;
         2484  +    }
         2485  +    file size test.db
         2486  +  } [expr 4096*3]
         2487  +}
  2457   2488   
  2458   2489   #-------------------------------------------------------------------------
  2459   2490   # Test that if an empty database file (size 0 bytes) is opened in 
  2460   2491   # exclusive-locking mode, any journal file is deleted from the file-system
  2461   2492   # without being rolled back. And that the RESERVED lock obtained while
  2462   2493   # doing this is not released.
  2463   2494   #

Changes to test/superlock.test.

   235    235   do_catchsql_test 6.7 { SELECT * FROM t1 } {1 {no such table: t1}}
   236    236   do_catchsql_test 6.8 { SELECT * FROM t2 } {0 {a b}}
   237    237   
   238    238   db_swap test.db2 test.db
   239    239   do_catchsql_test 6.9 { SELECT * FROM t1 } {0 {1 2 3 4}}
   240    240   do_catchsql_test 6.10 { SELECT * FROM t2 } {1 {no such table: t2}}
   241    241   
   242         -do_execsql_test  6.11 { 
   243         -  PRAGMA journal_mode = delete;
   244         -  PRAGMA page_size = 512;
   245         -  VACUUM;
   246         -  PRAGMA journal_mode = wal;
   247         -  INSERT INTO t1 VALUES(5, 6);
   248         -} {delete wal}
          242  +if {[nonzero_reserved_bytes]} {
          243  +  # Vacuum with a size change is not allowed with the codec
          244  +  do_execsql_test  6.11codec { 
          245  +    PRAGMA journal_mode = delete;
          246  +    VACUUM;
          247  +    PRAGMA journal_mode = wal;
          248  +    INSERT INTO t1 VALUES(5, 6);
          249  +  } {delete wal}
          250  +} else {
          251  +  do_execsql_test  6.11 { 
          252  +    PRAGMA journal_mode = delete;
          253  +    PRAGMA page_size = 512;
          254  +    VACUUM;
          255  +    PRAGMA journal_mode = wal;
          256  +    INSERT INTO t1 VALUES(5, 6);
          257  +  } {delete wal}
          258  +}
   249    259   
   250    260   db_swap test.db2 test.db
   251    261   do_catchsql_test 6.12 { SELECT * FROM t1 } {1 {no such table: t1}}
   252    262   do_catchsql_test 6.13 { SELECT * FROM t2 } {0 {a b}}
   253    263   
   254    264   db_swap test.db2 test.db
   255    265   do_catchsql_test 6.14 { SELECT * FROM t1 } {0 {1 2 3 4 5 6}}
   256    266   do_catchsql_test 6.15 { SELECT * FROM t2 } {1 {no such table: t2}}
   257    267   
   258    268   finish_test