From 65705581f6baba7c1a6d3f8795121f618d712b76 Mon Sep 17 00:00:00 2001 From: dan Date: Thu, 31 Oct 2024 15:40:48 +0000 Subject: [PATCH] Update this branch so that it works with ZipVFS. FossilOrigin-Name: bc71b0a0b3ca7506efa5e700bb23968d4ed2d82b8f1ce04a6bdcad7b7edc56b0 --- manifest | 12 ++++++------ manifest.uuid | 2 +- src/pager.c | 19 +++++++++++++++++-- 3 files changed, 24 insertions(+), 9 deletions(-) diff --git a/manifest b/manifest index b1009e6fad..b5069c436c 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Require\sthe\sSQLITE_ENABLE_READONLY_WALJOURNAL\spre-processor\smacro\sto\sactivate\sthe\snew\sfeature\son\sthis\sbranch. -D 2024-10-30T13:47:08.825 +C Update\sthis\sbranch\sso\sthat\sit\sworks\swith\sZipVFS. +D 2024-10-31T15:40:48.953 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md c5b4009dca54d127d2d6033c22fd9cc34f53bedb6ef12c7cbaa468381c74ab28 @@ -763,7 +763,7 @@ F src/os_setup.h 6011ad7af5db4e05155f385eb3a9b4470688de6f65d6166b8956e58a3d87210 F src/os_unix.c 0ad4e0885294b3a0e135a18533590ec9ad91ffe82f6a08e55b40babd51772928 F src/os_win.c 69fa1aaff68270423c85cff4327ba17ef99a1eb017e1a2bfb97416d9b8398b05 F src/os_win.h 7b073010f1451abe501be30d12f6bc599824944a -F src/pager.c 9aae5bb8a2bcd5a6347cc2548e7df428a0108b6c52834876ebe12900e5158c47 +F src/pager.c ab7704b78c764cc89f477a0c10e53eb3fee8acc1d1306807354c626513c71a4a F src/pager.h 4b1140d691860de0be1347474c51fee07d5420bd7f802d38cbab8ea4ab9f538a F src/parse.y a7a8d42eeff01d267444ddb476029b0b1726fb70ae3d77984140f17ad02e2d61 F src/pcache.c 588cc3c5ccaaadde689ed35ce5c5c891a1f7b1f4d1f56f6cf0143b74d8ee6484 @@ -2200,8 +2200,8 @@ F tool/version-info.c 3b36468a90faf1bbd59c65fd0eb66522d9f941eedd364fabccd7227350 F tool/warnings-clang.sh bbf6a1e685e534c92ec2bfba5b1745f34fb6f0bc2a362850723a9ee87c1b31a7 F tool/warnings.sh 49a486c5069de041aedcbde4de178293e0463ae9918ecad7539eedf0ec77a139 F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f -P 403e01b03c31349425fa2831285b5e8e2665d5779548b4ce581cbd781c4c61d9 -R 71b15b831df2ffd1de74e20e698836da +P 21ed4e78863f2622d756d2f5e0e951f3c4a992913cd1e459b2366cb5bab0153c +R 6536ae78f7e523900ac50624af3ed7f0 U dan -Z e413f4c8a6f0450a7402fd29f4aa9d38 +Z 12857df85a2cc4f53a4fcddbd4d7dc73 # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index f874e68e06..54dfcf9119 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -21ed4e78863f2622d756d2f5e0e951f3c4a992913cd1e459b2366cb5bab0153c +bc71b0a0b3ca7506efa5e700bb23968d4ed2d82b8f1ce04a6bdcad7b7edc56b0 diff --git a/src/pager.c b/src/pager.c index 56f3802214..b25eed6074 100644 --- a/src/pager.c +++ b/src/pager.c @@ -5098,11 +5098,23 @@ static int getPageOneNoWal( int rc = SQLITE_OK; assert( pgno==1 ); + assert( pPager->readOnly ); + assert( !isOpen(pPager->jfd) ); + rc = getPageNormal(pPager, pgno, ppPage, flags); if( rc==SQLITE_OK ){ + int f = SQLITE_OPEN_READONLY|SQLITE_OPEN_MAIN_JOURNAL; u8 *aPg = (u8*)(*ppPage)->pData; - aPg[18] = 1; - aPg[19] = 1; + u8 aHdr[28]; + rc = sqlite3OsOpen(pPager->pVfs, pPager->zJournal, pPager->jfd, f, &f); + if( rc==SQLITE_OK ){ + rc = sqlite3OsRead(pPager->jfd, (void*)aHdr, sizeof(aHdr), 0); + } + if( rc==SQLITE_OK ){ + u32 off = sqlite3Get4byte(&aHdr[20]); + rc = sqlite3OsRead(pPager->jfd, (void*)aPg, pPager->pageSize, off+4); + } + sqlite3OsClose(pPager->jfd); } setGetterMethod(pPager); return rc; @@ -5158,6 +5170,9 @@ static int checkHotJournal(Pager *pPager, int *pbHot){ memcpy(&a2[18], &a1[18], 2); memcpy(&a2[24], &a1[24], 4); memcpy(&a2[92], &a1[92], 8); +#ifdef SQLITE_ENABLE_ZIPVFS + memcpy(&a2[176], &a1[176], 4); +#endif } if( rc==SQLITE_OK && memcmp(a1, a2, pgsz)==0 ){ *pbHot = 0;