未验证 提交 6fccf849 编写于 作者: S Shengliang Guan 提交者: GitHub

Merge pull request #19503 from taosdata/fix/TD-21888

fix(tdb/ofp): upgrade large key ofp case
......@@ -1063,11 +1063,11 @@ static int tdbBtreeEncodePayload(SPage *pPage, SCell *pCell, int nHeader, const
} else {
int nLeftKey = kLen;
// pack partial key and nextPgno
memcpy(pCell + nHeader, pKey, nLocal - 4);
nLeft -= nLocal - 4;
nLeftKey -= nLocal - 4;
memcpy(pCell + nHeader, pKey, nLocal - nHeader - sizeof(pgno));
nLeft -= nLocal - nHeader - sizeof(pgno);
nLeftKey -= nLocal - nHeader - sizeof(pgno);
memcpy(pCell + nHeader + nLocal - 4, &pgno, sizeof(pgno));
memcpy(pCell + nLocal - sizeof(pgno), &pgno, sizeof(pgno));
int lastKeyPageSpace = 0;
// pack left key & val to ovpages
......@@ -1087,9 +1087,12 @@ static int tdbBtreeEncodePayload(SPage *pPage, SCell *pCell, int nHeader, const
if (lastKeyPage) {
if (lastKeyPageSpace >= vLen) {
memcpy(pBuf + kLen - nLeftKey, pVal, vLen);
if (vLen > 0) {
memcpy(pBuf + kLen - nLeftKey, pVal, vLen);
nLeft -= vLen;
}
nLeft -= vLen;
pgno = 0;
} else {
memcpy(pBuf + kLen - nLeftKey, pVal, lastKeyPageSpace);
......@@ -1111,7 +1114,7 @@ static int tdbBtreeEncodePayload(SPage *pPage, SCell *pCell, int nHeader, const
}
}
memcpy(pBuf + kLen - nLeft, &pgno, sizeof(pgno));
memcpy(pBuf + bytes, &pgno, sizeof(pgno));
ret = tdbPageInsertCell(ofp, 0, pBuf, bytes + sizeof(pgno), 0);
if (ret < 0) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册