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

more TDB

上级 46aed970
......@@ -148,9 +148,9 @@ int tdbBtCursorInsert(SBtCursor *pCur, const void *pKey, int kLen, const void *p
idx = 0;
} else {
if (cret > 0) {
// TODO
idx = pCur->idx + 1;
} else if (cret < 0) {
// TODO
idx = pCur->idx;
} else {
/* TODO */
ASSERT(0);
......@@ -180,6 +180,18 @@ int tdbBtCursorInsert(SBtCursor *pCur, const void *pKey, int kLen, const void *p
return -1;
}
{
#if 0
// If page is overflow, balance the tree
if (pCur->pPage->nOverflow > 0) {
ret = tdbBtreeBalance(pCur);
if (ret < 0) {
return -1;
}
}
#endif
}
return 0;
}
......@@ -260,6 +272,7 @@ static int tdbBtCursorMoveTo(SBtCursor *pCur, const void *pKey, int kLen, int *p
u8 leaf = TDB_BTREE_PAGE_IS_LEAF(flags);
if (leaf) {
pCur->idx = midx;
*pCRst = c;
break;
} else {
if (c <= 0) {
......
......@@ -22,8 +22,8 @@ TEST(tdb_test, simple_test) {
ret = tdbDbInsert(pDb, "key2", 4, "value1", 6);
GTEST_ASSERT_EQ(ret, 0);
// ret = tdbDbInsert(pDb, "key3", 4, "value1", 6);
// GTEST_ASSERT_EQ(ret, 0);
ret = tdbDbInsert(pDb, "key3", 4, "value1", 6);
GTEST_ASSERT_EQ(ret, 0);
}
ret = tdbDbDrop(pDb);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册