From 340e9e125b144e6ef5ccda27a53f9a03c7907362 Mon Sep 17 00:00:00 2001 From: dan Date: Fri, 20 Apr 2018 20:37:25 +0000 Subject: [PATCH] Enhance the "rbu" command line utility a bit. FossilOrigin-Name: 61eb516f83d1a7fe44f72bebe2a2745ab904a02e06e38fb6d932348c49607976 --- ext/rbu/rbu.c | 46 +++++++++++++++++++++++++++++++++++++++++++--- manifest | 14 +++++++------- manifest.uuid | 2 +- 3 files changed, 51 insertions(+), 11 deletions(-) diff --git a/ext/rbu/rbu.c b/ext/rbu/rbu.c index be5c72413d..1dac452305 100644 --- a/ext/rbu/rbu.c +++ b/ext/rbu/rbu.c @@ -29,7 +29,9 @@ void usage(const char *zArgv0){ "Where options are:\n" "\n" " -step NSTEP\n" +" -statstep NSTATSTEP\n" " -vacuum\n" +" -presql SQL\n" "\n" " If the -vacuum switch is not present, argument RBU-DB must be an RBU\n" " database containing an update suitable for target database TARGET-DB.\n" @@ -79,7 +81,9 @@ int main(int argc, char **argv){ char *zErrmsg; /* Error message, if any */ sqlite3rbu *pRbu; /* RBU handle */ int nStep = 0; /* Maximum number of step() calls */ + int nStatStep = 0; /* Report stats after this many step calls */ int bVacuum = 0; + const char *zPreSql = 0; int rc; sqlite3_int64 nProgress = 0; int nArgc = argc-2; @@ -90,9 +94,18 @@ int main(int argc, char **argv){ int nArg = strlen(zArg); if( nArg>1 && nArg<=8 && 0==memcmp(zArg, "-vacuum", nArg) ){ bVacuum = 1; + }else if( nArg>1 && nArg<=7 + && 0==memcmp(zArg, "-presql", nArg) && i1 && nArg<=5 && 0==memcmp(zArg, "-step", nArg) && i1 && nArg<=9 + && 0==memcmp(zArg, "-statstep", nArg) && i0 && (i % nStatStep)==0 ){ + sqlite3_int64 nUsed; + sqlite3_int64 nHighwater; + sqlite3_status64(SQLITE_STATUS_MEMORY_USED, &nUsed, &nHighwater, 0); + fprintf(stdout, "memory used=%lld highwater=%lld", nUsed, nHighwater); + if( bVacuum==0 ){ + int one; + int two; + sqlite3rbu_bp_progress(pRbu, &one, &two); + fprintf(stdout, " progress=%d/%d\n", one, two); + }else{ + fprintf(stdout, "\n"); + } + fflush(stdout); + } + } + nProgress = sqlite3rbu_progress(pRbu); + rc = sqlite3rbu_close(pRbu, &zErrmsg); + } /* Let the user know what happened. */ switch( rc ){ diff --git a/manifest b/manifest index b38c494186..d8bd5a6a8e 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Fix\sa\sharmless\scompiler\swarning. -D 2018-04-20T20:09:22.155 +C Enhance\sthe\s"rbu"\scommand\sline\sutility\sa\sbit. +D 2018-04-20T20:37:25.557 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F Makefile.in 5ce9343cba9c189046f1afe6d2bcc1f68079439febc05267b98aec6ecc752439 @@ -307,7 +307,7 @@ F ext/misc/vtshim.c 1976e6dd68dd0d64508c91a6dfab8e75f8aaf6cd F ext/misc/wholenumber.c 784b12543d60702ebdd47da936e278aa03076212 F ext/misc/zipfile.c c4de8f0ad446ce4a49aae11ff7b771cd7af60d7136c0bcfb53da1475b9075e79 F ext/misc/zorder.c b0ff58fa643afa1d846786d51ea8d5c4b6b35aa0254ab5a82617db92f3adda64 -F ext/rbu/rbu.c ea7d1b7eb44c123a2a619332e19fe5313500705c4a58aaa1887905c0d83ffc2e +F ext/rbu/rbu.c 4ae41f01d78dfae2204a63bcf39d5eb3548d039b094c29eec9a8d6683a66a5d3 F ext/rbu/rbu1.test 43836fac8c7179a358eaf38a8a1ef3d6e6285842 F ext/rbu/rbu10.test 1846519a438697f45e9dcb246908af81b551c29e1078d0304fae83f1fed7e9ee F ext/rbu/rbu11.test 9bc68c2d3dbeb1720153626e3bd0466dcc017702 @@ -1724,7 +1724,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 20bf5800808ea02b2aa4bf01a380926784c0e7514a2c73ca303cac1f5c732ae0 -R c4d0464d41166a1353ad8fa1877326ad -U drh -Z 2c474dfea923266db5087d809c736452 +P d2ab24f59d92527fe503fa7dc2128078fbc4dd2d2c1148effa9ea1957ab19940 +R 0a01952ab5e7062b6ef99418ce0e1189 +U dan +Z 04ee3d5e6c96c9d55fb19cc03ce1ab7e diff --git a/manifest.uuid b/manifest.uuid index 07db5ea041..84aab461c1 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -d2ab24f59d92527fe503fa7dc2128078fbc4dd2d2c1148effa9ea1957ab19940 \ No newline at end of file +61eb516f83d1a7fe44f72bebe2a2745ab904a02e06e38fb6d932348c49607976 \ No newline at end of file