Permalink
Browse files

Refactoring the VFS-SHM methods used by WAL. This version compiles and

runs non-WAL test cases but crashes and burns on wal.test.
  • Loading branch information...
1 parent 854bf84 commit 6c47f45c43a5885e4192cf77d03e9d0142e0a6be Unknown committed May 12, 2010
Showing with 1,940 additions and 1,928 deletions.
  1. +14 −4 doc/vfs-shm.txt
  2. +18 −0 src/os.c
  3. +6 −0 src/os.h
  4. +1,732 −1,721 src/os_unix.c
  5. +18 −6 src/pager.c
  6. +1 −0 src/pager.h
  7. +8 −7 src/sqlite.h.in
  8. +31 −40 src/test6.c
  9. +10 −62 src/test_devsym.c
  10. +12 −7 src/test_onefile.c
  11. +34 −24 src/test_vfs.c
  12. +2 −2 src/vdbe.c
  13. +52 −52 src/wal.c
  14. +2 −3 src/wal.h
View
@@ -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
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
file that is contained anywhere in the wal-index.
+
(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
- WRITE, CHECKPOINT, or RECOVER.
-(9) A CHECKPOINT or RECOVER must be held in order to reset the last valid
- frame counter in the header of the wal-index back to zero.
+ WRITE, CHECKPOINT, or RECOVER on the wal-index or an EXCLUSIVE on
+ the original database files.
+
+(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.
The SQLite core will only ever send requests for UNLOCK, READ, WRITE,
View
@@ -98,6 +98,24 @@ int sqlite3OsSectorSize(sqlite3_file *id){
int sqlite3OsDeviceCharacteristics(sqlite3_file *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
View
@@ -243,6 +243,12 @@ int sqlite3OsFileControl(sqlite3_file*,int,void*);
#define SQLITE_FCNTL_DB_UNCHANGED 0xca093fa0
int sqlite3OsSectorSize(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
Oops, something went wrong.

0 comments on commit 6c47f45

Please sign in to comment.