/ Check-in [1d8d4f68]
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 | wal2
Files: files | file ages | folders
SHA3-256: 1d8d4f689653ce80157740e339f7f1b42479bf90d82b176d8202d0a49f428398
User & Date: dan 2018-12-05 17:14:03
Wiki:wal2
Context
2018-12-05
17:31
Fix a test script problem on this branch. check-in: 285d1c59 user: dan tags: 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:31
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: 19c61ab7 user: dan tags: wal2
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to src/pager.c.

3254
3255
3256
3257
3258
3259
3260




3261
3262
3263
3264
3265
3266
3267
  */
  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

/*







>
>
>
>







3254
3255
3256
3257
3258
3259
3260
3261
3262
3263
3264
3265
3266
3267
3268
3269
3270
3271
  */
  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.

4636
4637
4638
4639
4640
4641
4642
4643








4644
#endif

/* Return the sqlite3_file object for the WAL file
*/
sqlite3_file *sqlite3WalFile(Wal *pWal){
  return pWal->apWalFd[0];
}









#endif /* #ifndef SQLITE_OMIT_WAL */








>
>
>
>
>
>
>
>

4636
4637
4638
4639
4640
4641
4642
4643
4644
4645
4646
4647
4648
4649
4650
4651
4652
#endif

/* Return the sqlite3_file object for the WAL file
*/
sqlite3_file *sqlite3WalFile(Wal *pWal){
  return pWal->apWalFd[0];
}

/* 
** 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
...
141
142
143
144
145
146
147



148
149
150
# 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);




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







>







 







>
>
>



41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
...
142
143
144
145
146
147
148
149
150
151
152
153
154
# 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);

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