aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordrh <drh@noemail.net>2013-10-10 15:04:52 +0000
committerdrh <drh@noemail.net>2013-10-10 15:04:52 +0000
commita0cbd3fd176bf325b325ed4e0f6b8c2f678a9873 (patch)
tree51692206f77fa5aad220d62f8cea3d819bb92359
parent919e3b39089e3a946874451ca307d55bdfde79b1 (diff)
downloadsqlite-a0cbd3fd176bf325b325ed4e0f6b8c2f678a9873.tar.gz
sqlite-a0cbd3fd176bf325b325ed4e0f6b8c2f678a9873.zip
Enhancements to the vfslog.c module to show all change-counter changes and
to show the hostname and pid of the process that creates each log file. FossilOrigin-Name: af7abebeb1f70466833bc766d294d721eaef746f
-rw-r--r--ext/misc/vfslog.c36
-rw-r--r--manifest12
-rw-r--r--manifest.uuid2
3 files changed, 41 insertions, 9 deletions
diff --git a/ext/misc/vfslog.c b/ext/misc/vfslog.c
index 8136dadad..2f7c492f8 100644
--- a/ext/misc/vfslog.c
+++ b/ext/misc/vfslog.c
@@ -239,6 +239,7 @@ static VLogLog *vlogLogOpen(const char *zFilename){
int isJournal = 0;
sqlite3_mutex *pMutex;
VLogLog *pLog, *pTemp;
+ sqlite3_int64 tNow = 0;
if( nName>4 && strcmp(zFilename+nName-4,"-wal")==0 ){
return 0; /* Do not log wal files */
}else
@@ -263,8 +264,9 @@ static VLogLog *vlogLogOpen(const char *zFilename){
pTemp = 0;
memset(pLog, 0, sizeof(*pLog)*2);
pLog->zFilename = (char*)&pLog[2];
+ tNow = vlog_time();
sqlite3_snprintf(nName+60, pLog->zFilename, "%.*s-debuglog-%lld",
- nName, zFilename, vlog_time());
+ nName, zFilename, tNow);
pLog->out = fopen(pLog->zFilename, "a");
if( pLog->out==0 ){
sqlite3_mutex_leave(pMutex);
@@ -279,7 +281,15 @@ static VLogLog *vlogLogOpen(const char *zFilename){
allLogs = pLog;
}
sqlite3_mutex_leave(pMutex);
- sqlite3_free(pTemp);
+ if( pTemp ){
+ sqlite3_free(pTemp);
+ }else{
+ char zHost[200];
+ zHost[0] = 0;
+ gethostname(zHost, sizeof(zHost)-1);
+ zHost[sizeof(zHost)-1] = 0;
+ vlogLogPrint(pLog, tNow, 0, "IDENT", getpid(), -1, zHost, 0);
+ }
if( pLog && isJournal ) pLog++;
pLog->nRef++;
return pLog;
@@ -354,6 +364,17 @@ static int vlogRead(
zSig[0] = 0;
}
vlogLogPrint(p->pLog, tStart, tElapse, "READ", iAmt, iOfst, zSig, rc);
+ if( rc==SQLITE_OK
+ && p->pLog
+ && p->pLog->zFilename
+ && iOfst<=24
+ && 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);
+ }
return rc;
}
@@ -376,6 +397,17 @@ static int vlogWrite(
rc = p->pReal->pMethods->xWrite(p->pReal, z, iAmt, iOfst);
tElapse = vlog_time() - tStart;
vlogLogPrint(p->pLog, tStart, tElapse, "WRITE", iAmt, iOfst, zSig, rc);
+ if( rc==SQLITE_OK
+ && p->pLog
+ && p->pLog->zFilename
+ && iOfst<=24
+ && 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);
+ }
return rc;
}
diff --git a/manifest b/manifest
index 7ddb1370b..06c2913fb 100644
--- a/manifest
+++ b/manifest
@@ -1,5 +1,5 @@
-C Another\sfix\sto\sthe\shash\ssignature\salgorithm\sin\svfslog.c.
-D 2013-10-10T13:41:04.179
+C Enhancements\sto\sthe\svfslog.c\smodule\sto\sshow\sall\schange-counter\schanges\sand\nto\sshow\sthe\shostname\sand\spid\sof\sthe\sprocess\sthat\screates\seach\slog\sfile.
+D 2013-10-10T15:04:52.276
F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f
F Makefile.in 5e41da95d92656a5004b03d3576e8b226858a28e
F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23
@@ -115,7 +115,7 @@ F ext/misc/percentile.c bcbee3c061b884eccb80e21651daaae8e1e43c63
F ext/misc/regexp.c af92cdaa5058fcec1451e49becc7ba44dba023dc
F ext/misc/rot13.c 1ac6f95f99b575907b9b09c81a349114cf9be45a
F ext/misc/spellfix.c 5e1d547e9a2aed13897fa91bac924333f62fd2d9
-F ext/misc/vfslog.c efd4f0b2205f8ae19096b8938551bc55ba7967cc
+F ext/misc/vfslog.c e8a9e57c9e9bb2c4f730d04ada96722dffcc85ee
F ext/misc/vtshim.c babb0dc2bf116029e3e7c9a618b8a1377045303e
F ext/misc/wholenumber.c 784b12543d60702ebdd47da936e278aa03076212
F ext/rtree/README 6315c0d73ebf0ec40dedb5aa0e942bc8b54e3761
@@ -1123,7 +1123,7 @@ F tool/vdbe-compress.tcl f12c884766bd14277f4fcedcae07078011717381
F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4
F tool/warnings.sh fbc018d67fd7395f440c28f33ef0f94420226381
F tool/win/sqlite.vsix 030f3eeaf2cb811a3692ab9c14d021a75ce41fff
-P eaf4de13a63b2294ae575432a022493308a4313a
-R 7399da52f6ed2debec27f345b5bf4b89
+P 34212aa8c405c4ff3f8045ec0cf2a860af61540f
+R b760173a3ecf9c2e139461e082dfd224
U drh
-Z 0fe8f99aa362e7a957a710b2ebcec893
+Z 4eb419de266c4e94ef4c36fe5d3bf998
diff --git a/manifest.uuid b/manifest.uuid
index 5de9c156d..1d5f15330 100644
--- a/manifest.uuid
+++ b/manifest.uuid
@@ -1 +1 @@
-34212aa8c405c4ff3f8045ec0cf2a860af61540f \ No newline at end of file
+af7abebeb1f70466833bc766d294d721eaef746f \ No newline at end of file