summaryrefslogtreecommitdiff
path: root/src/test6.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/test6.c')
-rw-r--r--src/test6.c25
1 files changed, 13 insertions, 12 deletions
diff --git a/src/test6.c b/src/test6.c
index bae6b65..c151ea4 100644
--- a/src/test6.c
+++ b/src/test6.c
@@ -87,7 +87,7 @@ typedef struct WriteBuffer WriteBuffer;
** an aligned write() of an integer number of 512 byte regions, then
** option (3) above is never selected. Instead, each 512 byte region
** is either correctly written or left completely untouched. Similar
-** logic governs the behaviour if any of the other ATOMICXXX flags
+** logic governs the behavior if any of the other ATOMICXXX flags
** is set.
**
** If either the IOCAP_SAFEAPPEND or IOCAP_SEQUENTIAL flags are set
@@ -312,8 +312,8 @@ static int writeListSync(CrashFile *pFile, int isCrash){
assert(pWrite->zBuf);
#ifdef TRACE_CRASHTEST
- printf("Trashing %d sectors @ sector %d (%s)\n",
- 1+iLast-iFirst, iFirst, pWrite->pFile->zName
+ printf("Trashing %d sectors @ %lld (sector %d) (%s)\n",
+ 1+iLast-iFirst, pWrite->iOffset, iFirst, pWrite->pFile->zName
);
#endif
@@ -628,18 +628,19 @@ static int cfOpen(
** to read data from the 512-byte locking region of a file opened
** with the SQLITE_OPEN_MAIN_DB flag. This region of a database file
** never contains valid data anyhow. So avoid doing such a read here.
+ **
+ ** UPDATE: It also contains an assert() verifying that each call
+ ** to the xRead() method reads less than 128KB of data.
*/
const int isDb = (flags&SQLITE_OPEN_MAIN_DB);
- i64 iChunk = pWrapper->iSize;
- if( iChunk>PENDING_BYTE && isDb ){
- iChunk = PENDING_BYTE;
- }
+ i64 iOff;
+
memset(pWrapper->zData, 0, pWrapper->nData);
- rc = sqlite3OsRead(pReal, pWrapper->zData, (int)iChunk, 0);
- if( SQLITE_OK==rc && pWrapper->iSize>(PENDING_BYTE+512) && isDb ){
- i64 iOff = PENDING_BYTE+512;
- iChunk = pWrapper->iSize - iOff;
- rc = sqlite3OsRead(pReal, &pWrapper->zData[iOff], (int)iChunk, iOff);
+ for(iOff=0; iOff<pWrapper->iSize; iOff += 512){
+ int nRead = pWrapper->iSize - (int)iOff;
+ if( nRead>512 ) nRead = 512;
+ if( isDb && iOff==PENDING_BYTE ) continue;
+ rc = sqlite3OsRead(pReal, &pWrapper->zData[iOff], nRead, iOff);
}
}else{
rc = SQLITE_NOMEM;