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) {