]> git.ipfire.org Git - thirdparty/sqlite.git/commitdiff
Add the --nocheckpoint and --multitrans options to kvtest.
authordrh <drh@noemail.net>
Sat, 3 Jun 2017 15:17:21 +0000 (15:17 +0000)
committerdrh <drh@noemail.net>
Sat, 3 Jun 2017 15:17:21 +0000 (15:17 +0000)
FossilOrigin-Name: 5828633c2392274b6863b50eaffbb2a176a4d892e83542824a9a3f0d1b62c967

manifest
manifest.uuid
test/kvtest.c

index c02c59b0d055292a64f36befc800c0700014c131..394f8cc3a816bdabea5f48dca5a7f4ac591ccf16 100644 (file)
--- a/manifest
+++ b/manifest
@@ -1,5 +1,5 @@
-C Add\sthe\s--fsync\sflag\sto\skvtest,\sand\sdocument\sthe\s--nosync\sflag.
-D 2017-06-02T23:32:17.964
+C Add\sthe\s--nocheckpoint\sand\s--multitrans\soptions\sto\skvtest.
+D 2017-06-03T15:17:21.324
 F Makefile.in 1cc758ce3374a32425e4d130c2fe7b026b20de5b8843243de75f087c0a2661fb
 F Makefile.linux-gcc 7bc79876b875010e8c8f9502eb935ca92aa3c434
 F Makefile.msc 8eeb80162074004e906b53d7340a12a14c471a83743aab975947e95ce061efcc
@@ -925,7 +925,7 @@ F test/json102.test eeb54efa221e50b74a2d6fb9259963b48d7414dca3ce2fdfdeed45cb2848
 F test/json103.test c5f6b85e69de05f6b3195f9f9d5ce9cd179099a0
 F test/json104.test 877d5845f6303899b7889ea5dd1bea99076e3100574d5c536082245c5805dcaa
 F test/keyword1.test 37ef6bba5d2ed5b07ecdd6810571de2956599dff
-F test/kvtest.c bf2e7ae3de92d98147e8cd49fc550ee3382599aa20b7e2b60038b409a5b2ef34
+F test/kvtest.c a9496cda31fad0998f8c135ae1b02f5a7cf42702a69885084dc2e973744bfba8
 F test/lastinsert.test 42e948fd6442f07d60acbd15d33fb86473e0ef63
 F test/laststmtchanges.test ae613f53819206b3222771828d024154d51db200
 F test/like.test 0603f4fa0dad50987f70032c05800cbfa8985302
@@ -1582,7 +1582,7 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93
 F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc
 F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e
 F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0
-P fc73e7d2f16386f96c55c42f9830193f7c178521a7ad90c3117b85ef629b5ce4
-R ac814c325af013850c7ab30877776723
+P 7fdc78a672b2ea6187dcb5fdf32f809bb8e4d501e2434f2233edc3bc2e3acc7c
+R 042e3a76ff3a30833c7d24fbea5e960d
 U drh
-Z 8a788cf2631896aff995d8f1a4f42a59
+Z db3574b40a9ba9c25a835775eb0162a1
index 87e068908596da989b768c7c8b9068c42c48fef7..058637f374e4a931f1f28e5246fab1c5635ef4f7 100644 (file)
@@ -1 +1 @@
-7fdc78a672b2ea6187dcb5fdf32f809bb8e4d501e2434f2233edc3bc2e3acc7c
\ No newline at end of file
+5828633c2392274b6863b50eaffbb2a176a4d892e83542824a9a3f0d1b62c967
\ No newline at end of file
index aab00526863865f89ad319902624f2a3bd2cd75f..dbf311501ee555f8bfd8764196af7ccf7404a72b 100644 (file)
@@ -94,12 +94,14 @@ static const char zHelp[] =
 "           --integrity-check      Run \"PRAGMA integrity_check\" after test\n"
 "           --max-id N             Maximum blob key to use\n"
 "           --mmap N               Mmap as much as N bytes of DBFILE\n"
+"           --multitrans           Each read or write in its own transaction\n"
+"           --nocheckpoint         Omit the checkpoint on WAL mode writes\n"
 "           --nosync               Set \"PRAGMA synchronous=OFF\"\n"
 "           --jmode MODE           Set MODE journal mode prior to starting\n"
 "           --random               Read blobs in a random order\n"
 "           --start N              Start reading with this blob key\n"
 "           --stats                Output operating stats before exiting\n"
-"           --update               To an overwrite test\n"
+"           --update               Do an overwrite test\n"
 ;
 
 /* Reference resources used */
