mirror of
https://github.com/sqlite/sqlite.git
synced 2025-08-05 15:55:57 +03:00
Change the name ZERO_DAMAGE to the more descriptive POWERSAFE_OVERWRITE.
The query parameter used to control this device characteristic is now "psow". FossilOrigin-Name: 6191c5e45175f5c6040e891843b0725a929d6dd7
This commit is contained in:
15
src/pager.c
15
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()
|
||||
|
Reference in New Issue
Block a user