/ Check-in [8eb62fd5]
Login

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

Overview
Comment:Update incrvacuum.test so that it works with builds that do not support mmap().
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256:8eb62fd5fa9adb88de51aa812270dbdb32ee5cacd636d200e658c507a14a035b
User & Date: dan 2018-11-28 19:12:59
Original User & Date: dan 2018-11-29 01:20:51
Context
2018-11-28
19:23
Fix a typo in a comment used to generate documentation. No changes to code. check-in: 62360cea user: drh tags: trunk
19:12
Update incrvacuum.test so that it works with builds that do not support mmap(). check-in: 8eb62fd5 user: dan tags: trunk
11:49
Update some test cases to account for SQLITE_OMIT_VIRTUAL_TABLE builds. check-in: b53a9a3d user: dan tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to test/incrvacuum.test.

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
} {ok}

#-------------------------------------------------------------------------
# At one point it was unsafe to truncate a db file on windows while there
# were outstanding xFetch() references. This test case attempts to hit
# that case.
#

reset_db
do_execsql_test incrvacuum-16.0 {
  PRAGMA auto_vacuum = 2;
  CREATE TABLE t3(a);
  INSERT INTO t3 VALUES(1), (2), (3), (4);

  CREATE TABLE t2(x);
  INSERT INTO t2 VALUES( randomblob(1000) );
  INSERT INTO t2 VALUES( randomblob(1000) );
  INSERT INTO t2 VALUES( randomblob(1000) );
  INSERT INTO t2 VALUES( randomblob(1000) );
  INSERT INTO t2 VALUES( randomblob(1000) );
  INSERT INTO t2 VALUES( randomblob(1000) );
} {}

# Reopen db to ensure the page-cache is empty.
#
db close
sqlite3 db test.db

# Open db in mmap-mode. Open a transaction, delete some data, then run
# incremental-vacuum. Do not commit the transaction. 
#
do_execsql_test incrvacuum-16.1 {
  PRAGMA mmap_size = 1000000;
  BEGIN;
  DELETE FROM t2;
  PRAGMA incremental_vacuum = 1000;
} {1000000}

# Scan through table t3 (which is all clean pages - so mmap is used). Then,
# midway through, commit the transaction. This causes the db to be truncated
# while there are outstanding xFetch pages.
#
do_test incrvacuum-16.2 {
  set res [list]
  db eval { SELECT a FROM t3 } {
    if {$a==3} { db eval COMMIT }
    lappend res $a
  }
  set res
} {1 2 3 4}


finish_test







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

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

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
} {ok}

#-------------------------------------------------------------------------
# At one point it was unsafe to truncate a db file on windows while there
# were outstanding xFetch() references. This test case attempts to hit
# that case.
#
ifcapable mmap {
  reset_db
  do_execsql_test incrvacuum-16.0 {
    PRAGMA auto_vacuum = 2;
    CREATE TABLE t3(a);
    INSERT INTO t3 VALUES(1), (2), (3), (4);
  
    CREATE TABLE t2(x);
    INSERT INTO t2 VALUES( randomblob(1000) );
    INSERT INTO t2 VALUES( randomblob(1000) );
    INSERT INTO t2 VALUES( randomblob(1000) );
    INSERT INTO t2 VALUES( randomblob(1000) );
    INSERT INTO t2 VALUES( randomblob(1000) );
    INSERT INTO t2 VALUES( randomblob(1000) );
  } {}
  
  # Reopen db to ensure the page-cache is empty.
  #
  db close
  sqlite3 db test.db
  
  # Open db in mmap-mode. Open a transaction, delete some data, then run
  # incremental-vacuum. Do not commit the transaction. 
  #
  do_execsql_test incrvacuum-16.1 {
    PRAGMA mmap_size = 1000000;
    BEGIN;
    DELETE FROM t2;
    PRAGMA incremental_vacuum = 1000;
  } {1000000}

  # Scan through table t3 (which is all clean pages - so mmap is used). Then,
  # midway through, commit the transaction. This causes the db to be truncated
  # while there are outstanding xFetch pages.
  #
  do_test incrvacuum-16.2 {
    set res [list]
    db eval { SELECT a FROM t3 } {
      if {$a==3} { db eval COMMIT }
      lappend res $a
    }
    set res
  } {1 2 3 4}
}
  
finish_test