Fix a bug in the handling of sqlite3OsTruncate by the test_async.c demo.
Added trans.test to the suite of tests for asychronous I/O. (CVS 3091) FossilOrigin-Name: 5b16c43542194d6c736bf7aadaaa7f31ff12af31
This commit is contained in:
parent
89ea93121d
commit
97bbdc0aa2
16
manifest
16
manifest
@ -1,5 +1,5 @@
|
||||
C Add\sin-process\sfile\slocking\sto\stest_async.c.\s\sThe\sunix\simplementation\sof\nsqlite3OsFullPathname()\snow\sattempts\sto\sremove\s/./\sand\s/../\selements\sfrom\nthe\spath.\s(CVS\s3090)
|
||||
D 2006-02-13T17:03:48
|
||||
C Fix\sa\sbug\sin\sthe\shandling\sof\ssqlite3OsTruncate\sby\sthe\stest_async.c\sdemo.\nAdded\strans.test\sto\sthe\ssuite\sof\stests\sfor\sasychronous\sI/O.\s(CVS\s3091)
|
||||
D 2006-02-13T18:35:06
|
||||
F Makefile.in 5d8dff443383918b700e495de42ec65bc1c8865b
|
||||
F Makefile.linux-gcc 74ba0eadf88748a9ce3fd03d2a3ede2e6715baec
|
||||
F README 9c4e2d6706bdcc3efdd773ce752a8cdab4f90028
|
||||
@ -80,7 +80,7 @@ F src/test4.c ff4e9406b3d2809966d8f0e82468ac5508be9f56
|
||||
F src/test5.c 7162f8526affb771c4ed256826eee7bb9eca265f
|
||||
F src/test6.c 60a02961ceb7b3edc25f5dc5c1ac2556622a76de
|
||||
F src/test7.c d28d3e62f9594923648fc6a8fb030eba36564ba1
|
||||
F src/test_async.c 2f43ce5293ca20bcd607d7fd261f8f2897cf9821
|
||||
F src/test_async.c 2e7632272cb1ec33982314e29f9952f5a72e7b38
|
||||
F src/test_md5.c 6c42bc0a3c0b54be34623ff77a0eec32b2fa96e3
|
||||
F src/test_server.c 087b92a39d883e3fa113cae259d64e4c7438bc96
|
||||
F src/tokenize.c 382b3bb0ca26eb9153b5d20b246ef512a114a24f
|
||||
@ -105,7 +105,7 @@ F test/alter2.test cc0b8832e4e98605dbc26910efd4bb89abe59cb2
|
||||
F test/alter3.test a6eec8f454be9b6ce73d8d7dc711453675a10ce7
|
||||
F test/altermalloc.test 6e1f404ec021eb2ba6582e3c77b0a35cf206b7af
|
||||
F test/analyze.test 2f55535aa335785db1a2f97d3f3831c16c09f8b0
|
||||
F test/async.test 0f71d47219311c1e7c65b95ef18faa7b65472913
|
||||
F test/async.test f1c74c05949e9c84e07483e960dc2bb41f82a322
|
||||
F test/attach.test 036315207c477211470168bf121b1c493f781515
|
||||
F test/attach2.test 0e6a7c54343c85dd877a1e86073a05176043ed40
|
||||
F test/attach3.test 63013383adc4380af69779f34f4af19bd49f7cbe
|
||||
@ -259,7 +259,7 @@ F test/tkt1567.test 18023cc3626a365f0118e17b66decedec93b1a6f
|
||||
F test/tkt1644.test 80b6a2bb17885f3cf1cb886d97cdad13232bb869
|
||||
F test/tkt1667.test c7faac5050b45d81d0b9f6294e4570b588106e19
|
||||
F test/trace.test 75ffc1b992c780d054748a656e3e7fd674f18567
|
||||
F test/trans.test 6f96f824f8b7b53644b14562b6ccf0eaa1292160
|
||||
F test/trans.test dbadb11882da0fa0ed2a74acecd28e10965b48d0
|
||||
F test/trigger1.test 0c1d44882dba5c92e4efee4dd133cc979f0b1860
|
||||
F test/trigger2.test 33bf8ae9b788013be194efe5f66c04a202facbb4
|
||||
F test/trigger3.test 9102fd3933db294dc654b5aee9edfe9e94f2b9e2
|
||||
@ -352,7 +352,7 @@ F www/tclsqlite.tcl bb0d1357328a42b1993d78573e587c6dcbc964b9
|
||||
F www/vdbe.tcl 87a31ace769f20d3627a64fa1fade7fed47b90d0
|
||||
F www/version3.tcl a99cf5f6d8bd4d5537584a2b342f0fb9fa601d8b
|
||||
F www/whentouse.tcl 97e2b5cd296f7d8057e11f44427dea8a4c2db513
|
||||
P 58c6d501385c6f7656290e8451e28be3fc45843f
|
||||
R b777aa4c4acd9e845f59e4ffc4f5724f
|
||||
P 42379c623073eb541d053c2dff9f49087fb290f8
|
||||
R 330ce6786fd3253716ec7a53675d8402
|
||||
U drh
|
||||
Z bfa3cfee6b6173ed141a70e906af7ee7
|
||||
Z 0f6750cc1b9da8a55632afa45dde9fa3
|
||||
|
@ -1 +1 @@
|
||||
42379c623073eb541d053c2dff9f49087fb290f8
|
||||
5b16c43542194d6c736bf7aadaaa7f31ff12af31
|
@ -497,7 +497,8 @@ static int asyncRead(OsFile *id, void *obuf, int amt){
|
||||
}
|
||||
nRead = MIN(filesize - pFile->iOffset, amt);
|
||||
if( nRead>0 ){
|
||||
rc = sqlite3OsRead(((AsyncFile *)id)->pBaseRead, obuf, nRead);
|
||||
rc = sqlite3OsRead(pFile->pBaseRead, obuf, nRead);
|
||||
TRACE(("READ %s %d bytes at %d\n", pFile->zName, nRead, pFile->iOffset));
|
||||
}
|
||||
}
|
||||
|
||||
@ -517,6 +518,7 @@ static int asyncRead(OsFile *id, void *obuf, int amt){
|
||||
|
||||
if( nCopy>0 ){
|
||||
memcpy(&((char *)obuf)[iBeginOut], &p->zBuf[iBeginIn], nCopy);
|
||||
TRACE(("OVERREAD %d bytes at %d\n", nCopy, iBeginOut+iOffset));
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -623,7 +625,7 @@ static int asyncCheckReservedLock(OsFile *id){
|
||||
rc = (int)sqlite3HashFind(&async.aLock, pFile->zName, pFile->nName);
|
||||
pthread_mutex_unlock(&async.lockMutex);
|
||||
TRACE(("CHECK-LOCK %d (%s)\n", rc, pFile->zName));
|
||||
return rc;
|
||||
return rc>SHARED_LOCK;
|
||||
}
|
||||
|
||||
/*
|
||||
@ -879,8 +881,6 @@ static void *asyncWriterThread(void *NotUsed){
|
||||
}
|
||||
}
|
||||
if( p==0 ) break;
|
||||
TRACE(("PROCESSING %p (%s %s)\n", p, azOpcodeName[p->op],
|
||||
p->pFile ? p->pFile->zName : "-"));
|
||||
|
||||
/* Right now this thread is holding the mutex on the write-op queue.
|
||||
** Variable 'p' points to the first entry in the write-op queue. In
|
||||
@ -925,6 +925,8 @@ static void *asyncWriterThread(void *NotUsed){
|
||||
|
||||
case ASYNC_WRITE:
|
||||
assert( pBase );
|
||||
TRACE(("WRITE %s %d bytes at %d\n",
|
||||
p->pFile->zName, p->nByte, p->iOffset));
|
||||
rc = sqlite3OsSeek(pBase, p->iOffset);
|
||||
if( rc==SQLITE_OK ){
|
||||
rc = sqlite3OsWrite(pBase, (const void *)(p->zBuf), p->nByte);
|
||||
@ -933,15 +935,18 @@ static void *asyncWriterThread(void *NotUsed){
|
||||
|
||||
case ASYNC_SYNC:
|
||||
assert( pBase );
|
||||
TRACE(("SYNC %s\n", p->pFile->zName));
|
||||
rc = sqlite3OsSync(pBase, p->nByte);
|
||||
break;
|
||||
|
||||
case ASYNC_TRUNCATE:
|
||||
assert( pBase );
|
||||
rc = sqlite3OsTruncate(pBase, p->nByte);
|
||||
TRACE(("TRUNCATE %s to %d bytes\n", p->pFile->zName, p->iOffset));
|
||||
rc = sqlite3OsTruncate(pBase, p->iOffset);
|
||||
break;
|
||||
|
||||
case ASYNC_CLOSE:
|
||||
TRACE(("CLOSE %s\n", p->pFile->zName));
|
||||
sqlite3OsClose(&p->pFile->pBaseRead);
|
||||
sqlite3OsClose(&p->pFile->pBaseWrite);
|
||||
sqlite3OsFree(p->pFile);
|
||||
@ -949,19 +954,23 @@ static void *asyncWriterThread(void *NotUsed){
|
||||
|
||||
case ASYNC_OPENDIRECTORY:
|
||||
assert( pBase );
|
||||
TRACE(("OPENDIR %s\n", p->zBuf));
|
||||
sqlite3OsOpenDirectory(pBase, p->zBuf);
|
||||
break;
|
||||
|
||||
case ASYNC_SETFULLSYNC:
|
||||
assert( pBase );
|
||||
TRACE(("SETFULLSYNC %s %d\n", p->pFile->zName, p->nByte));
|
||||
sqlite3OsSetFullSync(pBase, p->nByte);
|
||||
break;
|
||||
|
||||
case ASYNC_DELETE:
|
||||
TRACE(("DELETE %s\n", p->zBuf));
|
||||
rc = xOrigDelete(p->zBuf);
|
||||
break;
|
||||
|
||||
case ASYNC_SYNCDIRECTORY:
|
||||
TRACE(("SYNCDIR %s\n", p->zBuf));
|
||||
rc = xOrigSyncDirectory(p->zBuf);
|
||||
break;
|
||||
|
||||
@ -969,6 +978,7 @@ static void *asyncWriterThread(void *NotUsed){
|
||||
AsyncFile *pFile = p->pFile;
|
||||
int delFlag = ((p->iOffset)?1:0);
|
||||
OsFile *pBase = 0;
|
||||
TRACE(("OPEN %s delFlag=%d\n", p->zBuf, delFlag));
|
||||
rc = xOrigOpenExclusive(p->zBuf, &pBase, delFlag);
|
||||
assert( holdingMutex==0 );
|
||||
pthread_mutex_lock(&async.queueMutex);
|
||||
@ -1175,7 +1185,7 @@ static int testAsyncWait(
|
||||
pthread_mutex_lock(&async.writerMutex);
|
||||
pthread_mutex_unlock(&async.writerMutex);
|
||||
}else{
|
||||
TRACE(("NOTHING TO WAIT ON\n"));
|
||||
TRACE(("NO-WAIT\n"));
|
||||
}
|
||||
return TCL_OK;
|
||||
}
|
||||
|
@ -6,7 +6,7 @@
|
||||
#***********************************************************************
|
||||
# This file runs all tests.
|
||||
#
|
||||
# $Id: async.test,v 1.3 2006/01/09 17:29:53 drh Exp $
|
||||
# $Id: async.test,v 1.4 2006/02/13 18:35:06 drh Exp $
|
||||
|
||||
|
||||
if {[catch {sqlite3async_enable}]} {
|
||||
@ -29,21 +29,19 @@ set INCLUDE {
|
||||
insert.test
|
||||
insert2.test
|
||||
insert3.test
|
||||
trans.test
|
||||
}
|
||||
#set INCLUDE [lrange $INCLUDE 0 0]
|
||||
|
||||
# Enable asynchronous IO.
|
||||
sqlite3async_enable 1
|
||||
sqlite3async_halt never
|
||||
sqlite3async_start
|
||||
|
||||
rename do_test really_do_test
|
||||
proc do_test {name args} {
|
||||
uplevel really_do_test async_io-$name $args
|
||||
sqlite3async_halt idle
|
||||
sqlite3async_wait
|
||||
sqlite3async_halt never
|
||||
sqlite3async_start
|
||||
sqlite3async_wait
|
||||
}
|
||||
|
||||
foreach testfile [lsort -dictionary [glob $testdir/*.test]] {
|
||||
|
@ -11,7 +11,7 @@
|
||||
# This file implements regression tests for SQLite library. The
|
||||
# focus of this script is database locks.
|
||||
#
|
||||
# $Id: trans.test,v 1.29 2006/02/11 01:25:52 drh Exp $
|
||||
# $Id: trans.test,v 1.30 2006/02/13 18:35:06 drh Exp $
|
||||
|
||||
|
||||
set testdir [file dirname $argv0]
|
||||
@ -793,8 +793,11 @@ puts $fd {
|
||||
sqlite_abort
|
||||
}
|
||||
close $fd
|
||||
exec cp -f test.db test.db-bu1
|
||||
do_test trans-8.1 {
|
||||
catch {exec [info nameofexec] test.tcl}
|
||||
exec cp -f test.db test.db-bu2
|
||||
exec cp -f test.db-journal test.db-bu2-journal
|
||||
execsql {SELECT md5sum(x,y,z) FROM t2}
|
||||
} $checksum
|
||||
do_test trans-8.2 {
|
||||
|
Loading…
x
Reference in New Issue
Block a user