-C Work\stoward\senhancing\skvtest\sto\smeasure\swrite\sperformance.
-D 2017-06-02T19:31:46.986
+C Add\sthe\s--fsync\sflag\sto\skvtest,\sand\sdocument\sthe\s--nosync\sflag.
+D 2017-06-02T23:32:17.964
F Makefile.in 1cc758ce3374a32425e4d130c2fe7b026b20de5b8843243de75f087c0a2661fb
F Makefile.linux-gcc 7bc79876b875010e8c8f9502eb935ca92aa3c434
F Makefile.msc 8eeb80162074004e906b53d7340a12a14c471a83743aab975947e95ce061efcc
F test/json103.test c5f6b85e69de05f6b3195f9f9d5ce9cd179099a0
F test/json104.test 877d5845f6303899b7889ea5dd1bea99076e3100574d5c536082245c5805dcaa
F test/keyword1.test 37ef6bba5d2ed5b07ecdd6810571de2956599dff
-F test/kvtest.c 63f9a1c31391f304e87d4854aea54c01afa9e4f6d05e11124598c7415b893a85
+F test/kvtest.c bf2e7ae3de92d98147e8cd49fc550ee3382599aa20b7e2b60038b409a5b2ef34
F test/lastinsert.test 42e948fd6442f07d60acbd15d33fb86473e0ef63
F test/laststmtchanges.test ae613f53819206b3222771828d024154d51db200
F test/like.test 0603f4fa0dad50987f70032c05800cbfa8985302
F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc
F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e
F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0
-P ab33d299c7dab52703d06f3441c8a98c6c809b2612ec65d71aab2919bd2b1540
-R b213b6f467b3c9502658fd4e2800b6d6
+P fc73e7d2f16386f96c55c42f9830193f7c178521a7ad90c3117b85ef629b5ce4
+R ac814c325af013850c7ab30877776723
U drh
-Z 24f39ffaffd16b2467372fb4bd435c2b
+Z 8a788cf2631896aff995d8f1a4f42a59
" --cache-size N Database cache size\n"
" --count N Read N blobs\n"
" --desc Read blobs in descending order\n"
-" --integrity-check Run 'PRAGMA integrity_check' after test\n"
+" --fsync Synchronous file writes\n"
+" --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"
+" --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"
** Overwrite a file with randomness. Do not change the size of the
** file.
*/
-static void updateFile(const char *zName, int *pnByte){
+static void updateFile(const char *zName, int *pnByte, int doFsync){
FILE *out; /* FILE from which to read content of zName */
sqlite3_int64 sz; /* Size of zName in bytes */
size_t nWritten; /* Number of bytes actually read */
unsigned char *pBuf; /* Content to store on disk */
+ const char *zMode = "wb"; /* Mode for fopen() */
sz = fileSize(zName);
if( sz<0 ){
fatalError("Cannot allocate %lld bytes\n", sz);
}
sqlite3_randomness((int)sz, pBuf);
- out = fopen(zName, "wb");
+#if defined(_WIN32)
+ if( doFsync ) zMode = "wbc";
+#endif
+ out = fopen(zName, zMode);
if( out==0 ){
fatalError("Cannot open \"%s\" for writing\n", zName);
}
nWritten = fwrite(pBuf, 1, (size_t)sz, out);
+ if( doFsync ){
+#if defined(_WIN32)
+ fflush(out);
+#else
+ fsync(fileno(out));
+#endif
+ }
fclose(out);
if( nWritten!=(size_t)sz ){
fatalError("Wrote only %d of %d bytes to \"%s\"\n",
int isUpdateTest = 0; /* Do in-place updates rather than reads */
int doIntegrityCk = 0; /* Run PRAGMA integrity_check after the test */
int noSync = 0; /* Disable synchronous mode */
+ int doFsync = 0; /* Update disk files synchronously */
sqlite3 *db = 0; /* Database connection */
sqlite3_stmt *pStmt = 0; /* Prepared statement for SQL access */
sqlite3_blob *pBlob = 0; /* Handle for incremental Blob I/O */
noSync = 1;
continue;
}
+ if( strcmp(z, "-fsync")==0 ){
+ doFsync = 1;
+ continue;
+ }
fatalError("unknown option: \"%s\"", argv[i]);
}
if( eType==PATH_DB ){
zKey = sqlite3_mprintf("%s/%06d", zDb, iKey);
nData = 0;
if( isUpdateTest ){
- updateFile(zKey, &nData);
+ updateFile(zKey, &nData, doFsync);
}else{
pData = readFile(zKey, &nData);
sqlite3_free(pData);