aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--manifest32
-rw-r--r--manifest.uuid2
-rw-r--r--src/os_unix.c33
-rw-r--r--src/os_win.c12
-rw-r--r--src/pager.c15
-rw-r--r--src/sqlite.h.in41
-rw-r--r--src/sqliteInt.h8
-rw-r--r--src/test1.c16
-rw-r--r--src/test6.c24
-rw-r--r--src/test_vfs.c24
-rw-r--r--src/wal.c10
-rw-r--r--test/journal2.test2
-rw-r--r--test/zerodamage.test35
13 files changed, 137 insertions, 117 deletions
diff --git a/manifest b/manifest
index eaeb4c677..5fe186261 100644
--- a/manifest
+++ b/manifest
@@ -1,5 +1,5 @@
-C Merge\sthe\slatest\strunk\schanges\sinto\sthe\sstatvfs\sbranch.
-D 2011-12-23T00:25:02.544
+C Change\sthe\sname\sZERO_DAMAGE\sto\sthe\smore\sdescriptive\sPOWERSAFE_OVERWRITE.\nThe\squery\sparameter\sused\sto\scontrol\sthis\sdevice\scharacteristic\sis\snow\s"psow".
+D 2011-12-23T01:04:17.601
F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f
F Makefile.in 5b4a3e12a850b021547e43daf886b25133b44c07
F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23
@@ -166,9 +166,9 @@ F src/os.c 28bbdab2170dfce84d86c45456a18eab1d0f99a9
F src/os.h 549b1a2e5e0ed1e1499f252dac126c4973e7379c
F src/os_common.h 92815ed65f805560b66166e3583470ff94478f04
F src/os_os2.c 4a75888ba3dfc820ad5e8177025972d74d7f2440
-F src/os_unix.c ac21edf9794591badec31070a932845ef81f088e
-F src/os_win.c f45f03e4585c31b5124771eb07ecce5b37a5c30a
-F src/pager.c fb35a2c33667dd568b8df30fc11a4516e9889057
+F src/os_unix.c 3a441671f35569df4b72641e928fdb1ab5cd8576
+F src/os_win.c 569fe7448e781bfb8116aa79081df0eadf576fc6
+F src/pager.c d03fb1de7bd724f0cdcae0aab0a733d89c94ac2f
F src/pager.h 5cd760857707529b403837d813d86b68938d6183
F src/parse.y fabb2e7047417d840e6fdb3ef0988a86849a08ba
F src/pcache.c 1fdd77978c1525d1ca4b9ef48eb80abca710cb4c
@@ -182,19 +182,19 @@ F src/resolve.c 3d3e80a98f203ac6b9329e9621e29eda85ddfd40
F src/rowset.c 69afa95a97c524ba6faf3805e717b5b7ae85a697
F src/select.c a1d075db66a0ea42807353501b62997969e5be79
F src/shell.c aa4183d4a5243d8110b1d3d77faa4aea7e9c9c2d
-F src/sqlite.h.in f414e44e9eb1d13804b9da0123ac082b0604bebf
+F src/sqlite.h.in 3d1a77e27b9d9979fb7ec84834a8423602d29dc5
F src/sqlite3ext.h 6904f4aadf976f95241311fbffb00823075d9477
-F src/sqliteInt.h 165409fa8adc8701148830804febeded3f2e4448
+F src/sqliteInt.h b8fdd9c39c8d7f5c794f4ea917293d9c75b9aff2
F src/sqliteLimit.h 164b0e6749d31e0daa1a4589a169d31c0dec7b3d
F src/status.c 4568e72dfd36b6a5911f93457364deb072e0b03a
F src/table.c 2cd62736f845d82200acfa1287e33feb3c15d62e
F src/tclsqlite.c bd86070f52ae3f77a2e6b3b065ff03adb9140bfa
-F src/test1.c 4cbabeb8b2c487f67d724e2ea03841b69fa640c4
+F src/test1.c 1b1e514e85ffe7152b02cba38bd0a1ce8cd56113
F src/test2.c 80d323d11e909cf0eb1b6fbb4ac22276483bcf31
F src/test3.c 124ff9735fb6bb7d41de180d6bac90e7b1509432
F src/test4.c d1e5a5e904d4b444cf572391fdcb017638e36ff7
F src/test5.c e1a19845625144caf038031234a12185e40d315c
-F src/test6.c ffcc25c9b32e08e40754d85adb0a5d289721974a
+F src/test6.c cf6ab27a59e1ab64b011bb251ba600131e803e59
F src/test7.c 2e0781754905c8adc3268d8f0967e7633af58843
F src/test8.c 99f70341d6ec480313775127f4cd14b4a47db557
F src/test9.c bea1e8cf52aa93695487badedd6e1886c321ea60
@@ -230,7 +230,7 @@ F src/test_superlock.c 2b97936ca127d13962c3605dbc9a4ef269c424cd
F src/test_syscall.c a992d8c80ea91fbf21fb2dd570db40e77dd7e6ae
F src/test_tclvar.c f4dc67d5f780707210d6bb0eb6016a431c04c7fa
F src/test_thread.c 35022393dd54d147b998b6b7f7e945b01114d666
-F src/test_vfs.c b241a08b5fa5bfec22983eba323e0ca621d3cea6
+F src/test_vfs.c 07157a0bbfe161cb5e32cad2079abd26cd611c4b
F src/test_vfstrace.c 065c7270a614254b2c68fbc7ba8d1fb1d5cbc823
F src/test_wholenumber.c 6129adfbe7c7444f2e60cc785927f3aa74e12290
F src/test_wsd.c 41cadfd9d97fe8e3e4e44f61a4a8ccd6f7ca8fe9
@@ -250,7 +250,7 @@ F src/vdbemem.c 2fc78b3e0fabcc1eaa23cd79dd2e30e6dcfe1e56
F src/vdbesort.c 468d43c057063e54da4f1988b38b4f46d60e7790
F src/vdbetrace.c d6e50e04e1ec498150e519058f617d91b8f5c843
F src/vtab.c e9318d88feac85be8e27ee783ac8f5397933fc8a
-F src/wal.c 842901b44832474b0f77f9a031455af3787ae277
+F src/wal.c 13c34ed72fd3a0cb81b3addbc901b3be60430cca
F src/wal.h 42f8313f7aaf8913e2d1fdf7b47025c23491ea1d
F src/walker.c 3112bb3afe1d85dc52317cb1d752055e9a781f8f
F src/where.c af623942514571895818b9b7ae11db95ae3b3d88
@@ -545,7 +545,7 @@ F test/join4.test 1a352e4e267114444c29266ce79e941af5885916
F test/join5.test 86675fc2919269aa923c84dd00ee4249b97990fe
F test/join6.test bf82cf3f979e9eade83ad0d056a66c5ed71d1901
F test/journal1.test 8b71ef1ed5798bdc0e6eb616d8694e2c2c188d4d
-F test/journal2.test 81f51a9f3e9b67c0efd4cdbb93752e064027ad96
+F test/journal2.test ae06f566c28552c313ded3fee79a6c69e6d049b1
F test/journal3.test 6fd28532c88b447db844186bc190523108b6dbb4
F test/jrnlmode.test 9ee3a78f53d52cca737db69293d15dc41c0cbd36
F test/jrnlmode2.test 81610545a4e6ed239ea8fa661891893385e23a1d
@@ -941,7 +941,7 @@ F test/whereC.test 13ff5ec0dba407c0e0c075980c75b3275a6774e5
F test/wherelimit.test 5e9fd41e79bb2b2d588ed999d641d9c965619b31
F test/win32lock.test b2a539e85ae6b2d78475e016a9636b4451dc7fb9
F test/zeroblob.test caaecfb4f908f7bc086ed238668049f96774d688
-F test/zerodamage.test 0e12b2d7343f1fbb015e56a4a2a6074336ff46cf
+F test/zerodamage.test 7ef0680559163118705975be132933898d349674
F tool/build-shell.sh 12aa4391073a777fcb6dcc490b219a018ae98bac
F tool/diffdb.c 7524b1b5df217c20cd0431f6789851a4e0cb191b
F tool/extract.c 054069d81b095fbdc189a6f5d4466e40380505e2
@@ -986,7 +986,7 @@ F tool/tostr.awk e75472c2f98dd76e06b8c9c1367f4ab07e122d06
F tool/vdbe-compress.tcl d70ea6d8a19e3571d7ab8c9b75cba86d1173ff0f
F tool/warnings-clang.sh 9f406d66e750e8ac031c63a9ef3248aaa347ef2a
F tool/warnings.sh fbc018d67fd7395f440c28f33ef0f94420226381
-P 995ec8a41a7d091d9d87cb8f18f62102c8fda7d7 83d26b9a9115eadac9e59a33d608bca0ab2519e3
-R 260e1493aa81c50b80cb4676fbf8b938
+P d5e36327c12f264429eb079bddbb71a310f76389
+R d510fa35ee7302e7724e03225e057408
U drh
-Z de070232ec96f7f04c9c57b396f63bcc
+Z cc6357a73838dede95445f3f634219d1
diff --git a/manifest.uuid b/manifest.uuid
index cc4ba4766..7bfda38bd 100644
--- a/manifest.uuid
+++ b/manifest.uuid
@@ -1 +1 @@
-d5e36327c12f264429eb079bddbb71a310f76389 \ No newline at end of file
+6191c5e45175f5c6040e891843b0725a929d6dd7 \ No newline at end of file
diff --git a/src/os_unix.c b/src/os_unix.c
index 5378f862e..adf11541f 100644
--- a/src/os_unix.c
+++ b/src/os_unix.c
@@ -263,7 +263,7 @@ struct unixFile {
#else
# define UNIXFILE_DIRSYNC 0x00
#endif
-#define UNIXFILE_ZERO_DAMAGE 0x10 /* True if SQLITE_IOCAP_ZERO_DAMAGE */
+#define UNIXFILE_PSOW 0x10 /* SQLITE_IOCAP_POWERSAFE_OVERWRITE */
/*
** Include code that is common to all os_*.c files
@@ -3557,8 +3557,8 @@ static int unixFileControl(sqlite3_file *id, int op, void *pArg){
unixModeBit(pFile, UNIXFILE_PERSIST_WAL, (int*)pArg);
return SQLITE_OK;
}
- case SQLITE_FCNTL_ZERO_DAMAGE: {
- unixModeBit(pFile, UNIXFILE_ZERO_DAMAGE, (int*)pArg);
+ case SQLITE_FCNTL_POWERSAFE_OVERWRITE: {
+ unixModeBit(pFile, UNIXFILE_PSOW, (int*)pArg);
return SQLITE_OK;
}
case SQLITE_FCNTL_VFSNAME: {
@@ -3622,18 +3622,23 @@ static int unixSectorSize(sqlite3_file *pFile){
/*
** Return the device characteristics for the file.
**
-** This VFS is set up to return SQLITE_IOCAP_ZERO_DAMAGE by default.
-** However, that choice is contraversial sicne technically the underlying
-** file system does not always provide ZERO_DAMAGE. (In other words, after
-** a power-loss event, parts of the file that were never written might end
-** up being altered.) However, non-ZERO-DAMAGE behavior is very, very rare.
-** And asserting ZERO_DAMAGE makes a large reduction in the amount of required
-** I/O. Hence, while ZERO_DAMAGE is on by default, there is a file-control
-** available to turn it off.
+** This VFS is set up to return SQLITE_IOCAP_POWERSAFE_OVERWRITE by default.
+** However, that choice is contraversial since technically the underlying
+** file system does not always provide powersafe overwrites. (In other
+** words, after a power-loss event, parts of the file that were never
+** written might end up being altered.) However, non-PSOW behavior is very,
+** very rare. And asserting PSOW makes a large reduction in the amount
+** of required I/O for journaling, since a lot of padding is eliminated.
+** Hence, while POWERSAFE_OVERWRITE is on by default, there is a file-control
+** available to turn it off and URI query parameter available to turn it off.
*/
static int unixDeviceCharacteristics(sqlite3_file *id){
unixFile *p = (unixFile*)id;
- return (p->ctrlFlags & UNIXFILE_ZERO_DAMAGE) ? SQLITE_IOCAP_ZERO_DAMAGE : 0;
+ if( p->ctrlFlags & UNIXFILE_PSOW ){
+ return SQLITE_IOCAP_POWERSAFE_OVERWRITE;
+ }else{
+ return 0;
+ }
}
#ifndef SQLITE_OMIT_WAL
@@ -4617,8 +4622,8 @@ static int fillInUnixFile(
pNew->pVfs = pVfs;
pNew->zPath = zFilename;
pNew->ctrlFlags = 0;
- if( sqlite3_uri_boolean(zFilename, "zero_damage", 1) ){
- pNew->ctrlFlags |= UNIXFILE_ZERO_DAMAGE;
+ if( sqlite3_uri_boolean(zFilename, "psow", SQLITE_POWERSAFE_OVERWRITE) ){
+ pNew->ctrlFlags |= UNIXFILE_PSOW;
}
if( memcmp(pVfs->zName,"unix-excl",10)==0 ){
pNew->ctrlFlags |= UNIXFILE_EXCL;
diff --git a/src/os_win.c b/src/os_win.c
index 85bf9d89b..18fdd9393 100644
--- a/src/os_win.c
+++ b/src/os_win.c
@@ -78,7 +78,7 @@ struct winFile {
** Allowed values for winFile.ctrlFlags
*/
#define WINFILE_PERSIST_WAL 0x04 /* Persistent WAL mode */
-#define WINFILE_ZERO_DAMAGE 0x10 /* True if SQLITE_IOCAP_ZERO_DAMAGE */
+#define WINFILE_PSOW 0x10 /* SQLITE_IOCAP_POWERSAFE_OVERWRITE */
/*
* If compiled with SQLITE_WIN32_MALLOC on Windows, we will use the
@@ -2185,8 +2185,8 @@ static int winFileControl(sqlite3_file *id, int op, void *pArg){
winModeBit(pFile, WINFILE_PERSIST_WAL, (int*)pArg);
return SQLITE_OK;
}
- case SQLITE_FCNTL_ZERO_DAMAGE: {
- winModeBit(pFile, WINFILE_ZERO_DAMAGE, (int*)pArg);
+ case SQLITE_FCNTL_POWERSAFE_OVERWRITE: {
+ winModeBit(pFile, WINFILE_PSOW, (int*)pArg);
return SQLITE_OK;
}
case SQLITE_FCNTL_VFSNAME: {
@@ -2235,7 +2235,7 @@ static int winSectorSize(sqlite3_file *id){
static int winDeviceCharacteristics(sqlite3_file *id){
winFile *p = (winFile*)id;
return SQLITE_IOCAP_UNDELETABLE_WHEN_OPEN |
- ((p->ctrlFlags & WINFILE_ZERO_DAMAGE)?SQLITE_IOCAP_ZERO_DAMAGE:0);
+ ((p->ctrlFlags & WINFILE_PSOW)?SQLITE_IOCAP_POWERSAFE_OVERWRITE:0);
}
#ifndef SQLITE_OMIT_WAL
@@ -3200,8 +3200,8 @@ static int winOpen(
pFile->pVfs = pVfs;
pFile->pShm = 0;
pFile->zPath = zName;
- if( sqlite3_uri_boolean(zName, "zero_damage", 1) ){
- pFile->ctrlFlags |= WINFILE_ZERO_DAMAGE;
+ if( sqlite3_uri_boolean(zName, "psow", SQLITE_POWERSAFE_OVERWRITE) ){
+ pFile->ctrlFlags |= WINFILE_PSOW;
}
pFile->sectorSize = getSectorSize(pVfs, zUtf8Name);
diff --git a/src/pager.c b/src/pager.c
index f6c8f2fa5..892c245b4 100644
--- a/src/pager.c
+++ b/src/pager.c
@@ -2516,20 +2516,21 @@ static int pager_truncate(Pager *pPager, Pgno nPage){
** it is less than 32, or rounded down to MAX_SECTOR_SIZE if it
** is greater than MAX_SECTOR_SIZE.
**
-** If the file has the SQLITE_IOCAP_ZERO_DAMAGE property, then set the
-** effective sector size to its minimum value (512). The purpose of
+** If the file has the SQLITE_IOCAP_POWERSAFE_OVERWRITE property, then set
+** the effective sector size to its minimum value (512). The purpose of
** pPager->sectorSize is to define the "blast radius" of bytes that
** might change if a crash occurs while writing to a single byte in
-** that range. But with ZERO_DAMAGE, the blast radius is zero, so
-** we minimize the sector size. For backwards compatibility of the
-** rollback journal file format, we cannot reduce the effective sector
-** size below 512.
+** that range. But with POWERSAFE_OVERWRITE, the blast radius is zero
+** (that is what POWERSAFE_OVERWRITE means), so we minimize the sector
+** size. For backwards compatibility of the rollback journal file format,
+** we cannot reduce the effective sector size below 512.
*/
static void setSectorSize(Pager *pPager){
assert( isOpen(pPager->fd) || pPager->tempFile );
if( pPager->tempFile
- || (sqlite3OsDeviceCharacteristics(pPager->fd)&SQLITE_IOCAP_ZERO_DAMAGE)!=0
+ || (sqlite3OsDeviceCharacteristics(pPager->fd) &
+ SQLITE_IOCAP_POWERSAFE_OVERWRITE)!=0
){
/* Sector size doesn't matter for temporary files. Also, the file
** may not have been opened yet, in which case the OsSectorSize()
diff --git a/src/sqlite.h.in b/src/sqlite.h.in
index 3748aada2..85ebd67a9 100644
--- a/src/sqlite.h.in
+++ b/src/sqlite.h.in
@@ -504,11 +504,12 @@ int sqlite3_exec(
** first then the size of the file is extended, never the other
** way around. The SQLITE_IOCAP_SEQUENTIAL property means that
** information is written to disk in the same order as calls
-** to xWrite(). The SQLITE_IOCAP_ZERO_DAMAGE property means that
+** to xWrite(). The SQLITE_IOCAP_POWERSAFE_OVERWRITE property means that
** after reboot following a crash or power loss, the value of
** each byte in a file is a value that was actually written
** into that byte at some point. In other words, a crash will
-** not introduce garbage or randomness into a file, and byte of
+** not cause unwritten bytes of the file to change nor introduce
+** randomness into a file nor zero out parts of the file, and any byte of
** a file that are never written will not change values due to
** writes to nearby bytes.
*/
@@ -524,7 +525,7 @@ int sqlite3_exec(
#define SQLITE_IOCAP_SAFE_APPEND 0x00000200
#define SQLITE_IOCAP_SEQUENTIAL 0x00000400
#define SQLITE_IOCAP_UNDELETABLE_WHEN_OPEN 0x00000800
-#define SQLITE_IOCAP_ZERO_DAMAGE 0x00001000
+#define SQLITE_IOCAP_POWERSAFE_OVERWRITE 0x00001000
/*
** CAPI3REF: File Locking Levels
@@ -774,10 +775,10 @@ struct sqlite3_io_methods {
** WAL mode. If the integer is -1, then it is overwritten with the current
** WAL persistence setting.
**
-** ^The [SQLITE_FCNTL_ZERO_DAMAGE] opcode is used to set or query the
-** persistent zero-damage setting. The zero-damage setting determines
-** the [SQLITE_IOCAP_ZERO_DAMAGE] bit of the xDeviceCharacteristics methods.
-** The fourth parameter to
+** ^The [SQLITE_FCNTL_POWERSAFE_OVERWRITE] opcode is used to set or query the
+** persistent "powersafe-overwrite" or "PSOW" setting. The PSOW setting
+** determines the [SQLITE_IOCAP_POWERSAFE_OVERWRITE] bit of the
+** xDeviceCharacteristics methods. The fourth parameter to
** [sqlite3_file_control()] for this opcode should be a pointer to an integer.
** That integer is 0 to disable zero-damage mode or 1 to enable zero-damage
** mode. If the integer is -1, then it is overwritten with the current
@@ -799,19 +800,19 @@ struct sqlite3_io_methods {
** pointer in case this file-control is not implemented. This file-control
** is intended for diagnostic use only.
*/
-#define SQLITE_FCNTL_LOCKSTATE 1
-#define SQLITE_GET_LOCKPROXYFILE 2
-#define SQLITE_SET_LOCKPROXYFILE 3
-#define SQLITE_LAST_ERRNO 4
-#define SQLITE_FCNTL_SIZE_HINT 5
-#define SQLITE_FCNTL_CHUNK_SIZE 6
-#define SQLITE_FCNTL_FILE_POINTER 7
-#define SQLITE_FCNTL_SYNC_OMITTED 8
-#define SQLITE_FCNTL_WIN32_AV_RETRY 9
-#define SQLITE_FCNTL_PERSIST_WAL 10
-#define SQLITE_FCNTL_OVERWRITE 11
-#define SQLITE_FCNTL_VFSNAME 12
-#define SQLITE_FCNTL_ZERO_DAMAGE 13
+#define SQLITE_FCNTL_LOCKSTATE 1
+#define SQLITE_GET_LOCKPROXYFILE 2
+#define SQLITE_SET_LOCKPROXYFILE 3
+#define SQLITE_LAST_ERRNO 4
+#define SQLITE_FCNTL_SIZE_HINT 5
+#define SQLITE_FCNTL_CHUNK_SIZE 6
+#define SQLITE_FCNTL_FILE_POINTER 7
+#define SQLITE_FCNTL_SYNC_OMITTED 8
+#define SQLITE_FCNTL_WIN32_AV_RETRY 9
+#define SQLITE_FCNTL_PERSIST_WAL 10
+#define SQLITE_FCNTL_OVERWRITE 11
+#define SQLITE_FCNTL_VFSNAME 12
+#define SQLITE_FCNTL_POWERSAFE_OVERWRITE 13
/*
** CAPI3REF: Mutex Handle
diff --git a/src/sqliteInt.h b/src/sqliteInt.h
index 8613d865a..6e48b1c4f 100644
--- a/src/sqliteInt.h
+++ b/src/sqliteInt.h
@@ -126,6 +126,14 @@
#endif
/*
+** Powersafe overwrite is on by default. But can be turned off using
+** the -DSQLITE_POWERSAFE_OVERWRITE=0 command-line option.
+*/
+#ifndef SQLITE_POWERSAFE_OVERWRITE
+# define SQLITE_POWERSAFE_OVERWRITE 1
+#endif
+
+/*
** The SQLITE_DEFAULT_MEMSTATUS macro must be defined as either 0 or 1.
** It determines whether or not the features related to
** SQLITE_CONFIG_MEMSTATUS are available by default or not. This value can
diff --git a/src/test1.c b/src/test1.c
index b96b99ce8..9cc5d6347 100644
--- a/src/test1.c
+++ b/src/test1.c
@@ -5236,12 +5236,12 @@ static int file_control_persist_wal(
}
/*
-** tclcmd: file_control_zero_damage DB ZERO-DAMAGE-FLAG
+** tclcmd: file_control_powersafe_overwrite DB PSOW-FLAG
**
** This TCL command runs the sqlite3_file_control interface with
-** the SQLITE_FCNTL_ZERO_DAMAGE opcode.
+** the SQLITE_FCNTL_POWERSAFE_OVERWRITE opcode.
*/
-static int file_control_zero_damage(
+static int file_control_powersafe_overwrite(
ClientData clientData, /* Pointer to sqlite3_enable_XXX function */
Tcl_Interp *interp, /* The TCL interpreter that invoked this command */
int objc, /* Number of arguments */
@@ -5249,7 +5249,7 @@ static int file_control_zero_damage(
){
sqlite3 *db;
int rc;
- int bDamage;
+ int b;
char z[100];
if( objc!=3 ){
@@ -5260,9 +5260,9 @@ static int file_control_zero_damage(
if( getDbPointer(interp, Tcl_GetString(objv[1]), &db) ){
return TCL_ERROR;
}
- if( Tcl_GetIntFromObj(interp, objv[2], &bDamage) ) return TCL_ERROR;
- rc = sqlite3_file_control(db, NULL, SQLITE_FCNTL_ZERO_DAMAGE,(void*)&bDamage);
- sqlite3_snprintf(sizeof(z), z, "%d %d", rc, bDamage);
+ if( Tcl_GetIntFromObj(interp, objv[2], &b) ) return TCL_ERROR;
+ rc = sqlite3_file_control(db,NULL,SQLITE_FCNTL_POWERSAFE_OVERWRITE,(void*)&b);
+ sqlite3_snprintf(sizeof(z), z, "%d %d", rc, b);
Tcl_AppendResult(interp, z, (char*)0);
return TCL_OK;
}
@@ -6125,7 +6125,7 @@ int Sqlitetest1_Init(Tcl_Interp *interp){
{ "file_control_sizehint_test", file_control_sizehint_test, 0 },
{ "file_control_win32_av_retry", file_control_win32_av_retry, 0 },
{ "file_control_persist_wal", file_control_persist_wal, 0 },
- { "file_control_zero_damage", file_control_zero_damage, 0 },
+ { "file_control_powersafe_overwrite",file_control_powersafe_overwrite,0},
{ "file_control_vfsname", file_control_vfsname, 0 },
{ "sqlite3_vfs_list", vfs_list, 0 },
{ "sqlite3_create_function_v2", test_create_function_v2, 0 },
diff --git a/src/test6.c b/src/test6.c
index 1bb9c65f0..89f4a090b 100644
--- a/src/test6.c
+++ b/src/test6.c
@@ -705,18 +705,18 @@ static int processDevSymArgs(
char *zName;
int iValue;
} aFlag[] = {
- { "atomic", SQLITE_IOCAP_ATOMIC },
- { "atomic512", SQLITE_IOCAP_ATOMIC512 },
- { "atomic1k", SQLITE_IOCAP_ATOMIC1K },
- { "atomic2k", SQLITE_IOCAP_ATOMIC2K },
- { "atomic4k", SQLITE_IOCAP_ATOMIC4K },
- { "atomic8k", SQLITE_IOCAP_ATOMIC8K },
- { "atomic16k", SQLITE_IOCAP_ATOMIC16K },
- { "atomic32k", SQLITE_IOCAP_ATOMIC32K },
- { "atomic64k", SQLITE_IOCAP_ATOMIC64K },
- { "sequential", SQLITE_IOCAP_SEQUENTIAL },
- { "safe_append", SQLITE_IOCAP_SAFE_APPEND },
- { "zero_damage", SQLITE_IOCAP_ZERO_DAMAGE },
+ { "atomic", SQLITE_IOCAP_ATOMIC },
+ { "atomic512", SQLITE_IOCAP_ATOMIC512 },
+ { "atomic1k", SQLITE_IOCAP_ATOMIC1K },
+ { "atomic2k", SQLITE_IOCAP_ATOMIC2K },
+ { "atomic4k", SQLITE_IOCAP_ATOMIC4K },
+ { "atomic8k", SQLITE_IOCAP_ATOMIC8K },
+ { "atomic16k", SQLITE_IOCAP_ATOMIC16K },
+ { "atomic32k", SQLITE_IOCAP_ATOMIC32K },
+ { "atomic64k", SQLITE_IOCAP_ATOMIC64K },
+ { "sequential", SQLITE_IOCAP_SEQUENTIAL },
+ { "safe_append", SQLITE_IOCAP_SAFE_APPEND },
+ { "powersafe_overwrite", SQLITE_IOCAP_POWERSAFE_OVERWRITE },
{ 0, 0 }
};
diff --git a/src/test_vfs.c b/src/test_vfs.c
index 2c985a7db..a79407b57 100644
--- a/src/test_vfs.c
+++ b/src/test_vfs.c
@@ -1162,19 +1162,19 @@ static int testvfs_obj_cmd(
int iValue;
} aFlag[] = {
{ "default", -1 },
- { "atomic", SQLITE_IOCAP_ATOMIC },
- { "atomic512", SQLITE_IOCAP_ATOMIC512 },
- { "atomic1k", SQLITE_IOCAP_ATOMIC1K },
- { "atomic2k", SQLITE_IOCAP_ATOMIC2K },
- { "atomic4k", SQLITE_IOCAP_ATOMIC4K },
- { "atomic8k", SQLITE_IOCAP_ATOMIC8K },
- { "atomic16k", SQLITE_IOCAP_ATOMIC16K },
- { "atomic32k", SQLITE_IOCAP_ATOMIC32K },
- { "atomic64k", SQLITE_IOCAP_ATOMIC64K },
- { "sequential", SQLITE_IOCAP_SEQUENTIAL },
- { "safe_append", SQLITE_IOCAP_SAFE_APPEND },
+ { "atomic", SQLITE_IOCAP_ATOMIC },
+ { "atomic512", SQLITE_IOCAP_ATOMIC512 },
+ { "atomic1k", SQLITE_IOCAP_ATOMIC1K },
+ { "atomic2k", SQLITE_IOCAP_ATOMIC2K },
+ { "atomic4k", SQLITE_IOCAP_ATOMIC4K },
+ { "atomic8k", SQLITE_IOCAP_ATOMIC8K },
+ { "atomic16k", SQLITE_IOCAP_ATOMIC16K },
+ { "atomic32k", SQLITE_IOCAP_ATOMIC32K },
+ { "atomic64k", SQLITE_IOCAP_ATOMIC64K },
+ { "sequential", SQLITE_IOCAP_SEQUENTIAL },
+ { "safe_append", SQLITE_IOCAP_SAFE_APPEND },
{ "undeletable_when_open", SQLITE_IOCAP_UNDELETABLE_WHEN_OPEN },
- { "zero_damage", SQLITE_IOCAP_ZERO_DAMAGE },
+ { "powersafe_overwrite", SQLITE_IOCAP_POWERSAFE_OVERWRITE },
{ 0, 0 }
};
Tcl_Obj *pRet;
diff --git a/src/wal.c b/src/wal.c
index d3b66b5b9..904138723 100644
--- a/src/wal.c
+++ b/src/wal.c
@@ -1305,7 +1305,9 @@ int sqlite3WalOpen(
}else{
int iDC = sqlite3OsDeviceCharacteristics(pRet->pWalFd);
if( iDC & SQLITE_IOCAP_SEQUENTIAL ){ pRet->syncHeader = 0; }
- if( iDC & SQLITE_IOCAP_ZERO_DAMAGE ){ pRet->padToSectorBoundary = 0; }
+ if( iDC & SQLITE_IOCAP_POWERSAFE_OVERWRITE ){
+ pRet->padToSectorBoundary = 0;
+ }
*ppWal = pRet;
WALTRACE(("WAL%d: opened\n", pRet));
}
@@ -2810,9 +2812,9 @@ int sqlite3WalFrames(
** transaction and if PRAGMA synchronous=FULL. If synchronous==NORMAL
** or synchonous==OFF, then no padding or syncing are needed.
**
- ** If SQLITE_IOCAP_ZERO_DAMAGE is defined, then padding is not needed
- ** and only the sync is done. If padding is needed, then the final
- ** frame is repeated (with its commit mark) until the next sector
+ ** If SQLITE_IOCAP_POWERSAFE_OVERWRITE is defined, then padding is not
+ ** needed and only the sync is done. If padding is needed, then the
+ ** final frame is repeated (with its commit mark) until the next sector
** boundary is crossed. Only the part of the WAL prior to the last
** sector boundary is synced; the part of the last frame that extends
** past the sector boundary is written after the sync.
diff --git a/test/journal2.test b/test/journal2.test
index 2272f139f..8f9b4d0b7 100644
--- a/test/journal2.test
+++ b/test/journal2.test
@@ -34,7 +34,7 @@ proc a_string {n} {
# characteristics flags to "SAFE_DELETE".
#
testvfs tvfs -default 1
-tvfs devchar {undeletable_when_open zero_damage}
+tvfs devchar {undeletable_when_open powersafe_overwrite}
# Set up a hook so that each time a journal file is opened, closed or
# deleted, the method name ("xOpen", "xClose" or "xDelete") and the final
diff --git a/test/zerodamage.test b/test/zerodamage.test
index bef82b2ed..0e82ce350 100644
--- a/test/zerodamage.test
+++ b/test/zerodamage.test
@@ -9,29 +9,32 @@
#
#***********************************************************************
#
-# This file implements tests of the SQLITE_IOCAP_ZERO_DAMAGE property
-# and the SQLITE_FCNTL_ZERO_DAMAGE file-control for manipulating it.
+# This file implements tests of the SQLITE_IOCAP_POWERSAFE_OVERWRITE property
+# and the SQLITE_FCNTL_POWERSAFE_OVERWRITE file-control for manipulating it.
+#
+# The name of this file comes from the fact that we used to call the
+# POWERSAFE_OVERWRITE property ZERO_DAMAGE.
#
set testdir [file dirname $argv0]
source $testdir/tester.tcl
set testprefix wal5
-# ZERO_DAMAGE defaults to true
+# POWERSAFE_OVERWRITE defaults to true
#
do_test zerodamage-1.0 {
- file_control_zero_damage db -1
+ file_control_powersafe_overwrite db -1
} {0 1}
# Check the ability to turn zero-damage on and off.
#
do_test zerodamage-1.1 {
- file_control_zero_damage db 0
- file_control_zero_damage db -1
+ file_control_powersafe_overwrite db 0
+ file_control_powersafe_overwrite db -1
} {0 0}
do_test zerodamage-1.2 {
- file_control_zero_damage db 1
- file_control_zero_damage db -1
+ file_control_powersafe_overwrite db 1
+ file_control_powersafe_overwrite db -1
} {0 1}
# Run a transaction with zero-damage on, a small page size and a much larger
@@ -42,7 +45,7 @@ do_test zerodamage-2.0 {
db close
testvfs tv -default 1
tv sectorsize 8192
- sqlite3 db file:test.db?zero_damage=1 -uri 1
+ sqlite3 db file:test.db?psow=TRUE -uri 1
unset -nocomplain ::max_journal_size
set ::max_journal_size 0
proc xDeleteCallback {method file args} {
@@ -65,7 +68,7 @@ do_test zerodamage-2.0 {
db eval {
UPDATE t1 SET y=randomblob(50) WHERE x=123;
}
- concat [file_control_zero_damage db -1] [set ::max_journal_size]
+ concat [file_control_powersafe_overwrite db -1] [set ::max_journal_size]
} {0 1 2576}
# Repeat the previous step with zero-damage turned off. This time the
@@ -74,14 +77,14 @@ do_test zerodamage-2.0 {
do_test zerodamage-2.1 {
set ::max_journal_size 0
db close
- sqlite3 db file:test.db?zero_damage=0 -uri 1
+ sqlite3 db file:test.db?psow=FALSE -uri 1
db eval {
UPDATE t1 SET y=randomblob(50) WHERE x=124;
}
- concat [file_control_zero_damage db -1] [set ::max_journal_size]
+ concat [file_control_powersafe_overwrite db -1] [set ::max_journal_size]
} {0 0 24704}
-# Run a WAL-mode transaction with ZERO_DAMAGE on to verify that the
+# Run a WAL-mode transaction with POWERSAFE_OVERWRITE on to verify that the
# WAL file does not get too big.
#
do_test zerodamage-3.0 {
@@ -89,19 +92,19 @@ do_test zerodamage-3.0 {
PRAGMA journal_mode=WAL;
}
db close
- sqlite3 db file:test.db?zero_damage=1 -uri 1
+ sqlite3 db file:test.db?psow=TRUE -uri 1
db eval {
UPDATE t1 SET y=randomblob(50) WHERE x=124;
}
file size test.db-wal
} {1080}
-# Repeat the previous with ZERO_DAMAGE off. Verify that the WAL file
+# Repeat the previous with POWERSAFE_OVERWRITE off. Verify that the WAL file
# is padded.
#
do_test zerodamage-3.1 {
db close
- sqlite3 db file:test.db?zero_damage=0 -uri 1
+ sqlite3 db file:test.db?psow=FALSE -uri 1
db eval {
UPDATE t1 SET y=randomblob(50) WHERE x=124;
}