add assert

Signed-off-by: shipixian <shipixian_yewu@cmss.chinamobile.com>
This commit is contained in:
shipixian 2023-03-28 16:04:17 +08:00
parent d9a5fa8c2a
commit b3aaecb7bc

View File

@ -769,6 +769,7 @@ he3db_mdread_pagexlog(SMgrRelation reln, ForkNumber forknum, BlockNumber blocknu
bufrd = MoveOnePageToMemory(pageKey);
if (bufrd.count > 0)
{
nbytes = bufrd.count;
*buffer = (uint8_t *)malloc(bufrd.count);
memcpy(*buffer, bufrd.buf,bufrd.count);
free_dataRead(bufrd.buf, bufrd.count, bufrd.cap);
@ -777,20 +778,22 @@ he3db_mdread_pagexlog(SMgrRelation reln, ForkNumber forknum, BlockNumber blocknu
Assert(bufrd.count == BLCKSZ);
pageKey.pageLsn = PageGetLSN(*buffer);
LsnNode *head = GetLogIndexByPage(&pageTag, pageKey.pageLsn, pageKey.replyLsn);
Bufrd result;
result = ReadWalsByPage(pageKey.relfileNode.dbNode, pageKey.relfileNode.relNode,
pageKey.forkNo, pageKey.blkNo, ThisTimeLineID, head);
if (result.count !=0) {
if (head->next != NULL)
{
Bufrd result;
result = ReadWalsByPage(pageKey.relfileNode.dbNode, pageKey.relfileNode.relNode,
pageKey.forkNo, pageKey.blkNo, ThisTimeLineID, head);
Assert(result.count != 0);
nbytes += result.count;
*buffer = (uint8_t *)realloc(*buffer, BLCKSZ + result.count);
strcat(*buffer,result.buf);
free_dataRead(result.buf, result.count, result.cap);
}
//TODO free result
FreeLsnNode(head);
return BLCKSZ + result.count;
}
// *buffer = bufrd.buf;
return bufrd.count;
return nbytes;
}
else
{
@ -833,19 +836,16 @@ he3db_mdread_pagexlog(SMgrRelation reln, ForkNumber forknum, BlockNumber blocknu
result = ReadWalsByPage(pageKey.relfileNode.dbNode,pageKey.relfileNode.relNode,
pageKey.forkNo,pageKey.blkNo, ThisTimeLineID, head);
}
if (result.count !=0) {
buf = (uint8_t *)realloc(buf, BLCKSZ + result.count);
strcat(buf,result.buf);
Assert(result.count != 0);
nbytes += result.count;
buf = (uint8_t *)realloc(buf, BLCKSZ + result.count);
strcat(buf,result.buf);
//TODO free result
free_dataRead(result.buf, result.count, result.cap);
}
*buffer = buf;
FreeLsnNode(head);
return BLCKSZ + result.count;
free_dataRead(result.buf, result.count, result.cap);
}
*buffer = buf;
FreeLsnNode(head);
return BLCKSZ;
return nbytes;
}
// v = _mdfd_getseg(reln, forknum, blocknum, false,