Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
anarazel committed Dec 14, 2023
1 parent fdbc078 commit 70a3e1b
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions src/backend/access/transam/xlog.c
Original file line number Diff line number Diff line change
Expand Up @@ -2976,7 +2976,7 @@ static bool
XLogWriteIssueWrites(XLogWritePos *write_pos, bool flexible)
{
bool ispartialpage;
bool last_iteration;
int last_iteration;
bool finishing_seg;
int curridx;
int npages;
Expand Down Expand Up @@ -3227,17 +3227,17 @@ XLogWriteIssueWrites(XLogWritePos *write_pos, bool flexible)
/* FIXME, consider doing a separate write? */

if (write_pos->write_init_opt <= PageEndPtr)
last_iteration = true;
last_iteration = 1;
else if (curridx == lastnonpartialidx && write_pos->write_init_min <= PageEndPtr)
{
last_iteration = true;
last_iteration = 2;
elog(DEBUG3, "preventing partial write min %X/%X, max %X/%X, page %X/%X",
(uint32) (write_pos->write_init_min >> 32), (uint32) write_pos->write_init_min,
(uint32) (write_pos->write_init_opt >> 32), (uint32) write_pos->write_init_opt,
(uint32) (PageEndPtr >> 32), (uint32) PageEndPtr);
}
else
last_iteration = false;
last_iteration = 0;

finishing_seg = !ispartialpage &&
(startoffset + npages * XLOG_BLCKSZ) >= wal_segment_size;
Expand All @@ -3254,7 +3254,7 @@ XLogWriteIssueWrites(XLogWritePos *write_pos, bool flexible)
if (last_iteration ||
curridx == XLogCtl->XLogCacheBlck ||
/* (!io_wal_pad_partial && curridx == lastnonpartialidx) || */
curridx == lastnonpartialidx ||
//curridx == lastnonpartialidx ||
finishing_seg ||
large_enough_write)
{
Expand All @@ -3273,15 +3273,16 @@ XLogWriteIssueWrites(XLogWritePos *write_pos, bool flexible)
XLogRecPtr ins = XLogBytePosToRecPtr(XLogCtl->Insert.CurrBytePos);

ereport(DEBUG1,
errmsg("performing %s write of %d bytes: from %X/%X to %X/%X, min %X/%X opt %X/%X (compl %X/%X: %u, ins %X/%X: %u)",
errmsg("performing %s write of %d bytes: from %X/%X to %X/%X, min %X/%X opt %X/%X (compl %X/%X: %u, ins %X/%X: %u, last: %d)",
ispartialpage ? "partial" : "non-partial",
nbytes,
(uint32) (startwrite >> 32), (uint32) startwrite,
(uint32) (write_upto >> 32), (uint32) write_upto,
(uint32) (write_pos->write_init_min >> 32), (uint32) write_pos->write_init_min,
(uint32) (write_pos->write_init_opt >> 32), (uint32) write_pos->write_init_opt,
(uint32) (compl >> 32), (uint32) compl, (uint32) (compl - write_upto),
(uint32) (ins >> 32), (uint32) ins, (uint32) (ins - write_upto)),
(uint32) (ins >> 32), (uint32) ins, (uint32) (ins - write_upto),
last_iteration),
errhidestmt(true),
errhidecontext(true));
}
Expand Down

0 comments on commit 70a3e1b

Please sign in to comment.