/ Check-in [0fb9af1d]
Login

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

Overview
Comment:Change the name of PAGER_SECTOR_SIZE to SQLITE_DEFAULT_SECTOR_SIZE. Make the new OS-layer interface routine for finding sector size optional. (CVS 3750)
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 0fb9af1d6e20bf25511c6d2097937cc11137776e
User & Date: drh 2007-03-29 18:19:52
Context
2007-03-29
18:41
Buffer updates per-transaction rather than per-update. If lots of updates happen within a single transaction, there was a lot of wasted encode/decode overhead due to segment merges. This code buffers updates in memory and writes out larger level-0 segments. It only works when documents are presented in ascending order by docid. Comparing a test set running 100 documents per transaction, the total runtime is cut almost in half. (CVS 3751) check-in: 0229cba6 user: shess tags: trunk
18:19
Change the name of PAGER_SECTOR_SIZE to SQLITE_DEFAULT_SECTOR_SIZE. Make the new OS-layer interface routine for finding sector size optional. (CVS 3750) check-in: 0fb9af1d user: drh tags: trunk
17:57
Make sure the strftime() date conversions put in leading zeros correctly. Ticket #2276. (CVS 3749) check-in: e853067e user: drh tags: trunk
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to src/os.c.

    72     72   int sqlite3OsLockState(OsFile *id){
    73     73     return id->pMethod->xLockState(id);
    74     74   }
    75     75   int sqlite3OsCheckReservedLock(OsFile *id){
    76     76     return id->pMethod->xCheckReservedLock(id);
    77     77   }
    78     78   int sqlite3OsSectorSize(OsFile *id){
    79         -  return id->pMethod->xSectorSize(id);
           79  +  int (*xSectorSize)(OsFile*) = id->pMethod->xSectorSize;
           80  +  return xSectorSize ? xSectorSize(id) : SQLITE_DEFAULT_SECTOR_SIZE;
    80     81   }
    81     82   
    82     83   #ifdef SQLITE_ENABLE_REDEF_IO
    83     84   /*
    84     85   ** A function to return a pointer to the virtual function table.
    85     86   ** This routine really does not accomplish very much since the
    86     87   ** virtual function table is a global variable and anybody who

Changes to src/os.h.

    69     69   /* If the SET_FULLSYNC macro is not defined above, then make it
    70     70   ** a no-op
    71     71   */
    72     72   #ifndef SET_FULLSYNC
    73     73   # define SET_FULLSYNC(x,y)
    74     74   #endif
    75     75   
           76  +/*
           77  +** The default size of a disk sector
           78  +*/
           79  +#ifndef SQLITE_DEFAULT_SECTOR_SIZE
           80  +# define SQLITE_DEFAULT_SECTOR_SIZE 512
           81  +#endif
           82  +
    76     83   /*
    77     84   ** Temporary files are named starting with this prefix followed by 16 random
    78     85   ** alphanumeric characters, and no file extension. They are stored in the
    79     86   ** OS's standard temporary file directory, and are deleted prior to exit.
    80     87   ** If sqlite is being embedded in another program, you may wish to change the
    81     88   ** prefix to reflect your program's name, so that if your program exits
    82     89   ** prematurely, old temporary files can be easily identified. This can be done

Changes to src/os_os2.c.

   739    739   **
   740    740   ** SQLite code assumes this function cannot fail. It also assumes that
   741    741   ** if two files are created in the same file-system directory (i.e.
   742    742   ** a database and it's journal file) that the sector size will be the
   743    743   ** same for both.
   744    744   */
   745    745   static int os2SectorSize(OsFile *id){
   746         -  return PAGER_SECTOR_SIZE;
          746  +  return SQLITE_DEFAULT_SECTOR_SIZE;
   747    747   }
   748    748   
   749    749   /*
   750    750   ** This vector defines all the methods that can operate on an OsFile
   751    751   ** for os2.
   752    752   */
   753    753   static const IoMethod sqlite3Os2IoMethod = {

Changes to src/os_unix.c.

  2349   2349   **
  2350   2350   ** SQLite code assumes this function cannot fail. It also assumes that
  2351   2351   ** if two files are created in the same file-system directory (i.e.
  2352   2352   ** a database and it's journal file) that the sector size will be the
  2353   2353   ** same for both.
  2354   2354   */
  2355   2355   static int unixSectorSize(OsFile *id){
  2356         -  return PAGER_SECTOR_SIZE;
         2356  +  return SQLITE_DEFAULT_SECTOR_SIZE;
  2357   2357   }
  2358   2358   
  2359   2359   /*
  2360   2360   ** This vector defines all the methods that can operate on an OsFile
  2361   2361   ** for unix.
  2362   2362   */
  2363   2363   static const IoMethod sqlite3UnixIoMethod = {

Changes to src/os_win.c.

  1462   1462   **
  1463   1463   ** SQLite code assumes this function cannot fail. It also assumes that
  1464   1464   ** if two files are created in the same file-system directory (i.e.
  1465   1465   ** a database and it's journal file) that the sector size will be the
  1466   1466   ** same for both.
  1467   1467   */
  1468   1468   static int winSectorSize(OsFile *id){
  1469         -  return PAGER_SECTOR_SIZE;
         1469  +  return SQLITE_DEFAULT_SECTOR_SIZE;
  1470   1470   }
  1471   1471   
  1472   1472   /*
  1473   1473   ** This vector defines all the methods that can operate on an OsFile
  1474   1474   ** for win32.
  1475   1475   */
  1476   1476   static const IoMethod sqlite3WinIoMethod = {

Changes to src/pager.c.

    14     14   ** The pager is used to access a database disk file.  It implements
    15     15   ** atomic commit and rollback through the use of a journal file that
    16     16   ** is separate from the database file.  The pager also implements file
    17     17   ** locking to prevent two processes from writing the same database
    18     18   ** file simultaneously, or one process from reading the database while
    19     19   ** another is writing.
    20     20   **
    21         -** @(#) $Id: pager.c,v 1.305 2007/03/29 17:28:15 danielk1977 Exp $
           21  +** @(#) $Id: pager.c,v 1.306 2007/03/29 18:19:52 drh Exp $
    22     22   */
    23     23   #ifndef SQLITE_OMIT_DISKIO
    24     24   #include "sqliteInt.h"
    25     25   #include "os.h"
    26     26   #include "pager.h"
    27     27   #include <assert.h>
    28     28   #include <string.h>
................................................................................
  1432   1432       if( rc==SQLITE_OK ){
  1433   1433         rc = pager_delmaster(zMaster);
  1434   1434       }
  1435   1435       sqliteFree(zMaster);
  1436   1436     }
  1437   1437   
  1438   1438     /* The Pager.sectorSize variable may have been updated while rolling
  1439         -  ** back a journal created by a process with a different PAGER_SECTOR_SIZE
         1439  +  ** back a journal created by a process with a different sector size
  1440   1440     ** value. Reset it to the correct value for this process.
  1441   1441     */
  1442   1442     pPager->sectorSize = sqlite3OsSectorSize(pPager->fd);
  1443   1443     return rc;
  1444   1444   }
  1445   1445   
  1446   1446   /*