]> git.ipfire.org Git - thirdparty/sqlite.git/commitdiff
Further enhance the vfslog extension to record the number of freelist pages
authordrh <drh@noemail.net>
Fri, 18 Oct 2013 17:42:35 +0000 (17:42 +0000)
committerdrh <drh@noemail.net>
Fri, 18 Oct 2013 17:42:35 +0000 (17:42 +0000)
and the first freelist page in CHNGCTR-READ and CHNGCTR-WRITE records.

FossilOrigin-Name: 08157524ca816a81f3c341097e23982727eaa125

ext/misc/vfslog.c
manifest
manifest.uuid

index 7b2f99bc51e51dcfc7d42bb6dd6a689f3ab0c2a8..3e4fed6147d51efe041fb366b96fd550c3342af4 100644 (file)
@@ -346,6 +346,13 @@ static void vlogSignature(unsigned char *p, int n, char *zCksum){
   }
 }
 
+/*
+** Convert a big-endian 32-bit integer into a native integer
+*/
+static int bigToNative(const unsigned char *x){
+  return (x[0]<<24) + (x[1]<<16) + (x[2]<<8) + x[3];
+}
+
 /*
 ** Read data from an vlog-file.
 */
@@ -376,9 +383,16 @@ static int vlogRead(
    && iOfst+iAmt>=28
   ){
     unsigned char *x = ((unsigned char*)zBuf)+(24-iOfst);
-    unsigned iCtr;
-    iCtr = (x[0]<<24) + (x[1]<<16) + (x[2]<<8) + x[3];
-    vlogLogPrint(p->pLog, tStart, 0, "CHNGCTR-READ", iCtr, -1, 0, 0);
+    unsigned iCtr, nFree = -1;
+    char *zFree = 0;
+    char zStr[12];
+    iCtr = bigToNative(x);
+    if( iOfst+iAmt>=40 ){
+      zFree = zStr;
+      sqlite3_snprintf(sizeof(zStr), zStr, "%d", bigToNative(x+8));
+      nFree = bigToNative(x+12);
+    }
+    vlogLogPrint(p->pLog, tStart, 0, "CHNGCTR-READ", iCtr, nFree, zFree, 0);
   }
   return rc;
 }
@@ -409,9 +423,16 @@ static int vlogWrite(
    && iOfst+iAmt>=28
   ){
     unsigned char *x = ((unsigned char*)z)+(24-iOfst);
-    unsigned iCtr;
-    iCtr = (x[0]<<24) + (x[1]<<16) + (x[2]<<8) + x[3];
-    vlogLogPrint(p->pLog, tStart, 0, "CHNGCTR-WRITE", iCtr, -1, 0, 0);
+    unsigned iCtr, nFree = -1;
+    char *zFree = 0;
+    char zStr[12];
+    iCtr = bigToNative(x);
+    if( iOfst+iAmt>=40 ){
+      zFree = zStr;
+      sqlite3_snprintf(sizeof(zStr), zStr, "%d", bigToNative(x+8));
+      nFree = bigToNative(x+12);
+    }
+    vlogLogPrint(p->pLog, tStart, 0, "CHNGCTR-WRITE", iCtr, nFree, zFree, 0);
   }
   return rc;
 }
index d971ccd89b237e8bc23fc32d4ce46d4b000a02fa..7849a01980ca00d0f73303b2bce773ffffa6a134 100644 (file)
--- a/manifest
+++ b/manifest
@@ -1,5 +1,5 @@
-C In\sthe\svfslog\sextension\sfor\sFILECONTROL\srecords,\sshow\sthe\spragma\sname\sfor\nSQLITE_FCNTL_PRAGMAs\sand\sthe\srequested\ssize\sfor\sSQLITE_FCNTL_SIZE_HINT.
-D 2013-10-18T14:37:26.422
+C Further\senhance\sthe\svfslog\sextension\sto\srecord\sthe\snumber\sof\sfreelist\spages\nand\sthe\sfirst\sfreelist\spage\sin\sCHNGCTR-READ\sand\sCHNGCTR-WRITE\srecords.
+D 2013-10-18T17:42:35.202
 F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f
 F Makefile.in 0522b53cdc1fcfc18f3a98e0246add129136c654
 F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23
@@ -116,7 +116,7 @@ F ext/misc/regexp.c af92cdaa5058fcec1451e49becc7ba44dba023dc
 F ext/misc/rot13.c 1ac6f95f99b575907b9b09c81a349114cf9be45a
 F ext/misc/spellfix.c 5e1d547e9a2aed13897fa91bac924333f62fd2d9
 F ext/misc/totype.c 4a167594e791abeed95e0a8db028822b5e8fe512
-F ext/misc/vfslog.c f3288d66e699fee093497d449996c69eef1c0354
+F ext/misc/vfslog.c b11228f567ddd251706ece5f1bb7bdc218eec825
 F ext/misc/vtshim.c babb0dc2bf116029e3e7c9a618b8a1377045303e
 F ext/misc/wholenumber.c 784b12543d60702ebdd47da936e278aa03076212
 F ext/rtree/README 6315c0d73ebf0ec40dedb5aa0e942bc8b54e3761
@@ -1126,7 +1126,7 @@ F tool/vdbe-compress.tcl f12c884766bd14277f4fcedcae07078011717381
 F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4
 F tool/warnings.sh d1a6de74685f360ab718efda6265994b99bbea01
 F tool/win/sqlite.vsix 030f3eeaf2cb811a3692ab9c14d021a75ce41fff
-P c78be6d786c19073b3a6730dfe3fb1be54f5657a
-R 922e3640e2dff0c501dabe2407303992
+P f062969548da26850ceeb48d4283f6567f828887
+R 5457e72ad1d4f1c29d635ec2528114d5
 U drh
-Z 20507bcad5bb086518e04051643ef0df
+Z e59d2038662ec722e3001c7ec97e56fb
index a44be59dfcc70a5e8c3b0f99a62bfea01a1a786d..6b389e75e725e8562e2e539026336bc14deb44ba 100644 (file)
@@ -1 +1 @@
-f062969548da26850ceeb48d4283f6567f828887
\ No newline at end of file
+08157524ca816a81f3c341097e23982727eaa125
\ No newline at end of file