more
This commit is contained in:
parent
3c4237afd9
commit
a015dd5238
|
@ -120,7 +120,10 @@ static SPgHdr *tdbPCacheFetchImpl(SPCache *pCache, const SPgid *pPgid, bool alcN
|
|||
}
|
||||
|
||||
if (pPage || !alcNewPage) {
|
||||
if (pPage) tdbPCachePinPage(pPage);
|
||||
if (pPage) {
|
||||
ASSERT(pPage->isLoad == 1);
|
||||
tdbPCachePinPage(pPage);
|
||||
}
|
||||
return pPage;
|
||||
}
|
||||
|
||||
|
@ -147,7 +150,7 @@ static SPgHdr *tdbPCacheFetchImpl(SPCache *pCache, const SPgid *pPgid, bool alcN
|
|||
if (pPage) {
|
||||
memcpy(&(pPage->pgid), pPgid, sizeof(*pPgid));
|
||||
pPage->pLruNext = NULL;
|
||||
// *(void **)pPage->page.pExtra = 0; (TODO)
|
||||
pPage->isLoad = 0;
|
||||
tdbPCacheAddPageToHash(pPage);
|
||||
}
|
||||
|
||||
|
|
|
@ -84,12 +84,14 @@ SPgHdr *tdbPFileGet(SPFile *pFile, SPgno pgno) {
|
|||
}
|
||||
tdbPCacheFetchFinish(pFile->pCache, pPage);
|
||||
|
||||
if (pgno > pFile->dbFileSize /*TODO*/) {
|
||||
memset(pPage->pData, 0, pFile->pageSize);
|
||||
} else {
|
||||
if (tdbPFileReadPage(pFile, pPage) < 0) {
|
||||
// TODO: handle error
|
||||
return NULL;
|
||||
if (!(pPage->isLoad)) {
|
||||
if (pgno > pFile->dbFileSize /*TODO*/) {
|
||||
memset(pPage->pData, 0, pFile->pageSize);
|
||||
} else {
|
||||
if (tdbPFileReadPage(pFile, pPage) < 0) {
|
||||
// TODO: handle error
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -29,6 +29,7 @@ struct SPgHdr {
|
|||
SPgid pgid;
|
||||
u8 isAnchor;
|
||||
u8 isLocalPage;
|
||||
u8 isLoad;
|
||||
i32 nRef;
|
||||
SPCache *pCache;
|
||||
SPgHdr * pFreeNext;
|
||||
|
|
Loading…
Reference in New Issue