@@ -742,6 +744,8 @@ static int runMain(int argc, char **argv){
   int doIntegrityCk = 0;      /* Run PRAGMA integrity_check after the test */
   int noSync = 0;             /* Disable synchronous mode */
   int doFsync = 0;            /* Update disk files synchronously */
+  int doMultiTrans = 0;       /* Each operation in its own transaction */
+  int noCheckpoint = 0;       /* Omit the checkpoint in WAL mode */
   sqlite3 *db = 0;            /* Database connection */
   sqlite3_stmt *pStmt = 0;    /* Prepared statement for SQL access */
   sqlite3_blob *pBlob = 0;    /* Handle for incremental Blob I/O */
@@ -765,12 +769,42 @@ static int runMain(int argc, char **argv){
     char *z = argv[i];
     if( z[0]!='-' ) fatalError("unknown argument: \"%s\"", z);
     if( z[1]=='-' ) z++;
+    if( strcmp(z, "-asc")==0 ){
+      eOrder = ORDER_ASC;
+      continue;
+    }
+    if( strcmp(z, "-blob-api")==0 ){
+      bBlobApi = 1;
+      continue;
+    }
+    if( strcmp(z, "-cache-size")==0 ){
+      if( i==argc-1 ) fatalError("missing argument on \"%s\"", argv[i]);
+      iCache = integerValue(argv[++i]);
+      continue;
+    }
     if( strcmp(z, "-count")==0 ){
       if( i==argc-1 ) fatalError("missing argument on \"%s\"", argv[i]);
       nCount = integerValue(argv[++i]);
       if( nCount<1 ) fatalError("the --count must be positive");
       continue;
     }
+    if( strcmp(z, "-desc")==0 ){
+      eOrder = ORDER_DESC;
+      continue;
+    }
+    if( strcmp(z, "-fsync")==0 ){
+      doFsync = 1;
+      continue;
+    }
+    if( strcmp(z, "-integrity-check")==0 ){
+      doIntegrityCk = 1;
+      continue;
+    }
+    if( strcmp(z, "-jmode")==0 ){
+      if( i==argc-1 ) fatalError("missing argument on \"%s\"", argv[i]);
+      zJMode = argv[++i];
+      continue;
+    }
     if( strcmp(z, "-mmap")==0 ){
       if( i==argc-1 ) fatalError("missing argument on \"%s\"", argv[i]);
       mmapSize = integerValue(argv[++i]);
@@ -782,36 +816,26 @@ static int runMain(int argc, char **argv){
       iMax = integerValue(argv[++i]);
       continue;
     }
-    if( strcmp(z, "-start")==0 ){
-      if( i==argc-1 ) fatalError("missing argument on \"%s\"", argv[i]);
-      iKey = integerValue(argv[++i]);
-      if( iKey<1 ) fatalError("the --start must be positive");
+    if( strcmp(z, "-multitrans")==0 ){
+      doMultiTrans = 1;
       continue;
     }
-    if( strcmp(z, "-cache-size")==0 ){
-      if( i==argc-1 ) fatalError("missing argument on \"%s\"", argv[i]);
-      iCache = integerValue(argv[++i]);
+    if( strcmp(z, "-nocheckpoint")==0 ){
+      noCheckpoint = 1;
       continue;
     }
-    if( strcmp(z, "-jmode")==0 ){
-      if( i==argc-1 ) fatalError("missing argument on \"%s\"", argv[i]);
-      zJMode = argv[++i];
+    if( strcmp(z, "-nosync")==0 ){
+      noSync = 1;
       continue;
     }
     if( strcmp(z, "-random")==0 ){
       eOrder = ORDER_RANDOM;
       continue;
     }
-    if( strcmp(z, "-asc")==0 ){
-      eOrder = ORDER_ASC;
-      continue;
-    }
-    if( strcmp(z, "-desc")==0 ){
-      eOrder = ORDER_DESC;
-      continue;
-    }
-    if( strcmp(z, "-blob-api")==0 ){
-      bBlobApi = 1;
+    if( strcmp(z, "-start")==0 ){
+      if( i==argc-1 ) fatalError("missing argument on \"%s\"", argv[i]);
+      iKey = integerValue(argv[++i]);
+      if( iKey<1 ) fatalError("the --start must be positive");
       continue;
     }
     if( strcmp(z, "-stats")==0 ){
@@ -822,18 +846,6 @@ static int runMain(int argc, char **argv){
       isUpdateTest = 1;
       continue;
     }
-    if( strcmp(z, "-integrity-check")==0 ){
-      doIntegrityCk = 1;
-      continue;
-    }
-    if( strcmp(z, "-nosync")==0 ){
-      noSync = 1;
-      continue;
-    }
-    if( strcmp(z, "-fsync")==0 ){
-      doFsync = 1;
-      continue;
-    }
     fatalError("unknown option: \"%s\"", argv[i]);
   }
   if( eType==PATH_DB ){
@@ -876,6 +888,9 @@ static int runMain(int argc, char **argv){
       zSql = sqlite3_mprintf("PRAGMA journal_mode=%Q", zJMode);
       sqlite3_exec(db, zSql, 0, 0, 0);
       sqlite3_free(zSql);
+      if( noCheckpoint ){
+        sqlite3_exec(db, "PRAGMA wal_autocheckpoint=0", 0, 0, 0);
+      }
     }
     sqlite3_prepare_v2(db, "PRAGMA journal_mode", -1, &pStmt, 0);
     if( sqlite3_step(pStmt)==SQLITE_ROW ){
@@ -892,7 +907,7 @@ static int runMain(int argc, char **argv){
       sqlite3_finalize(pStmt);
     }
     pStmt = 0;
-    sqlite3_exec(db, "BEGIN", 0, 0, 0);
+    if( !doMultiTrans ) sqlite3_exec(db, "BEGIN", 0, 0, 0);
   }
   if( iMax<=0 ) iMax = 1000;
   for(i=0; i<nCount; i++){
@@ -990,10 +1005,17 @@ static int runMain(int argc, char **argv){
     display_stats(db, 0);
   }
   if( db ){
-    sqlite3_exec(db, "COMMIT", 0, 0, 0);
-    sqlite3_close(db);
+    if( !doMultiTrans ) sqlite3_exec(db, "COMMIT", 0, 0, 0);
+    if( !noCheckpoint ){
+      sqlite3_close(db);
+      db = 0;
+    }
   }
   tmElapsed = timeOfDay() - tmStart;
+  if( db && noCheckpoint ){
+    sqlite3_close(db);
+    db = 0;
+  }
   if( nExtra ){
     printf("%d cycles due to %d misses\n", nCount, nExtra);
   }