!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,11 +780,11 @@ 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);
}
if (dw_enabled() && pg_atomic_read_u32(&g_instance.ckpt_cxt_ctl->current_page_writer_count) > 0) {
bool flush_old_file = false;
uint32 pos = seg_dw_single_flush_without_buffer(*tag, (Block)page, &flush_old_file);
uint16 pos = seg_dw_single_flush_without_buffer(*tag, (Block)page, &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);
SegmentCheck(spc != NULL);
seg_physical_write(spc, tag->rnode, tag->forkNum, tag->blockNum, page, true);
@ -794,6 +794,11 @@ void seg_redo_new_page_copy_and_flush(BufferTag *tag, char *data, XLogRecPtr lsn
g_instance.dw_single_cxt.single_flush_state[pos] = true;
}
t_thrd.proc->dw_pos = -1;
} else {
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);
}
}

View File

@ -582,12 +582,11 @@ static void copy_extent(SegExtentGroup *seg, RelFileNode logic_rnode, uint32 log
PageSetLSN(pagedata, recptr);
/* 2. double write */
if (dw_enabled() && pg_atomic_read_u32(&g_instance.ckpt_cxt_ctl->current_page_writer_count) > 0) {
bool flush_old_file = false;
uint32 pos = seg_dw_single_flush_without_buffer(tag, (Block)pagedata, &flush_old_file);
uint16 pos = seg_dw_single_flush_without_buffer(tag, (Block)pagedata, &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);
df_pwrite_block(seg->segfile, pagedata, to_block);
if (flush_old_file) {
@ -596,6 +595,10 @@ static void copy_extent(SegExtentGroup *seg, RelFileNode logic_rnode, uint32 log
g_instance.dw_single_cxt.single_flush_state[pos] = true;
}
t_thrd.proc->dw_pos = -1;
} else {
PageSetChecksumInplace((Page)pagedata, to_block);
df_pwrite_block(seg->segfile, pagedata, to_block);
}
}
END_CRIT_SECTION();