Skip to content

Commit

Permalink
Refactoring the VFS-SHM methods used by WAL. This version compiles and
Browse files Browse the repository at this point in the history
runs non-WAL test cases but crashes and burns on wal.test.
  • Loading branch information
Unknown committed May 12, 2010
1 parent 854bf84 commit 6c47f45
Show file tree
Hide file tree
Showing 14 changed files with 1,940 additions and 1,928 deletions.
18 changes: 14 additions & 4 deletions doc/vfs-shm.txt
Expand Up @@ -78,14 +78,24 @@ during testing using an instrumented lock manager.


(5) No part of the wal-index will be read without holding either some (5) No part of the wal-index will be read without holding either some
kind of SHM lock or an EXCLUSIVE lock on the original database. kind of SHM lock or an EXCLUSIVE lock on the original database.
The original database is the file named in the 2nd parameter to
the xShmOpen method.

(6) A holder of a READ_FULL will never read any page of the database (6) A holder of a READ_FULL will never read any page of the database
file that is contained anywhere in the wal-index. file that is contained anywhere in the wal-index.

(7) No part of the wal-index other than the header will be written nor (7) No part of the wal-index other than the header will be written nor
will the size of the wal-index grow without holding a WRITE. will the size of the wal-index grow without holding a WRITE or
an EXCLUSIVE on the original database file.

(8) The wal-index header will not be written without holding one of (8) The wal-index header will not be written without holding one of
WRITE, CHECKPOINT, or RECOVER. WRITE, CHECKPOINT, or RECOVER on the wal-index or an EXCLUSIVE on
(9) A CHECKPOINT or RECOVER must be held in order to reset the last valid the original database files.
frame counter in the header of the wal-index back to zero.
(9) A CHECKPOINT or RECOVER must be held on the wal-index, or an
EXCLUSIVE on the original database file, in order to reset the
last valid frame counter in the header of the wal-index back to zero.

(10) A WRITE can only increase the last valid frame pointer in the header. (10) A WRITE can only increase the last valid frame pointer in the header.


The SQLite core will only ever send requests for UNLOCK, READ, WRITE, The SQLite core will only ever send requests for UNLOCK, READ, WRITE,
Expand Down
18 changes: 18 additions & 0 deletions src/os.c
Expand Up @@ -98,6 +98,24 @@ int sqlite3OsSectorSize(sqlite3_file *id){
int sqlite3OsDeviceCharacteristics(sqlite3_file *id){ int sqlite3OsDeviceCharacteristics(sqlite3_file *id){
return id->pMethods->xDeviceCharacteristics(id); return id->pMethods->xDeviceCharacteristics(id);
} }
int sqlite3OsShmOpen(sqlite3_file *id){
return id->pMethods->xShmOpen(id);
}
int sqlite3OsShmSize(sqlite3_file *id, int reqSize, int *pNewSize){
return id->pMethods->xShmSize(id, reqSize, pNewSize);
}
int sqlite3OsShmGet(sqlite3_file *id, int reqSize, int *pSize, void **pp){
return id->pMethods->xShmGet(id, reqSize, pSize, pp);
}
int sqlite3OsShmRelease(sqlite3_file *id){
return id->pMethods->xShmRelease(id);
}
int sqlite3OsShmLock(sqlite3_file *id, int desiredLock, int *pGotLock){
return id->pMethods->xShmLock(id, desiredLock, pGotLock);
}
int sqlite3OsShmClose(sqlite3_file *id, int deleteFlag){
return id->pMethods->xShmClose(id, deleteFlag);
}


/* /*
** The next group of routines are convenience wrappers around the ** The next group of routines are convenience wrappers around the
Expand Down
6 changes: 6 additions & 0 deletions src/os.h
Expand Up @@ -243,6 +243,12 @@ int sqlite3OsFileControl(sqlite3_file*,int,void*);
#define SQLITE_FCNTL_DB_UNCHANGED 0xca093fa0 #define SQLITE_FCNTL_DB_UNCHANGED 0xca093fa0
int sqlite3OsSectorSize(sqlite3_file *id); int sqlite3OsSectorSize(sqlite3_file *id);
int sqlite3OsDeviceCharacteristics(sqlite3_file *id); int sqlite3OsDeviceCharacteristics(sqlite3_file *id);
int sqlite3OsShmOpen(sqlite3_file *id);
int sqlite3OsShmSize(sqlite3_file *id, int, int*);
int sqlite3OsShmGet(sqlite3_file *id, int, int*, void**);
int sqlite3OsShmRelease(sqlite3_file *id);
int sqlite3OsShmLock(sqlite3_file *id, int, int*);
int sqlite3OsShmClose(sqlite3_file *id, int);


/* /*
** Functions for accessing sqlite3_vfs methods ** Functions for accessing sqlite3_vfs methods
Expand Down

0 comments on commit 6c47f45

Please sign in to comment.