mirror of
https://github.com/sqlite/sqlite.git
synced 2025-07-30 19:03:16 +03:00
Changes to threadtest3 so that "stress2" is more similar to the SDS stress test.
FossilOrigin-Name: 5648af96d8e2521c5b0cca19f1358374d032394d
This commit is contained in:
17
manifest
17
manifest
@ -1,5 +1,5 @@
|
|||||||
C Add\snew\stest\sfile\se_walauto.test.
|
C Changes\sto\sthreadtest3\sso\sthat\s"stress2"\sis\smore\ssimilar\sto\sthe\sSDS\sstress\stest.
|
||||||
D 2014-12-15T16:27:12.622
|
D 2014-12-15T20:49:26.942
|
||||||
F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f
|
F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f
|
||||||
F Makefile.in 6c4f961fa91d0b4fa121946a19f9e5eac2f2f809
|
F Makefile.in 6c4f961fa91d0b4fa121946a19f9e5eac2f2f809
|
||||||
F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23
|
F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23
|
||||||
@ -913,7 +913,7 @@ F test/thread2.test f35d2106452b77523b3a2b7d1dcde2e5ee8f9e46
|
|||||||
F test/thread_common.tcl 334639cadcb9f912bf82aa73f49efd5282e6cadd
|
F test/thread_common.tcl 334639cadcb9f912bf82aa73f49efd5282e6cadd
|
||||||
F test/threadtest1.c 6029d9c5567db28e6dc908a0c63099c3ba6c383b
|
F test/threadtest1.c 6029d9c5567db28e6dc908a0c63099c3ba6c383b
|
||||||
F test/threadtest2.c ace893054fa134af3fc8d6e7cfecddb8e3acefb9
|
F test/threadtest2.c ace893054fa134af3fc8d6e7cfecddb8e3acefb9
|
||||||
F test/threadtest3.c c8629f836331dd4e5d6ef514b6696605cb593135
|
F test/threadtest3.c f8c6595664a4c5ef5f28d97a612386fe14dd1940
|
||||||
F test/threadtest4.c c1e67136ceb6c7ec8184e56ac61db28f96bd2925
|
F test/threadtest4.c c1e67136ceb6c7ec8184e56ac61db28f96bd2925
|
||||||
F test/tkt-02a8e81d44.test 6c80d9c7514e2a42d4918bf87bf6bc54f379110c
|
F test/tkt-02a8e81d44.test 6c80d9c7514e2a42d4918bf87bf6bc54f379110c
|
||||||
F test/tkt-26ff0c2d1e.test 888324e751512972c6e0d1a09df740d8f5aaf660
|
F test/tkt-26ff0c2d1e.test 888324e751512972c6e0d1a09df740d8f5aaf660
|
||||||
@ -1080,7 +1080,7 @@ F test/triggerE.test 355e9c5cbaed5cd039a60baad1fb2197caeb8e52
|
|||||||
F test/tt3_checkpoint.c 5e63ee65ed5f87176e25a996480cb02c6caec8b4
|
F test/tt3_checkpoint.c 5e63ee65ed5f87176e25a996480cb02c6caec8b4
|
||||||
F test/tt3_index.c 39eec10a35f57672225be4d182862152896dee4a
|
F test/tt3_index.c 39eec10a35f57672225be4d182862152896dee4a
|
||||||
F test/tt3_lookaside1.c 0377e202c3c2a50d688cb65ba203afeda6fafeb9
|
F test/tt3_lookaside1.c 0377e202c3c2a50d688cb65ba203afeda6fafeb9
|
||||||
F test/tt3_stress.c edbb00ed1516535691040315e97cf32c62df22d0
|
F test/tt3_stress.c c57d804716165811d979d4a719e05baccd79277f
|
||||||
F test/tt3_vacuum.c 1753f45917699c9c1f66b64c717a717c9379f776
|
F test/tt3_vacuum.c 1753f45917699c9c1f66b64c717a717c9379f776
|
||||||
F test/types.test bf816ce73c7dfcfe26b700c19f97ef4050d194ff
|
F test/types.test bf816ce73c7dfcfe26b700c19f97ef4050d194ff
|
||||||
F test/types2.test 3555aacf8ed8dc883356e59efc314707e6247a84
|
F test/types2.test 3555aacf8ed8dc883356e59efc314707e6247a84
|
||||||
@ -1232,7 +1232,10 @@ F tool/vdbe_profile.tcl 67746953071a9f8f2f668b73fe899074e2c6d8c1
|
|||||||
F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4
|
F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4
|
||||||
F tool/warnings.sh 0abfd78ceb09b7f7c27c688c8e3fe93268a13b32
|
F tool/warnings.sh 0abfd78ceb09b7f7c27c688c8e3fe93268a13b32
|
||||||
F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f
|
F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f
|
||||||
P 1d44f1b1a9fefeb2449892775c59765c46784eb1
|
P 62ef45140cdbff5eeb8bef506db8b78ced3ace94
|
||||||
R 10b3e0524cfe98a487f450c2b23f40b1
|
R 9a6502f6d41e6a843f5a509613ed553f
|
||||||
|
T *branch * threadtest3
|
||||||
|
T *sym-threadtest3 *
|
||||||
|
T -sym-trunk *
|
||||||
U dan
|
U dan
|
||||||
Z 762d85cad7a4c7a6623b46eb7c11e324
|
Z 02118ab9cf865ac1e1c9e40290c79fe8
|
||||||
|
@ -1 +1 @@
|
|||||||
62ef45140cdbff5eeb8bef506db8b78ced3ace94
|
5648af96d8e2521c5b0cca19f1358374d032394d
|
@ -121,7 +121,10 @@ struct MD5Context {
|
|||||||
int isInit;
|
int isInit;
|
||||||
uint32 buf[4];
|
uint32 buf[4];
|
||||||
uint32 bits[2];
|
uint32 bits[2];
|
||||||
|
union {
|
||||||
unsigned char in[64];
|
unsigned char in[64];
|
||||||
|
uint32 in32[16];
|
||||||
|
} u;
|
||||||
};
|
};
|
||||||
typedef struct MD5Context MD5Context;
|
typedef struct MD5Context MD5Context;
|
||||||
|
|
||||||
@ -270,7 +273,7 @@ void MD5Update(MD5Context *ctx, const unsigned char *buf, unsigned int len){
|
|||||||
/* Handle any leading odd-sized chunks */
|
/* Handle any leading odd-sized chunks */
|
||||||
|
|
||||||
if ( t ) {
|
if ( t ) {
|
||||||
unsigned char *p = (unsigned char *)ctx->in + t;
|
unsigned char *p = (unsigned char *)ctx->u.in + t;
|
||||||
|
|
||||||
t = 64-t;
|
t = 64-t;
|
||||||
if (len < t) {
|
if (len < t) {
|
||||||
@ -278,8 +281,8 @@ void MD5Update(MD5Context *ctx, const unsigned char *buf, unsigned int len){
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
memcpy(p, buf, t);
|
memcpy(p, buf, t);
|
||||||
byteReverse(ctx->in, 16);
|
byteReverse(ctx->u.in, 16);
|
||||||
MD5Transform(ctx->buf, (uint32 *)ctx->in);
|
MD5Transform(ctx->buf, (uint32 *)ctx->u.in);
|
||||||
buf += t;
|
buf += t;
|
||||||
len -= t;
|
len -= t;
|
||||||
}
|
}
|
||||||
@ -287,16 +290,16 @@ void MD5Update(MD5Context *ctx, const unsigned char *buf, unsigned int len){
|
|||||||
/* Process data in 64-byte chunks */
|
/* Process data in 64-byte chunks */
|
||||||
|
|
||||||
while (len >= 64) {
|
while (len >= 64) {
|
||||||
memcpy(ctx->in, buf, 64);
|
memcpy(ctx->u.in, buf, 64);
|
||||||
byteReverse(ctx->in, 16);
|
byteReverse(ctx->u.in, 16);
|
||||||
MD5Transform(ctx->buf, (uint32 *)ctx->in);
|
MD5Transform(ctx->buf, (uint32 *)ctx->u.in);
|
||||||
buf += 64;
|
buf += 64;
|
||||||
len -= 64;
|
len -= 64;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Handle any remaining bytes of data. */
|
/* Handle any remaining bytes of data. */
|
||||||
|
|
||||||
memcpy(ctx->in, buf, len);
|
memcpy(ctx->u.in, buf, len);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -312,7 +315,7 @@ static void MD5Final(unsigned char digest[16], MD5Context *ctx){
|
|||||||
|
|
||||||
/* Set the first char of padding to 0x80. This is safe since there is
|
/* Set the first char of padding to 0x80. This is safe since there is
|
||||||
always at least one byte free */
|
always at least one byte free */
|
||||||
p = ctx->in + count;
|
p = ctx->u.in + count;
|
||||||
*p++ = 0x80;
|
*p++ = 0x80;
|
||||||
|
|
||||||
/* Bytes of padding needed to make 64 bytes */
|
/* Bytes of padding needed to make 64 bytes */
|
||||||
@ -322,22 +325,22 @@ static void MD5Final(unsigned char digest[16], MD5Context *ctx){
|
|||||||
if (count < 8) {
|
if (count < 8) {
|
||||||
/* Two lots of padding: Pad the first block to 64 bytes */
|
/* Two lots of padding: Pad the first block to 64 bytes */
|
||||||
memset(p, 0, count);
|
memset(p, 0, count);
|
||||||
byteReverse(ctx->in, 16);
|
byteReverse(ctx->u.in, 16);
|
||||||
MD5Transform(ctx->buf, (uint32 *)ctx->in);
|
MD5Transform(ctx->buf, (uint32 *)ctx->u.in);
|
||||||
|
|
||||||
/* Now fill the next block with 56 bytes */
|
/* Now fill the next block with 56 bytes */
|
||||||
memset(ctx->in, 0, 56);
|
memset(ctx->u.in, 0, 56);
|
||||||
} else {
|
} else {
|
||||||
/* Pad block to 56 bytes */
|
/* Pad block to 56 bytes */
|
||||||
memset(p, 0, count-8);
|
memset(p, 0, count-8);
|
||||||
}
|
}
|
||||||
byteReverse(ctx->in, 14);
|
byteReverse(ctx->u.in, 14);
|
||||||
|
|
||||||
/* Append length in bits and transform */
|
/* Append length in bits and transform */
|
||||||
((uint32 *)ctx->in)[ 14 ] = ctx->bits[0];
|
ctx->u.in32[14] = ctx->bits[0];
|
||||||
((uint32 *)ctx->in)[ 15 ] = ctx->bits[1];
|
ctx->u.in32[15] = ctx->bits[1];
|
||||||
|
|
||||||
MD5Transform(ctx->buf, (uint32 *)ctx->in);
|
MD5Transform(ctx->buf, (uint32 *)ctx->u.in);
|
||||||
byteReverse((unsigned char *)ctx->buf, 4);
|
byteReverse((unsigned char *)ctx->buf, 4);
|
||||||
memcpy(digest, ctx->buf, 16);
|
memcpy(digest, ctx->buf, 16);
|
||||||
memset(ctx, 0, sizeof(*ctx)); /* In case it is sensitive */
|
memset(ctx, 0, sizeof(*ctx)); /* In case it is sensitive */
|
||||||
@ -1445,7 +1448,7 @@ int main(int argc, char **argv){
|
|||||||
{ lookaside1, "lookaside1", 10000 },
|
{ lookaside1, "lookaside1", 10000 },
|
||||||
{ vacuum1, "vacuum1", 10000 },
|
{ vacuum1, "vacuum1", 10000 },
|
||||||
{ stress1, "stress1", 10000 },
|
{ stress1, "stress1", 10000 },
|
||||||
{ stress2, "stress2", 10000 },
|
{ stress2, "stress2", 60000 },
|
||||||
};
|
};
|
||||||
|
|
||||||
int i;
|
int i;
|
||||||
|
@ -124,7 +124,6 @@ static char *stress_thread_5(int iTid, void *pArg){
|
|||||||
i1++;
|
i1++;
|
||||||
if( err.rc ) i2++;
|
if( err.rc ) i2++;
|
||||||
clear_error(&err, SQLITE_LOCKED);
|
clear_error(&err, SQLITE_LOCKED);
|
||||||
clear_error(&err, SQLITE_ERROR);
|
|
||||||
}
|
}
|
||||||
closedb(&err, &db);
|
closedb(&err, &db);
|
||||||
print_and_free_err(&err);
|
print_and_free_err(&err);
|
||||||
@ -184,73 +183,66 @@ static void stress1(int nMs){
|
|||||||
** 19. Open and close database connections rapidly.
|
** 19. Open and close database connections rapidly.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#define STRESS2_TABCNT 5
|
#define STRESS2_TABCNT 5 /* count1 in SDS test */
|
||||||
|
|
||||||
|
#define STRESS2_COUNT2 200 /* count2 in SDS test */
|
||||||
|
#define STRESS2_COUNT3 57 /* count2 in SDS test */
|
||||||
|
|
||||||
static void stress2_workload1(Error *pErr, Sqlite *pDb, int i){
|
static void stress2_workload1(Error *pErr, Sqlite *pDb, int i){
|
||||||
int iTab = (i % STRESS2_TABCNT);
|
int iTab = (i % (STRESS2_TABCNT-1)) + 1;
|
||||||
sql_script_printf(pErr, pDb,
|
sql_script_printf(pErr, pDb,
|
||||||
"CREATE TABLE IF NOT EXISTS t%d(x PRIMARY KEY, y, z);", iTab
|
"CREATE TABLE IF NOT EXISTS t%d(x PRIMARY KEY, y, z);", iTab
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void stress2_workload2(Error *pErr, Sqlite *pDb, int i){
|
static void stress2_workload2(Error *pErr, Sqlite *pDb, int i){
|
||||||
int iTab = (i % STRESS2_TABCNT);
|
int iTab = (i % (STRESS2_TABCNT-1)) + 1;
|
||||||
sql_script_printf(pErr, pDb, "DROP TABLE IF EXISTS t%d;", iTab);
|
sql_script_printf(pErr, pDb, "DROP TABLE IF EXISTS t%d;", iTab);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void stress2_workload3(Error *pErr, Sqlite *pDb, int i){
|
static void stress2_workload3(Error *pErr, Sqlite *pDb, int i){
|
||||||
int iTab = (i % STRESS2_TABCNT);
|
sql_script(pErr, pDb, "SELECT * FROM t0 WHERE z = 'small'");
|
||||||
sql_script_printf(pErr, pDb, "SELECT * FROM t%d WHERE z = 'small'", iTab);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void stress2_workload4(Error *pErr, Sqlite *pDb, int i){
|
static void stress2_workload4(Error *pErr, Sqlite *pDb, int i){
|
||||||
int iTab = (i % STRESS2_TABCNT);
|
sql_script(pErr, pDb, "SELECT * FROM t0 WHERE z = 'big'");
|
||||||
sql_script_printf(pErr, pDb, "SELECT * FROM t%d WHERE z = 'big'", iTab);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void stress2_workload5(Error *pErr, Sqlite *pDb, int i){
|
static void stress2_workload5(Error *pErr, Sqlite *pDb, int i){
|
||||||
int iTab = (i % STRESS2_TABCNT);
|
sql_script(pErr, pDb,
|
||||||
sql_script_printf(pErr, pDb,
|
"INSERT INTO t0 VALUES(hex(random()), hex(randomblob(200)), 'small');"
|
||||||
"INSERT INTO t%d VALUES(random(), hex(randomblob(57)), 'small');", iTab
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void stress2_workload6(Error *pErr, Sqlite *pDb, int i){
|
static void stress2_workload6(Error *pErr, Sqlite *pDb, int i){
|
||||||
int iTab = (i % STRESS2_TABCNT);
|
sql_script(pErr, pDb,
|
||||||
sql_script_printf(pErr, pDb,
|
"INSERT INTO t0 VALUES(hex(random()), hex(randomblob(57)), 'big');"
|
||||||
"INSERT INTO t%d VALUES(random(), hex(randomblob(2000)), 'big');", iTab
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void stress2_workload7(Error *pErr, Sqlite *pDb, int i){
|
static void stress2_workload7(Error *pErr, Sqlite *pDb, int i){
|
||||||
int iTab = (i % STRESS2_TABCNT);
|
|
||||||
sql_script_printf(pErr, pDb,
|
sql_script_printf(pErr, pDb,
|
||||||
"UPDATE t%d SET y = hex(randomblob(57)) "
|
"UPDATE t0 SET y = hex(randomblob(200)) "
|
||||||
"WHERE (x %% 5)==(%d %% 5) AND z='small';"
|
"WHERE x LIKE hex((%d %% 5)) AND z='small';"
|
||||||
,iTab, i
|
,i
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
static void stress2_workload8(Error *pErr, Sqlite *pDb, int i){
|
static void stress2_workload8(Error *pErr, Sqlite *pDb, int i){
|
||||||
int iTab = (i % STRESS2_TABCNT);
|
|
||||||
sql_script_printf(pErr, pDb,
|
sql_script_printf(pErr, pDb,
|
||||||
"UPDATE t%d SET y = hex(randomblob(2000)) "
|
"UPDATE t0 SET y = hex(randomblob(57)) "
|
||||||
"WHERE (x %% 5)==(%d %% 5) AND z='big';"
|
"WHERE x LIKE hex(%d %% 5) AND z='big';"
|
||||||
,iTab, i
|
,i
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void stress2_workload9(Error *pErr, Sqlite *pDb, int i){
|
static void stress2_workload9(Error *pErr, Sqlite *pDb, int i){
|
||||||
int iTab = (i % STRESS2_TABCNT);
|
|
||||||
sql_script_printf(pErr, pDb,
|
sql_script_printf(pErr, pDb,
|
||||||
"DELETE FROM t%d WHERE (x %% 5)==(%d %% 5) AND z='small';"
|
"DELETE FROM t0 WHERE x LIKE hex(%d %% 5) AND z='small';", i
|
||||||
,iTab, i
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
static void stress2_workload10(Error *pErr, Sqlite *pDb, int i){
|
static void stress2_workload10(Error *pErr, Sqlite *pDb, int i){
|
||||||
int iTab = (i % STRESS2_TABCNT);
|
|
||||||
sql_script_printf(pErr, pDb,
|
sql_script_printf(pErr, pDb,
|
||||||
"DELETE FROM t%d WHERE (x %% 5)==(%d %% 5) AND z='big';"
|
"DELETE FROM t0 WHERE x LIKE hex(%d %% 5) AND z='big';", i
|
||||||
,iTab, i
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -296,14 +288,17 @@ static char *stress2_thread_wrapper(int iTid, void *pArg){
|
|||||||
int i1 = 0;
|
int i1 = 0;
|
||||||
int i2 = 0;
|
int i2 = 0;
|
||||||
|
|
||||||
opendb(&err, &db, pCtx->zDb, 0);
|
|
||||||
while( !timetostop(&err) ){
|
while( !timetostop(&err) ){
|
||||||
|
int cnt;
|
||||||
|
opendb(&err, &db, pCtx->zDb, 0);
|
||||||
|
for(cnt=0; err.rc==SQLITE_OK && cnt<STRESS2_TABCNT; cnt++){
|
||||||
pCtx->xProc(&err, &db, i1);
|
pCtx->xProc(&err, &db, i1);
|
||||||
i2 += (err.rc==SQLITE_OK);
|
i2 += (err.rc==SQLITE_OK);
|
||||||
clear_error(&err, SQLITE_LOCKED);
|
clear_error(&err, SQLITE_LOCKED);
|
||||||
clear_error(&err, SQLITE_ERROR);
|
|
||||||
i1++;
|
i1++;
|
||||||
}
|
}
|
||||||
|
closedb(&err, &db);
|
||||||
|
}
|
||||||
|
|
||||||
print_and_free_err(&err);
|
print_and_free_err(&err);
|
||||||
return sqlite3_mprintf("ok %d/%d", i2, i1);
|
return sqlite3_mprintf("ok %d/%d", i2, i1);
|
||||||
@ -339,21 +334,19 @@ static void stress2(int nMs){
|
|||||||
{ stress2_workload14 },
|
{ stress2_workload14 },
|
||||||
{ stress2_workload17 },
|
{ stress2_workload17 },
|
||||||
};
|
};
|
||||||
const char *azDb[] = {
|
const char *zDb = "test.db";
|
||||||
"test.db",
|
|
||||||
"file::memory:?cache=shared"
|
|
||||||
};
|
|
||||||
int j;
|
|
||||||
|
|
||||||
for(j=0; j<sizeof(azDb)/sizeof(azDb[0]); j++){
|
|
||||||
int i;
|
int i;
|
||||||
Error err = {0};
|
Error err = {0};
|
||||||
Sqlite db = {0};
|
Sqlite db = {0};
|
||||||
Threadset threads = {0};
|
Threadset threads = {0};
|
||||||
const char *zDb = azDb[j];
|
|
||||||
|
|
||||||
/* To make sure the db file is empty before commencing */
|
/* To make sure the db file is empty before commencing */
|
||||||
opendb(&err, &db, zDb, 1);
|
opendb(&err, &db, zDb, 1);
|
||||||
|
sql_script(&err, &db,
|
||||||
|
"CREATE TABLE IF NOT EXISTS t0(x PRIMARY KEY, y, z);"
|
||||||
|
"CREATE INDEX IF NOT EXISTS i0 ON t0(y);"
|
||||||
|
);
|
||||||
closedb(&err, &db);
|
closedb(&err, &db);
|
||||||
|
|
||||||
setstoptime(&err, nMs);
|
setstoptime(&err, nMs);
|
||||||
@ -368,12 +361,6 @@ static void stress2(int nMs){
|
|||||||
join_all_threads(&err, &threads);
|
join_all_threads(&err, &threads);
|
||||||
sqlite3_enable_shared_cache(0);
|
sqlite3_enable_shared_cache(0);
|
||||||
print_and_free_err(&err);
|
print_and_free_err(&err);
|
||||||
if( j==0 ){
|
|
||||||
printf("Running stress2 (again, with in-memory db) for %d seconds...\n",
|
|
||||||
nMs / 1000
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user