diff --git a/source/libs/tdb/src/db/tdbPCache.c b/source/libs/tdb/src/db/tdbPCache.c index 0d5822f3085fedc6d80ed3f5ec6e61018fb31489..c18d43e27840112425447028d1156bc517ebd1e7 100644 --- a/source/libs/tdb/src/db/tdbPCache.c +++ b/source/libs/tdb/src/db/tdbPCache.c @@ -119,7 +119,6 @@ static SPage *tdbPCacheFetchImpl(SPCache *pCache, const SPgid *pPgid, bool alcNe if (pPage || !alcNewPage) { if (pPage) { - ASSERT(pPage->isLoad == 1); tdbPCachePinPage(pPage); } return pPage; @@ -148,7 +147,7 @@ static SPage *tdbPCacheFetchImpl(SPCache *pCache, const SPgid *pPgid, bool alcNe if (pPage) { memcpy(&(pPage->pgid), pPgid, sizeof(*pPgid)); pPage->pLruNext = NULL; - pPage->isLoad = 0; + pPage->pPager = NULL; tdbPCacheAddPageToHash(pPage); } diff --git a/source/libs/tdb/src/db/tdbPager.c b/source/libs/tdb/src/db/tdbPager.c index 2c5601a14b607b3483892a593f870876c22860f0..f023b086055ee9b432e4597aa1c86fd77aadadf0 100644 --- a/source/libs/tdb/src/db/tdbPager.c +++ b/source/libs/tdb/src/db/tdbPager.c @@ -133,26 +133,11 @@ SPage *tdbPagerGet(SPager *pPager, SPgno pgno) { pPage = tdbPCacheFetch(pPager->pCache, &pgid, 1); if (pPage == NULL) { - // TODO - ASSERT(0); + // TODO: handle error + return NULL; } tdbPCacheFetchFinish(pPager->pCache, pPage); - if (!(pPage->isLoad)) { - if (pgno > pPager->dbFileSize /*TODO*/) { - memset(pPage->pData, 0, pPager->pageSize); - } else { - if (tdbPagerReadPage(pPager, pPage) < 0) { - // TODO: handle error - return NULL; - } - } - - pPage->isLoad = 1; - } - - ASSERT(pPage->isLoad); - return pPage; } diff --git a/source/libs/tdb/src/inc/tdbInt.h b/source/libs/tdb/src/inc/tdbInt.h index e94479366fa910219bfcb4aaf3b6342ca5e3b3f2..bf43632815c63c210ac039ebf0bcf5a40a37afab 100644 --- a/source/libs/tdb/src/inc/tdbInt.h +++ b/source/libs/tdb/src/inc/tdbInt.h @@ -70,9 +70,6 @@ static FORCE_INLINE int tdbCmprPgId(const void *p1, const void *p2) { #define TDB_IS_SAME_PAGE(pPgid1, pPgid2) (tdbCmprPgId(pPgid1, pPgid2) == 0) -// framd_id_t -typedef int32_t frame_id_t; - // pgsz_t #define TDB_MIN_PGSIZE 512 #define TDB_MAX_PGSIZE 65536 @@ -131,7 +128,6 @@ typedef int (*FKeyComparator)(const void *pKey1, int kLen1, const void *pKey2, i #define BTREE_MAX_DEPTH 20 - #include "tdbUtil.h" #include "tdbPage.h" diff --git a/source/libs/tdb/src/inc/tdbPCache.h b/source/libs/tdb/src/inc/tdbPCache.h index 7d9153b94a7e3ab28341364861282f0b618a0441..2412cb1bd09535e2176151cccda3bb4876beae11 100644 --- a/source/libs/tdb/src/inc/tdbPCache.h +++ b/source/libs/tdb/src/inc/tdbPCache.h @@ -29,7 +29,6 @@ struct SPage { SPgid pgid; u8 isAnchor; u8 isLocalPage; - u8 isLoad; u8 isDirty; i32 nRef; SPCache *pCache; @@ -38,6 +37,7 @@ struct SPage { SPage * pLruNext; SPage * pLruPrev; SPage * pDirtyNext; + SPage * pPager; }; int tdbPCacheOpen(int pageSize, int cacheSize, int extraSize, SPCache **ppCache);