SQLite

Check-in [7cd56cad5e]
Login

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

Overview
Comment:Remove a broken assert() triggered by a "PRAGMA max_page_count = N" invocation, where N is larger than the number of pages in the database image, but smaller than the number of pages in the database file.
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: 7cd56cad5efead5097e9918c87313bb46e583fe62bae0df1be60e10117e2c3cb
User & Date: dan 2019-01-19 15:27:09.978
References
2019-01-21
14:49
Minor fix the fallocate.test module change from [7cd56cad5efead5] (check-in: 94fb7a4700 user: drh tags: trunk)
Context
2019-01-19
15:55
Avoid a division-by-zero error in fts5 caused by a corrupt database. (check-in: 928e622178 user: dan tags: trunk)
15:27
Remove a broken assert() triggered by a "PRAGMA max_page_count = N" invocation, where N is larger than the number of pages in the database image, but smaller than the number of pages in the database file. (check-in: 7cd56cad5e user: dan tags: trunk)
14:07
Fix a problem with using ALTER TABLE to rename a table or column when the database schema contains a trigger or view that itself contains an expression "<column> AND 0". (check-in: 908ff7fffa user: dan tags: trunk)
Changes
Unified Diff Ignore Whitespace Patch
Changes to src/pager.c.
3835
3836
3837
3838
3839
3840
3841
3842



3843
3844
3845
3846
3847
3848
3849
** Regardless of mxPage, return the current maximum page count.
*/
int sqlite3PagerMaxPageCount(Pager *pPager, int mxPage){
  if( mxPage>0 ){
    pPager->mxPgno = mxPage;
  }
  assert( pPager->eState!=PAGER_OPEN );      /* Called only by OP_MaxPgcnt */
  assert( pPager->mxPgno>=pPager->dbSize );  /* OP_MaxPgcnt enforces this */



  return pPager->mxPgno;
}

/*
** The following set of routines are used to disable the simulated
** I/O error mechanism.  These routines are used to avoid simulated
** errors in places where we do not care about errors.







|
>
>
>







3835
3836
3837
3838
3839
3840
3841
3842
3843
3844
3845
3846
3847
3848
3849
3850
3851
3852
** Regardless of mxPage, return the current maximum page count.
*/
int sqlite3PagerMaxPageCount(Pager *pPager, int mxPage){
  if( mxPage>0 ){
    pPager->mxPgno = mxPage;
  }
  assert( pPager->eState!=PAGER_OPEN );      /* Called only by OP_MaxPgcnt */
  /* assert( pPager->mxPgno>=pPager->dbSize ); */
  /* OP_MaxPgcnt ensures that the parameter passed to this function is not
  ** less than the total number of valid pages in the database. But this
  ** may be less than Pager.dbSize, and so the assert() above is not valid */
  return pPager->mxPgno;
}

/*
** The following set of routines are used to disable the simulated
** I/O error mechanism.  These routines are used to avoid simulated
** errors in places where we do not care about errors.
Changes to test/fallocate.test.
66
67
68
69
70
71
72









73
74
75
76
77
78
79
    hexio_get_int [hexio_read test.db-journal 16 4]
  } else {
    set {} 1024
  }
} {1024}
do_test fallocate-1.8 { execsql { COMMIT } } {}











#-------------------------------------------------------------------------
# The following tests - fallocate-2.* - test that things work in WAL
# mode as well.
#
set skipwaltests [expr {
  [permutation]=="journaltest" || [permutation]=="inmemory_journal"







>
>
>
>
>
>
>
>
>







66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
    hexio_get_int [hexio_read test.db-journal 16 4]
  } else {
    set {} 1024
  }
} {1024}
do_test fallocate-1.8 { execsql { COMMIT } } {}

do_test 1.8 {
  set nPg [db one {PRAGMA page_count}]
  set nFile [expr [file size test.db] / 1024]
  list [expr $nPg<100] [expr $nFile>100]
} {1 1}

do_execsql_test 1.9 {
  PRAGMA max_page_count = 100;
} {}

#-------------------------------------------------------------------------
# The following tests - fallocate-2.* - test that things work in WAL
# mode as well.
#
set skipwaltests [expr {
  [permutation]=="journaltest" || [permutation]=="inmemory_journal"