SQLite

Check-in [1ba41bc2af]
Login

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

Overview
Comment:Allow the rollback journal to be empty except for its header. Ticket #212. (CVS 809)
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 1ba41bc2afab18cc295d9a45845296b46bfa57e5
User & Date: drh 2003-01-03 02:04:27.000
Context
2003-01-04
16:48
Optimizations to the BTree module for a modest speed improvement. (CVS 810) (check-in: 39902a7041 user: drh tags: trunk)
2003-01-03
02:04
Allow the rollback journal to be empty except for its header. Ticket #212. (CVS 809) (check-in: 1ba41bc2af user: drh tags: trunk)
2003-01-02
14:43
Code optimizations to help the library run faster. (CVS 808) (check-in: db745e87dc user: drh tags: trunk)
Changes
Unified Diff Ignore Whitespace Patch
Changes to src/pager.c.
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
** The pager is used to access a database disk file.  It implements
** atomic commit and rollback through the use of a journal file that
** is separate from the database file.  The pager also implements file
** locking to prevent two processes from writing the same database
** file simultaneously, or one process from reading the database while
** another is writing.
**
** @(#) $Id: pager.c,v 1.63 2003/01/02 14:43:57 drh Exp $
*/
#include "os.h"         /* Must be first to enable large file support */
#include "sqliteInt.h"
#include "pager.h"
#include <assert.h>
#include <string.h>








|







14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
** The pager is used to access a database disk file.  It implements
** atomic commit and rollback through the use of a journal file that
** is separate from the database file.  The pager also implements file
** locking to prevent two processes from writing the same database
** file simultaneously, or one process from reading the database while
** another is writing.
**
** @(#) $Id: pager.c,v 1.64 2003/01/03 02:04:27 drh Exp $
*/
#include "os.h"         /* Must be first to enable large file support */
#include "sqliteInt.h"
#include "pager.h"
#include <assert.h>
#include <string.h>

440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
  */
  assert( pPager->journalOpen );
  sqliteOsSeek(&pPager->jfd, 0);
  rc = sqliteOsFileSize(&pPager->jfd, &nRec);
  if( rc!=SQLITE_OK ){
    goto end_playback;
  }
  if( nRec <= sizeof(aMagic)+sizeof(Pgno) ){
    goto end_playback;
  }
  nRec = (nRec - (sizeof(aMagic)+sizeof(Pgno))) / sizeof(PageRecord);

  /* Read the beginning of the journal and truncate the
  ** database file back to its original size.
  */







|







440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
  */
  assert( pPager->journalOpen );
  sqliteOsSeek(&pPager->jfd, 0);
  rc = sqliteOsFileSize(&pPager->jfd, &nRec);
  if( rc!=SQLITE_OK ){
    goto end_playback;
  }
  if( nRec < sizeof(aMagic)+sizeof(Pgno) ){
    goto end_playback;
  }
  nRec = (nRec - (sizeof(aMagic)+sizeof(Pgno))) / sizeof(PageRecord);

  /* Read the beginning of the journal and truncate the
  ** database file back to its original size.
  */