/ Check-in [bf309107]
Login
SQLite training in Houston TX on 2019-11-05 (details)
Part of the 2019 Tcl Conference

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

Overview
Comment:Fix a problem causing "PRAGMA journal_mode" to report the wrong journal mode (wal instead of wal2) under some circumstances.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | begin-concurrent-wal2
Files: files | file ages | folders
SHA3-256: bf309107dfc4d2abd68b9339c68aeaaffd278096bb2a5912e4a0b0c124fd6345
User & Date: dan 2018-12-05 17:20:47
Wiki:begin-concurrent-wal2
Context
2018-12-05
17:36
Fix a test script problem on this branch. check-in: 692ddc28 user: dan tags: begin-concurrent-wal2
17:20
Fix a problem causing "PRAGMA journal_mode" to report the wrong journal mode (wal instead of wal2) under some circumstances. check-in: bf309107 user: dan tags: begin-concurrent-wal2
17:14
Fix a problem causing "PRAGMA journal_mode" to report the wrong journal mode (wal instead of wal2) under some circumstances. check-in: 1d8d4f68 user: dan tags: wal2
16:45
Fixes for snapshots API on this branch. Also ensure that the snapshots API cannot be used with wal2 mode databases (for now anyhow). check-in: d8c2d55f user: dan tags: begin-concurrent-wal2
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to src/pager.c.

3316
3317
3318
3319
3320
3321
3322




3323
3324
3325
3326
3327
3328
3329
  */
  sqlite3WalEndReadTransaction(pPager->pWal);

  rc = sqlite3WalBeginReadTransaction(pPager->pWal, &changed);
  if( rc!=SQLITE_OK || changed ){
    pager_reset(pPager);
    if( USEFETCH(pPager) ) sqlite3OsUnfetch(pPager->fd, 0, 0);




  }

  return rc;
}
#endif

/*







>
>
>
>







3316
3317
3318
3319
3320
3321
3322
3323
3324
3325
3326
3327
3328
3329
3330
3331
3332
3333
  */
  sqlite3WalEndReadTransaction(pPager->pWal);

  rc = sqlite3WalBeginReadTransaction(pPager->pWal, &changed);
  if( rc!=SQLITE_OK || changed ){
    pager_reset(pPager);
    if( USEFETCH(pPager) ) sqlite3OsUnfetch(pPager->fd, 0, 0);
    assert( pPager->journalMode==PAGER_JOURNALMODE_WAL
         || pPager->journalMode==PAGER_JOURNALMODE_WAL2
    );
    pPager->journalMode = sqlite3WalJournalMode(pPager->pWal);
  }

  return rc;
}
#endif

/*

Changes to src/wal.c.

4908
4909
4910
4911
4912
4913
4914
4915








4916
  int rc = SQLITE_OK;
  if( pWal ){
    *pnFrame = pWal->hdr.mxFrame;
    *pnPrior = pWal->nPriorFrame;
  }
  return rc;
}









#endif /* #ifndef SQLITE_OMIT_WAL */








>
>
>
>
>
>
>
>

4908
4909
4910
4911
4912
4913
4914
4915
4916
4917
4918
4919
4920
4921
4922
4923
4924
  int rc = SQLITE_OK;
  if( pWal ){
    *pnFrame = pWal->hdr.mxFrame;
    *pnPrior = pWal->nPriorFrame;
  }
  return rc;
}

/* 
** Return the journal mode used by this Wal object.
*/
int sqlite3WalJournalMode(Wal *pWal){
  assert( pWal );
  return (isWalMode2(pWal) ? PAGER_JOURNALMODE_WAL2 : PAGER_JOURNALMODE_WAL);
}

#endif /* #ifndef SQLITE_OMIT_WAL */

Changes to src/wal.h.

41
42
43
44
45
46
47

48
49
50
51
52
53
54
...
150
151
152
153
154
155
156



157
158
159
160
161
162
# define sqlite3WalCheckpoint(q,r,s,t,u,v,w,x,y,z) 0
# define sqlite3WalCallback(z)                   0
# define sqlite3WalExclusiveMode(y,z)            0
# define sqlite3WalHeapMemory(z)                 0
# define sqlite3WalFramesize(z)                  0
# define sqlite3WalFindFrame(x,y,z)              0
# define sqlite3WalFile(x)                       0

#else

#define WAL_SAVEPOINT_NDATA 4

/* Connection to a write-ahead log (WAL) file. 
** There is one object of this type for each pager. 
*/
................................................................................
** stored in each frame (i.e. the db page-size when the WAL was created).
*/
int sqlite3WalFramesize(Wal *pWal);
#endif

/* Return the sqlite3_file object for the WAL file */
sqlite3_file *sqlite3WalFile(Wal *pWal);




/* sqlite3_wal_info() data */
int sqlite3WalInfo(Wal *pWal, u32 *pnPrior, u32 *pnFrame);

#endif /* ifndef SQLITE_OMIT_WAL */
#endif /* SQLITE_WAL_H */







>







 







>
>
>






41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
...
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
# define sqlite3WalCheckpoint(q,r,s,t,u,v,w,x,y,z) 0
# define sqlite3WalCallback(z)                   0
# define sqlite3WalExclusiveMode(y,z)            0
# define sqlite3WalHeapMemory(z)                 0
# define sqlite3WalFramesize(z)                  0
# define sqlite3WalFindFrame(x,y,z)              0
# define sqlite3WalFile(x)                       0
# define sqlite3WalJournalMode(x)                0
#else

#define WAL_SAVEPOINT_NDATA 4

/* Connection to a write-ahead log (WAL) file. 
** There is one object of this type for each pager. 
*/
................................................................................
** stored in each frame (i.e. the db page-size when the WAL was created).
*/
int sqlite3WalFramesize(Wal *pWal);
#endif

/* Return the sqlite3_file object for the WAL file */
sqlite3_file *sqlite3WalFile(Wal *pWal);

/* Return the journal mode (WAL or WAL2) used by this Wal object. */
int sqlite3WalJournalMode(Wal *pWal);

/* sqlite3_wal_info() data */
int sqlite3WalInfo(Wal *pWal, u32 *pnPrior, u32 *pnFrame);

#endif /* ifndef SQLITE_OMIT_WAL */
#endif /* SQLITE_WAL_H */