提交 ccef4b0f 编写于 作者: H Hongze Cheng

more

上级 a95d6690
...@@ -119,7 +119,6 @@ static SPage *tdbPCacheFetchImpl(SPCache *pCache, const SPgid *pPgid, bool alcNe ...@@ -119,7 +119,6 @@ static SPage *tdbPCacheFetchImpl(SPCache *pCache, const SPgid *pPgid, bool alcNe
if (pPage || !alcNewPage) { if (pPage || !alcNewPage) {
if (pPage) { if (pPage) {
ASSERT(pPage->isLoad == 1);
tdbPCachePinPage(pPage); tdbPCachePinPage(pPage);
} }
return pPage; return pPage;
...@@ -148,7 +147,7 @@ static SPage *tdbPCacheFetchImpl(SPCache *pCache, const SPgid *pPgid, bool alcNe ...@@ -148,7 +147,7 @@ static SPage *tdbPCacheFetchImpl(SPCache *pCache, const SPgid *pPgid, bool alcNe
if (pPage) { if (pPage) {
memcpy(&(pPage->pgid), pPgid, sizeof(*pPgid)); memcpy(&(pPage->pgid), pPgid, sizeof(*pPgid));
pPage->pLruNext = NULL; pPage->pLruNext = NULL;
pPage->isLoad = 0; pPage->pPager = NULL;
tdbPCacheAddPageToHash(pPage); tdbPCacheAddPageToHash(pPage);
} }
......
...@@ -133,26 +133,11 @@ SPage *tdbPagerGet(SPager *pPager, SPgno pgno) { ...@@ -133,26 +133,11 @@ SPage *tdbPagerGet(SPager *pPager, SPgno pgno) {
pPage = tdbPCacheFetch(pPager->pCache, &pgid, 1); pPage = tdbPCacheFetch(pPager->pCache, &pgid, 1);
if (pPage == NULL) { if (pPage == NULL) {
// TODO // TODO: handle error
ASSERT(0); return NULL;
} }
tdbPCacheFetchFinish(pPager->pCache, pPage); 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; return pPage;
} }
......
...@@ -70,9 +70,6 @@ static FORCE_INLINE int tdbCmprPgId(const void *p1, const void *p2) { ...@@ -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) #define TDB_IS_SAME_PAGE(pPgid1, pPgid2) (tdbCmprPgId(pPgid1, pPgid2) == 0)
// framd_id_t
typedef int32_t frame_id_t;
// pgsz_t // pgsz_t
#define TDB_MIN_PGSIZE 512 #define TDB_MIN_PGSIZE 512
#define TDB_MAX_PGSIZE 65536 #define TDB_MAX_PGSIZE 65536
...@@ -131,7 +128,6 @@ typedef int (*FKeyComparator)(const void *pKey1, int kLen1, const void *pKey2, i ...@@ -131,7 +128,6 @@ typedef int (*FKeyComparator)(const void *pKey1, int kLen1, const void *pKey2, i
#define BTREE_MAX_DEPTH 20 #define BTREE_MAX_DEPTH 20
#include "tdbUtil.h" #include "tdbUtil.h"
#include "tdbPage.h" #include "tdbPage.h"
......
...@@ -29,7 +29,6 @@ struct SPage { ...@@ -29,7 +29,6 @@ struct SPage {
SPgid pgid; SPgid pgid;
u8 isAnchor; u8 isAnchor;
u8 isLocalPage; u8 isLocalPage;
u8 isLoad;
u8 isDirty; u8 isDirty;
i32 nRef; i32 nRef;
SPCache *pCache; SPCache *pCache;
...@@ -38,6 +37,7 @@ struct SPage { ...@@ -38,6 +37,7 @@ struct SPage {
SPage * pLruNext; SPage * pLruNext;
SPage * pLruPrev; SPage * pLruPrev;
SPage * pDirtyNext; SPage * pDirtyNext;
SPage * pPager;
}; };
int tdbPCacheOpen(int pageSize, int cacheSize, int extraSize, SPCache **ppCache); int tdbPCacheOpen(int pageSize, int cacheSize, int extraSize, SPCache **ppCache);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册