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