mirror of
https://gitee.com/he3db/he3pg.git
synced 2024-12-02 04:07:34 +08:00
fix bug when copy wal into walbuffer
Signed-off-by: shipixian <shipixian_yewu@cmss.chinamobile.com>
This commit is contained in:
parent
2311fe482a
commit
7e8e77b95f
@ -2140,9 +2140,9 @@ He3DBCopyXLogRecordToWAL(int write_len, XLogRecPtr StartPos, XLogRecPtr EndPos)
|
||||
*
|
||||
* 如果xlog的长度超过剩余空间,就从xlog buffer的起始地址开始复制
|
||||
*/
|
||||
// int XlogBufferLength = (XLOGbuffers-1) * XLOG_BLCKSZ;
|
||||
// int UsedXlogBufferLength = StartPos % ((XLOGbuffers-1) * XLOG_BLCKSZ);
|
||||
// int remaindXlogBufferLength = XlogBufferLength - UsedXlogBufferLength;
|
||||
int XlogBufferLength = (XLOGbuffers-1) * XLOG_BLCKSZ;
|
||||
int UsedXlogBufferLength = StartPos % ((XLOGbuffers-1) * XLOG_BLCKSZ);
|
||||
int remaindXlogBufferLength = XlogBufferLength - UsedXlogBufferLength;
|
||||
/*
|
||||
* Get a pointer to the right place in the right WAL buffer to start
|
||||
* inserting to.
|
||||
@ -2159,6 +2159,8 @@ He3DBCopyXLogRecordToWAL(int write_len, XLogRecPtr StartPos, XLogRecPtr EndPos)
|
||||
for (int i = 0; i < grouo_rec_count; i++)
|
||||
{
|
||||
rdata = (XLogRecData *)&groupRecData[i];
|
||||
if (remaindXlogBufferLength <= 0)
|
||||
currpos = XLogCtl->pages - remaindXlogBufferLength;
|
||||
while (rdata != NULL)
|
||||
{
|
||||
char *rdata_data = rdata->data;
|
||||
@ -2180,6 +2182,7 @@ He3DBCopyXLogRecordToWAL(int write_len, XLogRecPtr StartPos, XLogRecPtr EndPos)
|
||||
|
||||
CurrPos += rdata_len;
|
||||
written += rdata_len;
|
||||
remaindXlogBufferLength -= rdata_len;
|
||||
rdata = rdata->next;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user