!4138 解决关闭双写,段页式执行local_space_shrink可能会core的问题

Merge pull request !4138 from cchen676/1207master
This commit is contained in:
opengauss_bot
2023-09-13 11:53:04 +00:00
committed by Gitee
2 changed files with 32 additions and 24 deletions

View File

@ -780,20 +780,25 @@ void seg_redo_new_page_copy_and_flush(BufferTag *tag, char *data, XLogRecPtr lsn
update_max_page_flush_lsn(lsn, t_thrd.proc_cxt.MyProcPid, false); update_max_page_flush_lsn(lsn, t_thrd.proc_cxt.MyProcPid, false);
} }
bool flush_old_file = false; if (dw_enabled() && pg_atomic_read_u32(&g_instance.ckpt_cxt_ctl->current_page_writer_count) > 0) {
uint32 pos = seg_dw_single_flush_without_buffer(*tag, (Block)page, &flush_old_file); bool flush_old_file = false;
t_thrd.proc->dw_pos = pos; uint16 pos = seg_dw_single_flush_without_buffer(*tag, (Block)page, &flush_old_file);
t_thrd.proc->flush_new_dw = !flush_old_file; t_thrd.proc->dw_pos = pos;
t_thrd.proc->flush_new_dw = !flush_old_file;
SegSpace *spc = spc_open(tag->rnode.spcNode, tag->rnode.dbNode, false); SegSpace *spc = spc_open(tag->rnode.spcNode, tag->rnode.dbNode, false);
SegmentCheck(spc != NULL); SegmentCheck(spc != NULL);
seg_physical_write(spc, tag->rnode, tag->forkNum, tag->blockNum, page, true); seg_physical_write(spc, tag->rnode, tag->forkNum, tag->blockNum, page, true);
if (flush_old_file) { if (flush_old_file) {
g_instance.dw_single_cxt.recovery_buf.single_flush_state[pos] = true; g_instance.dw_single_cxt.recovery_buf.single_flush_state[pos] = true;
} else {
g_instance.dw_single_cxt.single_flush_state[pos] = true;
}
t_thrd.proc->dw_pos = -1;
} else { } else {
g_instance.dw_single_cxt.single_flush_state[pos] = true; SegSpace *spc = spc_open(tag->rnode.spcNode, tag->rnode.dbNode, false);
SegmentCheck(spc != NULL);
seg_physical_write(spc, tag->rnode, tag->forkNum, tag->blockNum, page, true);
} }
t_thrd.proc->dw_pos = -1;
} }

View File

@ -582,20 +582,23 @@ static void copy_extent(SegExtentGroup *seg, RelFileNode logic_rnode, uint32 log
PageSetLSN(pagedata, recptr); PageSetLSN(pagedata, recptr);
/* 2. double write */ /* 2. double write */
bool flush_old_file = false; if (dw_enabled() && pg_atomic_read_u32(&g_instance.ckpt_cxt_ctl->current_page_writer_count) > 0) {
uint32 pos = seg_dw_single_flush_without_buffer(tag, (Block)pagedata, &flush_old_file); bool flush_old_file = false;
t_thrd.proc->dw_pos = pos; uint16 pos = seg_dw_single_flush_without_buffer(tag, (Block)pagedata, &flush_old_file);
t_thrd.proc->flush_new_dw = !flush_old_file; t_thrd.proc->dw_pos = pos;
t_thrd.proc->flush_new_dw = !flush_old_file;
/* 3. checksum and write to file */ PageSetChecksumInplace((Page)pagedata, to_block);
PageSetChecksumInplace((Page)pagedata, to_block); df_pwrite_block(seg->segfile, pagedata, to_block);
df_pwrite_block(seg->segfile, pagedata, to_block); if (flush_old_file) {
if (flush_old_file) { g_instance.dw_single_cxt.recovery_buf.single_flush_state[pos] = true;
g_instance.dw_single_cxt.recovery_buf.single_flush_state[pos] = true; } else {
g_instance.dw_single_cxt.single_flush_state[pos] = true;
}
t_thrd.proc->dw_pos = -1;
} else { } else {
g_instance.dw_single_cxt.single_flush_state[pos] = true; PageSetChecksumInplace((Page)pagedata, to_block);
df_pwrite_block(seg->segfile, pagedata, to_block);
} }
t_thrd.proc->dw_pos = -1;
} }
END_CRIT_SECTION(); END_CRIT_SECTION();