diff --git a/manifest b/manifest index 52290c4f50..17009a8f99 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Try\sto\sget\sthreads\sworking\sagain\son\sLinux.\s(CVS\s1755) -D 2004-06-29T03:29:00 +C Bug-fixes\sto\sget\sthe\stwo\sthreadtest\sC\sprograms\sworking\sagain.\s(CVS\s1756) +D 2004-06-29T07:45:33 F Makefile.in cb7a9889c38723f72b2506c4236ff30a05ff172b F Makefile.linux-gcc a9e5a0d309fa7c38e7c14d3ecf7690879d3a5457 F README f1de682fbbd94899d50aca13d387d1b3fd3be2dd @@ -28,7 +28,7 @@ F src/attach.c 73b16e608fc662e8602639e946582832b6f2902b F src/auth.c 60db23b98bb94c8b0178180faaf49dc116674217 F src/btree.c ad428c56e42d748a0c1441fbbd93e41df407c31d F src/btree.h 934d0ad30b5b419e9291a11da878be349df2277e -F src/build.c 574cdd30922ead0ababc717865aef9948c17701d +F src/build.c ea8a3220574348b052e5c66e90c0619f3fd89863 F src/date.c b3e8b2bef1e3f2ce24e5b057203036defb18c3f1 F src/delete.c e81545e546f6bc87d7508a93a09ca70695265af3 F src/encode.c a876af473d1d636faa3dca51c7571f2e007eea37 @@ -38,22 +38,22 @@ F src/hash.c 440c2f8cb373ee1b4e13a0988489c7cd95d55b6f F src/hash.h 762d95f1e567664d1eafc1687de755626be962fb F src/insert.c d99ffe87e1e1397f4233afcd06841d52d6b17b18 F src/legacy.c ad23746f15f67e34577621b1875f639c94839e1f -F src/main.c 6d27d09c9984d9b68a53b95fc2e327a19cd28851 +F src/main.c b2f25e2fe7ae2f930804694d01425f0ddfc51bee F src/md5.c 7ae1c39044b95de2f62e066f47bb1deb880a1070 F src/os.h d1780e0db95cad01f213d48da22ab490eb4fd345 -F src/os_common.h ba1b7306e16e2091718f2c48db0fe6c1d7a31bb8 +F src/os_common.h 1e745e582138c01d995f190d7544da3e826f6b2f F src/os_mac.c 3d31e26be1411acfb7961033098631b4f3486fdf F src/os_mac.h 51d2445f47e182ed32d3bd6937f81070c6fd9bd4 F src/os_test.c ef353f73a2ad85a239d7a77c4a5df2e1377f3848 F src/os_test.h 6a26a4978492e4bbdbf385554958418ff02db162 -F src/os_unix.c 2d787fd91a1b202ec6d0930b70982bc1ab816bb8 +F src/os_unix.c 8acbb7190cd6d91d076bd51da902daf2874bfbd2 F src/os_unix.h 00c1f82b526ab2fb7ee5ddd555ea4ed68363c93a F src/os_win.c 84549f6cc815237533c5d0eb3697352b03478d96 F src/os_win.h babd4e912967c6b09088cfe38a45e8005a07ba44 F src/pager.c c1d5212e7cac86bc1a29d01a30d9dbbdb545dfd8 F src/pager.h fe818866f6d1adcffeed88705e8df7e588cbaf13 F src/parse.y e19e066e726a31d7b2d3e6475bdf55f7e339f8a3 -F src/pragma.c 2ca5ef7e27916f191a3b1201ad576ef6f8a8d72d +F src/pragma.c b6df973670332adc6c211b111ee41dcf31ac183f F src/printf.c 3090c8ff397d549bc0de09b16d8ab7fd37a0c3f7 F src/random.c eff68e3f257e05e81eae6c4d50a51eb88beb4ff3 F src/select.c f02a65af34231031896e8442161cb5251e191e75 @@ -162,8 +162,8 @@ F test/tclsqlite.test 2517b10ee2c806fb700548f54540aec7d62ed14a F test/temptable.test 63a16e3ad19adf073cfbcdf7624c92ac5236522c F test/tester.tcl f36cc22d0532725073ca78272d7834d56dceb6d9 F test/thread1.test 776c9e459b75ba905193b351926ac4019b049f35 -F test/threadtest1.c 1dd597369021ed72cd71c138a14a561d443f6edf -F test/threadtest2.c c38c9c1769725ebe240317dcc6bbed13c600ac98 +F test/threadtest1.c 6029d9c5567db28e6dc908a0c63099c3ba6c383b +F test/threadtest2.c 97a830d53c24c42290501fdfba4a6e5bdd34748b F test/trans.test 29645b344d2b9b6792793562b12340177ddd8f96 F test/trigger1.test dc015c410161f1a6109fd52638dfac852e2a34de F test/trigger2.test 0767ab30cb5a2c8402c8524f3d566b410b6f5263 @@ -231,7 +231,7 @@ F www/tclsqlite.tcl 19191cf2a1010eaeff74c51d83fd5f5a4d899075 F www/vdbe.tcl 59288db1ac5c0616296b26dce071c36cb611dfe9 F www/version3.tcl 563ba3ac02f64da27ab17f3edbe8e56bfd0293fb F www/whentouse.tcl a8335bce47cc2fddb07f19052cb0cb4d9129a8e4 -P 332921041040b343b6b568685ff55d21a624f502 -R bdedb5a03f87b2291e0c7bb98d11a6cb -U drh -Z 23b6d4864c82370d472ac66ee3391b29 +P a8417cb83e9d070f46e7505f92a95f057b992658 +R f6a3ab8dfc5160d3b6066eb0982690ff +U danielk1977 +Z 627f904ea791eadd909ab90d3df46fcf diff --git a/manifest.uuid b/manifest.uuid index e7412246b0..9ff384807a 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -a8417cb83e9d070f46e7505f92a95f057b992658 \ No newline at end of file +ffd3312b66e2657c3431eab814aadec254af2403 \ No newline at end of file diff --git a/src/build.c b/src/build.c index d3efc5d8a9..e785f16518 100644 --- a/src/build.c +++ b/src/build.c @@ -23,7 +23,7 @@ ** ROLLBACK ** PRAGMA ** -** $Id: build.c,v 1.235 2004/06/28 01:11:47 danielk1977 Exp $ +** $Id: build.c,v 1.236 2004/06/29 07:45:33 danielk1977 Exp $ */ #include "sqliteInt.h" #include @@ -147,7 +147,12 @@ Table *sqlite3LocateTable(Parse *pParse, const char *zName, const char *zDbase){ p = sqlite3FindTable(pParse->db, zName, zDbase); if( p==0 ){ - if( zDbase ){ + if( !(pParse->db->flags & SQLITE_Initialized) ){ + /* If the schema is not initialised at this point, it must be because + ** the database is locked. */ + pParse->nErr++; + pParse->rc = SQLITE_BUSY; + }else if( zDbase ){ sqlite3ErrorMsg(pParse, "no such table: %s.%s", zDbase, zName); }else if( sqlite3FindTable(pParse->db, zName, 0)!=0 ){ sqlite3ErrorMsg(pParse, "table \"%s\" is not in database \"%s\"", @@ -617,6 +622,7 @@ void sqlite3StartTable( sqlite3ErrorMsg(pParse, "unable to open a temporary database " "file for storing temporary tables"); pParse->nErr++; + pParse->rc = rc; sqliteFree(zName); return; } @@ -626,6 +632,7 @@ void sqlite3StartTable( sqlite3ErrorMsg(pParse, "unable to get a write lock on " "the temporary database file"); sqliteFree(zName); + pParse->rc = rc; return; } } diff --git a/src/main.c b/src/main.c index ba2b5cefb7..7f3f52b6ff 100644 --- a/src/main.c +++ b/src/main.c @@ -14,7 +14,7 @@ ** other files are for internal use by SQLite and should not be ** accessed by users of the library. ** -** $Id: main.c,v 1.237 2004/06/28 01:11:47 danielk1977 Exp $ +** $Id: main.c,v 1.238 2004/06/29 07:45:34 danielk1977 Exp $ */ #include "sqliteInt.h" #include "os.h" @@ -85,15 +85,18 @@ int sqlite3InitCallback(void *pInit, int argc, char **argv, char **azColName){ ** structures that describe the table, index, or view. */ char *zErr; + int rc; assert( db->init.busy ); db->init.iDb = atoi(argv[4]); assert( db->init.iDb>=0 && db->init.iDbnDb ); db->init.newTnum = atoi(argv[2]); - if( sqlite3_exec(db, argv[3], 0, 0, &zErr) ){ + rc = sqlite3_exec(db, argv[3], 0, 0, &zErr); + db->init.iDb = 0; + if( SQLITE_OK!=rc ){ corruptSchema(pData, zErr); sqlite3_free(zErr); + return rc; } - db->init.iDb = 0; }else{ /* If the SQL column is blank it means this is an index that ** was created to be the PRIMARY KEY or to fulfill a UNIQUE @@ -118,8 +121,8 @@ int sqlite3InitCallback(void *pInit, int argc, char **argv, char **azColName){ pIndex->tnum = atoi(argv[2]); } } - break; } + break; default: { /* This can not happen! */ nErr = 1; @@ -196,7 +199,11 @@ static int sqlite3InitOne(sqlite *db, int iDb, char **pzErrMsg){ azArg[5] = 0; initData.db = db; initData.pzErrMsg = pzErrMsg; - sqlite3InitCallback(&initData, 5, (char **)azArg, 0); + rc = sqlite3InitCallback(&initData, 5, (char **)azArg, 0); + if( rc!=SQLITE_OK ){ + sqlite3SafetyOn(db); + return rc; + } pTab = sqlite3FindTable(db, zMasterName, db->aDb[iDb].zName); if( pTab ){ pTab->readOnly = 1; diff --git a/src/os_common.h b/src/os_common.h index a8ac2707ae..48490e82a8 100644 --- a/src/os_common.h +++ b/src/os_common.h @@ -44,6 +44,8 @@ static unsigned int elapse; #define TRACE4(X,Y,Z,A) if( sqlite3_os_trace ) sqlite3DebugPrintf(X,Y,Z,A) #define TRACE5(X,Y,Z,A,B) if( sqlite3_os_trace ) sqlite3DebugPrintf(X,Y,Z,A,B) #define TRACE6(X,Y,Z,A,B,C) if(sqlite3_os_trace) sqlite3DebugPrintf(X,Y,Z,A,B,C) +#define TRACE7(X,Y,Z,A,B,C,D) \ + if(sqlite3_os_trace) sqlite3DebugPrintf(X,Y,Z,A,B,C,D) #else #define TIMER_START #define TIMER_END diff --git a/src/os_unix.c b/src/os_unix.c index c2309495eb..8ce1498702 100644 --- a/src/os_unix.c +++ b/src/os_unix.c @@ -759,6 +759,24 @@ int sqlite3OsCheckReservedLock(OsFile *id){ return r; } +#ifdef SQLITE_DEBUG +/* +** Helper function for printing out trace information from debugging +** binaries. This returns the string represetation of the supplied +** integer lock-type. +*/ +static const char * locktypeName(int locktype){ + switch( locktype ){ + case NO_LOCK: return "NONE"; + case SHARED_LOCK: return "SHARED"; + case RESERVED_LOCK: return "RESERVED"; + case PENDING_LOCK: return "PENDING"; + case EXCLUSIVE_LOCK: return "EXCLUSIVE"; + } + return "ERROR"; +} +#endif + /* ** Lock the file with the lock specified by parameter locktype - one ** of the following: @@ -828,14 +846,16 @@ int sqlite3OsLock(OsFile *id, int locktype){ int s; assert( id->isOpen ); - TRACE6("LOCK %d %d was %d(%d,%d)\n", - id->h, locktype, id->locktype, pLock->locktype, pLock->cnt); + TRACE7("LOCK %d %s was %s(%s,%d) pid=%d\n", id->h, locktypeName(locktype), + locktypeName(id->locktype), locktypeName(pLock->locktype), pLock->cnt + ,getpid() ); /* If there is already a lock of this type or more restrictive on the ** OsFile, do nothing. Don't use the end_lock: exit path, as ** sqlite3OsEnterMutex() hasn't been called yet. */ if( id->locktype>=locktype ){ + TRACE3("LOCK %d %s ok (already held)\n", id->h, locktypeName(locktype)); return SQLITE_OK; } @@ -956,7 +976,8 @@ int sqlite3OsLock(OsFile *id, int locktype){ end_lock: sqlite3OsLeaveMutex(); - TRACE4("LOCK %d %d %s\n", id->h, locktype, rc==SQLITE_OK ? "ok" : "failed"); + TRACE4("LOCK %d %s %s\n", id->h, locktypeName(locktype), + rc==SQLITE_OK ? "ok" : "failed"); return rc; } @@ -974,8 +995,8 @@ int sqlite3OsUnlock(OsFile *id, int locktype){ struct flock lock; assert( id->isOpen ); - TRACE6("UNLOCK %d %d was %d(%d,%d)\n", - id->h, locktype, id->locktype, id->pLock->locktype, id->pLock->cnt); + TRACE7("UNLOCK %d %d was %d(%d,%d) pid=%d\n", id->h, locktype, id->locktype, + id->pLock->locktype, id->pLock->cnt, getpid()); assert( locktype<=SHARED_LOCK ); if( id->locktype<=locktype ){ diff --git a/src/pragma.c b/src/pragma.c index 469ccff054..a49de38b4c 100644 --- a/src/pragma.c +++ b/src/pragma.c @@ -11,7 +11,7 @@ ************************************************************************* ** This file contains code used to implement the PRAGMA command. ** -** $Id: pragma.c,v 1.54 2004/06/26 19:35:30 drh Exp $ +** $Id: pragma.c,v 1.55 2004/06/29 07:45:34 danielk1977 Exp $ */ #include "sqliteInt.h" #include @@ -119,8 +119,10 @@ static int flagPragma(Parse *pParse, const char *zLeft, const char *zRight){ ** Check to make sure the schema is loaded. Return 1 if it is not. */ static int checkSchema(Parse *pParse){ - if( SQLITE_OK!=sqlite3ReadSchema(pParse->db, &pParse->zErrMsg) ){ + int rc = sqlite3ReadSchema(pParse->db, &pParse->zErrMsg); + if( SQLITE_OK!=rc ){ pParse->nErr++; + pParse->rc = rc; return 1; } return 0; @@ -500,6 +502,7 @@ void sqlite3Pragma( cnt++; } } + assert( cnt>0 ); sqlite3VdbeAddOp(v, OP_IntegrityCk, cnt, i); sqlite3VdbeAddOp(v, OP_Dup, 0, 1); addr = sqlite3VdbeOp3(v, OP_String8, 0, 0, "ok", P3_STATIC); diff --git a/test/threadtest1.c b/test/threadtest1.c index f5ff112e60..56fcce33e8 100644 --- a/test/threadtest1.c +++ b/test/threadtest1.c @@ -262,7 +262,16 @@ int main(int argc, char **argv){ } for(i=0; i