/ Check-in [daf7b940]
Login

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

Overview
Comment:The OP_Checkpoint opcode is now a no-op if invoked on a database that already has an active checkpoint journal. Ticket #333. (CVS 997)
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: daf7b94017f03638da1ef65830f3762be030b93c
User & Date: drh 2003-06-02 23:14:13
Context
2003-06-03
01:47
Additional testing of the ATTACH command with bug fixes for the new problems that the tests found. (CVS 998) check-in: 3e8889d7 user: drh tags: trunk
2003-06-02
23:14
The OP_Checkpoint opcode is now a no-op if invoked on a database that already has an active checkpoint journal. Ticket #333. (CVS 997) check-in: daf7b940 user: drh tags: trunk
22:50
Fix a bug in the COPY command introduced by check-in (991). (CVS 996) check-in: 77ec13da user: drh tags: trunk
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to src/sqliteInt.h.

     7      7   **    May you do good and not evil.
     8      8   **    May you find forgiveness for yourself and forgive others.
     9      9   **    May you share freely, never taking more than you give.
    10     10   **
    11     11   *************************************************************************
    12     12   ** Internal interface definitions for SQLite.
    13     13   **
    14         -** @(#) $Id: sqliteInt.h,v 1.189 2003/05/31 16:21:13 drh Exp $
           14  +** @(#) $Id: sqliteInt.h,v 1.190 2003/06/02 23:14:13 drh Exp $
    15     15   */
    16     16   #include "config.h"
    17     17   #include "sqlite.h"
    18     18   #include "hash.h"
    19     19   #include "vdbe.h"
    20     20   #include "parse.h"
    21     21   #include "btree.h"
................................................................................
   237    237     char *zName;         /* Name of this database */
   238    238     Btree *pBt;          /* The B*Tree structure for this database file */
   239    239     int schema_cookie;   /* Database schema version number for this file */
   240    240     Hash tblHash;        /* All tables indexed by name */
   241    241     Hash idxHash;        /* All (named) indices indexed by name */
   242    242     Hash trigHash;       /* All triggers indexed by name */
   243    243     Hash aFKey;          /* Foreign keys indexed by to-table */
   244         -  u8 inTrans;          /* True if a transaction is underway for this backend */
          244  +  u8 inTrans;          /* 0: not writable.  1: Transaction.  2: Checkpoint */
   245    245     u16 flags;           /* Flags associated with this database */
   246    246   };
   247    247   
   248    248   /*
   249    249   ** These macros can be used to test, set, or clear bits in the 
   250    250   ** Db.flags field.
   251    251   */

Changes to src/vdbe.c.

    32     32   **
    33     33   ** Various scripts scan this source file in order to generate HTML
    34     34   ** documentation, headers files, or other derived files.  The formatting
    35     35   ** of the code in this file is, therefore, important.  See other comments
    36     36   ** in this file for details.  If in doubt, do not deviate from existing
    37     37   ** commenting and indentation practices when changing or adding code.
    38     38   **
    39         -** $Id: vdbe.c,v 1.224 2003/06/02 06:15:59 jplyon Exp $
           39  +** $Id: vdbe.c,v 1.225 2003/06/02 23:14:13 drh Exp $
    40     40   */
    41     41   #include "sqliteInt.h"
    42     42   #include <ctype.h>
    43     43   
    44     44   /*
    45     45   ** The makefile scans this source file and creates the following
    46     46   ** array of string constants which are the names of all VDBE opcodes.
................................................................................
  3164   3164   **
  3165   3165   ** The checkpoint is begun on the database file with index P1.  The main
  3166   3166   ** database file has an index of 0 and the file used for temporary tables
  3167   3167   ** has an index of 1.
  3168   3168   */
  3169   3169   case OP_Checkpoint: {
  3170   3170     int i = pOp->p1;
  3171         -  if( i>=0 && i<db->nDb && db->aDb[i].pBt ){
         3171  +  if( i>=0 && i<db->nDb && db->aDb[i].pBt && db->aDb[i].inTrans==1 ){
  3172   3172       rc = sqliteBtreeBeginCkpt(db->aDb[i].pBt);
         3173  +    if( rc==SQLITE_OK ) db->aDb[i].inTrans = 2;
  3173   3174     }
  3174   3175     break;
  3175   3176   }
  3176   3177   
  3177   3178   /* Opcode: Transaction P1 * *
  3178   3179   **
  3179   3180   ** Begin a transaction.  The transaction ends when a Commit or Rollback
................................................................................
  5822   5823           }
  5823   5824           break;
  5824   5825         }
  5825   5826       }
  5826   5827       sqliteRollbackInternalChanges(db);
  5827   5828     }
  5828   5829     for(i=0; i<db->nDb; i++){
  5829         -    if( db->aDb[i].pBt ){
         5830  +    if( db->aDb[i].pBt && db->aDb[i].inTrans==2 ){
  5830   5831         sqliteBtreeCommitCkpt(db->aDb[i].pBt);
         5832  +      db->aDb[i].inTrans = 1;
  5831   5833       }
  5832   5834     }
  5833   5835     assert( p->tos<p->pc || sqlite_malloc_failed==1 );
  5834   5836   #ifdef VDBE_PROFILE
  5835   5837     {
  5836   5838       FILE *out = fopen("vdbe_profile.out", "a");
  5837   5839       if( out ){