diff --git a/ext/misc/tmstmpvfs.c b/ext/misc/tmstmpvfs.c index 6f1af36f74..b39d01e65d 100644 --- a/ext/misc/tmstmpvfs.c +++ b/ext/misc/tmstmpvfs.c @@ -11,7 +11,7 @@ ****************************************************************************** ** ** This file implements a VFS shim that writes a timestamp and other tracing -** information into 16 byts of reserved space at the end of each page of the +** information into 16 bytes of reserved space at the end of each page of the ** database file. ** ** The VFS also tries to generate log-files with names of the form: @@ -180,12 +180,13 @@ ** ** ELOG_WAL_PAGE "New page added to the WAL file" ** op = 0x03 -** a1 = 1 if last page of a txn. 0 otherwise. +** a1 = 0x1 set if last page of txn. 0x2 if all zeros ** a2 = page number in the DB file ** a3 = frame number in the WAL file ** ** ELOG_DB_PAGE "Database page updated using rollback mode" ** op = 0x04 +** a1 = 0x2 set if all zeros ** a2 = page number in the DB file ** ** ELOG_CKPT_START "Start of a checkpoint operation" @@ -193,6 +194,7 @@ ** ** ELOG_CKPT_PAGE "Page xfer from WAL to database" ** op = 0x06 +** a1 = 0x2 set if all zeros ** a2 = database page number ** a3 = frame number in the WAL file ** @@ -601,6 +603,17 @@ static int tmstmpRead( return rc; } +/* +** Return 0x02 if all bytes of zBuf are zero. Return 0x00 if one +** or more bytes are non-zero. +*/ +static u8 tmstmpAllZero(const void *zBuf, int n){ + const u8 *a = (const u8*)zBuf; + int i; + for(i=0; iiOfst = iOfst; }else if( iAmt>=512 && iOfst==p->iOfst+24 ){ unsigned char s[TMSTMP_RESERVE]; + u8 a1 = tmstmpAllZero(zBuf,iAmt-TMSTMP_RESERVE); memset(s, 0, TMSTMP_RESERVE); tmstmpPutTS(p, s+2); - tmstmpEvent(p, ELOG_WAL_PAGE, p->isCommit, p->pgno, p->iFrame, s+2); + tmstmpEvent(p, ELOG_WAL_PAGE, p->isCommit|a1, p->pgno, p->iFrame, s+2); }else if( iAmt==32 && iOfst==0 ){ p->salt1 = tmstmpGetU32(((const u8*)zBuf)+16); tmstmpEvent(p, ELOG_WAL_RESET, 0, 0, p->salt1, 0); } }else if( p->inCkpt ){ unsigned char *s = (unsigned char*)zBuf+iAmt-TMSTMP_RESERVE; + u8 a1 = tmstmpAllZero(zBuf,iAmt-TMSTMP_RESERVE); memset(s, 0, TMSTMP_RESERVE); tmstmpPutTS(p, s+2); tmstmpPutU32(p->iFrame, s+8); tmstmpPutU32(p->pPartner->salt1 & 0xffffff, s+12); assert( p->pgsz>0 ); - tmstmpEvent(p, ELOG_CKPT_PAGE, 0, (iOfst/p->pgsz)+1, p->iFrame, 0); + tmstmpEvent(p, ELOG_CKPT_PAGE, a1, (iOfst/p->pgsz)+1, p->iFrame, 0); }else if( p->pPartner==0 ){ /* Writing into a database in rollback mode */ unsigned char *s = (unsigned char*)zBuf+iAmt-TMSTMP_RESERVE; + u8 a1 = tmstmpAllZero(zBuf,iAmt-TMSTMP_RESERVE); memset(s, 0, TMSTMP_RESERVE); tmstmpPutTS(p, s+2); s[12] = 2; assert( p->pgsz>0 ); - tmstmpEvent(p, ELOG_DB_PAGE, 0, (u32)(iOfst/p->pgsz)+1, 0, s+2); + tmstmpEvent(p, ELOG_DB_PAGE, a1, (u32)(iOfst/p->pgsz)+1, 0, s+2); } return pSub->pMethods->xWrite(pSub,zBuf,iAmt,iOfst); } diff --git a/manifest b/manifest index 1f5eaa239e..b824f534d2 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Improved\shandling\sof\sOOM\sconditions\sin\sthe\ssessions\sextension.\n[bugs:/info/2026-08-25T17:04:14Z|Bug\s2026-08-25T17:04:14Z]. -D 2026-08-25T18:40:50.288 +C Enhance\sthe\stmstmpvfs.c\sextension\sso\sthat\sit\stags\szero\spages\sin\sthe\slog\sfile. +D 2026-08-26T12:31:34.750 F .fossil-settings/binary-glob 61195414528fb3ea9693577e1980230d78a1f8b0a54c78cf1b9b24d0a409ed6a x F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea @@ -408,7 +408,7 @@ F ext/misc/stmt.c b090086cd6bd6281c21271d38d576eeffe662f0e6b67536352ce32bbaa4383 F ext/misc/stmtrand.c 1c7c6a478e9c808d53a2efa9a744c86c265b6b95b4a96964e1b960c7c642ad49 F ext/misc/strdup.c 028ea3097c7b6bb8cb9f0b7e656e9bafe6c46db76123e9ad86fb3efda629b568 F ext/misc/templatevtab.c e76d4cdb73f986c8165c0fe7831f1a94da55d4f1eafcb7d377e1b0b79ee8679a -F ext/misc/tmstmpvfs.c 240caad4441328dc52bd2871f48811db46dff858d5598030e389176837a2f4df +F ext/misc/tmstmpvfs.c 8fe8b10e0ac7c46faf491811e21dcb67ccde5cff8f133701121f793d2a7d41e4 F ext/misc/totype.c ba11aac3c0b52c685bd25aa4e0f80c41c624fb1cc5ab763250e09ddc762bc3a8 F ext/misc/uint.c 327afc166058acf566f33a15bf47c869d2d3564612644d9ff81a23efc8b36039 F ext/misc/unionvtab.c fe1011f185408b0afd1631fdce8090c4e69ff4eae10a760101e08b624f53bcb1 @@ -2192,7 +2192,7 @@ F tool/showjournal.c 5bad7ae8784a43d2b270d953060423b8bd480818 F tool/showlocks.c 9cc5e66d4ebbf2d194f39db2527ece92077e86ae627ddd233ee48e16e8142564 F tool/showshm.c a0ab6ec32dd1f11218ca2a4018f8fb875b59414801ab8ceed8b2e69b7b45a809 F tool/showstat4.c b706fcbc4cd1a6e4a73ac32549afc4b460479d650402d64b23e8d813516e8de4 -F tool/showtmlog.c 2e9da6c4b4767113a0ad5ddabd4337ea100d38ff9c7fee260f9ccdefb2ffdc23 +F tool/showtmlog.c 86b2dcb722f2c23f0fb59800c086913561428b4be700b7236480f6a9a3726e4a F tool/showwal.c 11eca547980a066b081f512636151233350ac679f29ecf4ebfce7f4530230b3d F tool/soak1.tcl a3892082ed1079671565c044e93b55c3c7f38829aedf53cc597c65d23ffdaddf F tool/spaceanal.tcl 1f83962090a6b60e1d7bf92495d643e622bef9fe82ea3f2d22350dcbce9a12d0 @@ -2219,8 +2219,8 @@ F tool/warnings-clang.sh bbf6a1e685e534c92ec2bfba5b1745f34fb6f0bc2a362850723a9ee F tool/warnings.sh a554d13f6e5cf3760f041b87939e3d616ec6961859c3245e8ef701d1eafc2ca2 F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f F tool/winmain.c 00c8fb88e365c9017db14c73d3c78af62194d9644feaf60e220ab0f411f3604c -P 08b34b1656b7dec2328345bb8ea93d75193703aaff52546fc17844b7110b2741 -R 903486fe44ab30495ec0c438ae6f872d +P ce2aa9f8495edfa361220c4702a54035e9df78984ce6c9fff40e04bd45cc3393 +R f7ef5c62909643d5337acbde4db70895 U drh -Z 80938bf97b7cdc45995ac8caba2302af +Z 3bc7da1960aa01e911e5d014c47c686b # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index cb612cd3b7..13e16a3a49 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -ce2aa9f8495edfa361220c4702a54035e9df78984ce6c9fff40e04bd45cc3393 +e9d649b77b14990cdc5440e08fdace6989737f3fd1acfc8b1c1bb72be7022ec0 diff --git a/tool/showtmlog.c b/tool/showtmlog.c index 4c35b777be..034777d16e 100644 --- a/tool/showtmlog.c +++ b/tool/showtmlog.c @@ -80,47 +80,47 @@ static void renderCSV(int iFile, unsigned char *a){ for(a3=0, j=12; j<=15; j++) a3 = (a3<<8)+a[j]; switch( a[0] ){ case 0x01: { - printf("\"open-db\",%u,,,,\r\n",a2); + printf("\"open-db\",%u,,,,,0\r\n",a2); break; } case 0x02: { - printf("\"open-wal\",%u,,,,\r\n", a2); + printf("\"open-wal\",%u,,,,,0\r\n", a2); break; } case 0x03: { - printf("\"wal-page\",,%u,%u,,%d\r\n", a2, a3, a[1]); + printf("\"wal-page\",,%u,%u,,%d,%d\r\n", a2, a3, a[1]&1, (a[1]>>1)&1); break; } case 0x04: { - printf("\"db-page\",,%u,,,\r\n", a2); + printf("\"db-page\",,%u,,,,%d\r\n", a2,(a[1]>>1)&1); break; } case 0x05: { - printf("\"ckpt-start\",,,,,\r\n"); + printf("\"ckpt-start\",,,,,,0\r\n"); break; } case 0x06: { - printf("\"ckpt-page\",,%u,%u,,\r\n", a2, a3); + printf("\"ckpt-page\",,%u,%u,,%d\r\n", a2, a3, (a[1]>>1)&1); break; } case 0x07: { - printf("\"ckpt-end\",,,,,\r\n"); + printf("\"ckpt-end\",,,,,,0\r\n"); break; } case 0x08: { - printf("\"wal-reset\",,,,%u,\r\n", a3); + printf("\"wal-reset\",,,,%u,,0\r\n", a3); break; } case 0x0e: { - printf("\"close-wal\",,,,,\r\n"); + printf("\"close-wal\",,,,,,0\r\n"); break; } case 0x0f: { - printf("\"close-db\",,,,,\r\n"); + printf("\"close-db\",,,,,,0\r\n"); break; } default: { - printf("\"invalid-record\",,,,,\r\n"); + printf("\"invalid-record\",,,,,,0\r\n"); break; } } @@ -147,12 +147,12 @@ static void renderText(unsigned char *a){ break; } case 0x03: { - printf("wal-page pgno %-8u frame %-8u%s\n", a2, a3, - a[1]==1 ? " txn" : ""); + static const char *za1[4] = { "", " txn", " zero", " txn zero" }; + printf("wal-page pgno %-8u frame %-8u%s\n", a2, a3, za1[a[1]&3]); break; } case 0x04: { - printf("db-page pgno %-8u\n", a2); + printf("db-page pgno %-8u%s\n", a2, (a[1]&2)!=0 ? " zero" : ""); break; } case 0x05: { @@ -160,7 +160,8 @@ static void renderText(unsigned char *a){ break; } case 0x06: { - printf("ckpt-page pgno %-8u frame %-8u\n", a2, a3); + printf("ckpt-page pgno %-8u frame %-8u%s\n", a2, a3, + (a[1]&2)!=0 ? " zero" : ""); break; } case 0x07: { @@ -227,7 +228,7 @@ int main(int argc, char **argv){ } iFile = 0; if( bCSV ){ - printf("tmstmp,fileno,op,pid,pgno,frame,salt,txn\r\n"); + printf("tmstmp,fileno,op,pid,pgno,frame,salt,txn,zero\r\n"); } for(i=1; i