From cee75c2ba338056e17f2fd47b8732a9365b92d1b Mon Sep 17 00:00:00 2001 From: Hongze Cheng Date: Wed, 30 Mar 2022 10:01:12 +0000 Subject: [PATCH] more --- source/libs/tdb/src/db/tdbBtree.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/source/libs/tdb/src/db/tdbBtree.c b/source/libs/tdb/src/db/tdbBtree.c index b1728b53e7..848500875d 100644 --- a/source/libs/tdb/src/db/tdbBtree.c +++ b/source/libs/tdb/src/db/tdbBtree.c @@ -162,7 +162,7 @@ int tdbBtreeInsert(SBTree *pBt, const void *pKey, int kLen, const void *pVal, in } } - // make sure enough space to hold the space + // make sure enough space to hold the cell szBuf = kLen + vLen + 14; pBuf = TDB_REALLOC(pBt->pBuf, pBt->pageSize > szBuf ? szBuf : pBt->pageSize); if (pBuf == NULL) { @@ -181,6 +181,14 @@ int tdbBtreeInsert(SBTree *pBt, const void *pKey, int kLen, const void *pVal, in return -1; } + // mark the page dirty + ret = tdbPagerWrite(pBt->pPager, btc.pPage); + if (ret < 0) { + tdbBtcClose(&btc); + ASSERT(0); + return -1; + } + // insert the cell ret = tdbPageInsertCell(btc.pPage, idx, pCell, szCell, 0); if (ret < 0) {