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

fix page lock problem

上级 139b9b73
...@@ -284,7 +284,7 @@ static int tdbBtreeOpenImpl(SBTree *pBt) { ...@@ -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) { ...@@ -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) { ...@@ -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;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册