Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
Comment: | 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. |
---|---|
Downloads: | Tarball | ZIP archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA1: |
af7abebeb1f70466833bc766d294d721 |
User & Date: | drh 2013-10-10 15:04:52.276 |
Context
2013-10-10
| ||
17:33 | Add a rule to the main.mk makefile for building showdb. (check-in: fc5552da0d user: drh tags: trunk) | |
15:04 | 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. (check-in: af7abebeb1 user: drh tags: trunk) | |
13:41 | Another fix to the hash signature algorithm in vfslog.c. (check-in: 34212aa8c4 user: drh tags: trunk) | |
Changes
Changes to ext/misc/vfslog.c.
︙ | ︙ | |||
235 236 237 238 239 240 241 242 243 244 245 246 247 248 | ** Open a VLogLog object on the given file */ static VLogLog *vlogLogOpen(const char *zFilename){ int nName = (int)strlen(zFilename); int isJournal = 0; sqlite3_mutex *pMutex; VLogLog *pLog, *pTemp; if( nName>4 && strcmp(zFilename+nName-4,"-wal")==0 ){ return 0; /* Do not log wal files */ }else if( nName>8 && strcmp(zFilename+nName-8,"-journal")==0 ){ nName -= 8; isJournal = 1; }else if( nName>12 | > | 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 | ** Open a VLogLog object on the given file */ static VLogLog *vlogLogOpen(const char *zFilename){ int nName = (int)strlen(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 if( nName>8 && strcmp(zFilename+nName-8,"-journal")==0 ){ nName -= 8; isJournal = 1; }else if( nName>12 |
︙ | ︙ | |||
259 260 261 262 263 264 265 266 | } } if( pLog==0 ){ pLog = pTemp; pTemp = 0; memset(pLog, 0, sizeof(*pLog)*2); pLog->zFilename = (char*)&pLog[2]; sqlite3_snprintf(nName+60, pLog->zFilename, "%.*s-debuglog-%lld", | > | > | > > > > > > > | 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 | } } if( pLog==0 ){ pLog = pTemp; 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, tNow); pLog->out = fopen(pLog->zFilename, "a"); if( pLog->out==0 ){ sqlite3_mutex_leave(pMutex); sqlite3_free(pLog); return 0; } pLog->nFilename = nName; pLog[1].out = pLog[0].out; pLog->ppPrev = &allLogs; if( allLogs ) allLogs->ppPrev = &pLog->pNext; pLog->pNext = allLogs; allLogs = pLog; } sqlite3_mutex_leave(pMutex); 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; } /* |
︙ | ︙ | |||
350 351 352 353 354 355 356 357 358 359 360 361 362 363 | tElapse = vlog_time() - tStart; if( rc==SQLITE_OK ){ vlogSignature(zBuf, iAmt, zSig); }else{ zSig[0] = 0; } vlogLogPrint(p->pLog, tStart, tElapse, "READ", iAmt, iOfst, zSig, rc); return rc; } /* ** Write data to an vlog-file. */ static int vlogWrite( | > > > > > > > > > > > | 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 | tElapse = vlog_time() - tStart; if( rc==SQLITE_OK ){ vlogSignature(zBuf, iAmt, zSig); }else{ 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; } /* ** Write data to an vlog-file. */ static int vlogWrite( |
︙ | ︙ | |||
372 373 374 375 376 377 378 379 380 381 382 383 384 385 | char zSig[40]; tStart = vlog_time(); vlogSignature((unsigned char*)z, iAmt, zSig); rc = p->pReal->pMethods->xWrite(p->pReal, z, iAmt, iOfst); tElapse = vlog_time() - tStart; vlogLogPrint(p->pLog, tStart, tElapse, "WRITE", iAmt, iOfst, zSig, rc); return rc; } /* ** Truncate an vlog-file. */ static int vlogTruncate(sqlite3_file *pFile, sqlite_int64 size){ | > > > > > > > > > > > | 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 | char zSig[40]; tStart = vlog_time(); vlogSignature((unsigned char*)z, iAmt, zSig); 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; } /* ** Truncate an vlog-file. */ static int vlogTruncate(sqlite3_file *pFile, sqlite_int64 size){ |
︙ | ︙ |