fix page lock problem
This commit is contained in:
parent
139b9b7323
commit
c479c85a88
|
@ -284,7 +284,7 @@ static int tdbBtreeOpenImpl(SBTree *pBt) {
|
|||
int ret;
|
||||
|
||||
{
|
||||
// TODO: Search the main DB to check if the DB exists
|
||||
// 1. TODO: Search the main DB to check if the DB exists
|
||||
pgno = 0;
|
||||
}
|
||||
|
||||
|
@ -294,13 +294,16 @@ static int tdbBtreeOpenImpl(SBTree *pBt) {
|
|||
}
|
||||
|
||||
// Try to create a new database
|
||||
// ret = tdbPagerNewPage(pBt->pPager, &pgno, &pPage);
|
||||
// if (ret < 0) {
|
||||
// return -1;
|
||||
// }
|
||||
SBtreeZeroPageArg zArg = {.flags = TDB_BTREE_ROOT | TDB_BTREE_LEAF, .pBt = pBt};
|
||||
ret = tdbPagerNewPage(pBt->pPager, &pgno, &pPage, tdbBtreeZeroPage, &zArg);
|
||||
if (ret < 0) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
// ASSERT(pgno != 0);
|
||||
// pBt->root = pgno;
|
||||
// TODO: Unref the page
|
||||
|
||||
ASSERT(pgno != 0);
|
||||
pBt->root = pgno;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -235,6 +235,7 @@ static int tdbPCacheOpenImpl(SPCache *pCache) {
|
|||
}
|
||||
|
||||
pPage = (SPage *)(&(pPtr[pCache->pageSize]));
|
||||
TDB_INIT_PAGE_LOCK(pPage);
|
||||
pPage->pData = (void *)pPtr;
|
||||
// pPage->pgid = 0;
|
||||
pPage->isAnchor = 0;
|
||||
|
|
Loading…
Reference in New Issue