when pagewriter has the exception occurs, retry again.

Offering: openGaussDev

More detail:

Match-id-378bacef6fbbeca1f01de992dd6cb6e3f7fcee43
This commit is contained in:
openGaussDev
2022-03-09 18:18:28 +08:00
committed by yanghao
parent 2ea04d8152
commit 14bcd13362
4 changed files with 17 additions and 11 deletions

View File

@ -1216,9 +1216,12 @@ static void HandlePageWriterMainInterrupts()
ProcessConfigFile(PGC_SIGHUP);
}
if (t_thrd.pagewriter_cxt.sync_requested) {
if (t_thrd.pagewriter_cxt.sync_requested || t_thrd.pagewriter_cxt.sync_retry) {
t_thrd.pagewriter_cxt.sync_requested = false;
t_thrd.pagewriter_cxt.sync_retry = true;
PageWriterSyncWithAbsorption();
t_thrd.pagewriter_cxt.sync_retry = false;
}
/* main thread should finally exit. */

8
src/gausskernel/process/threadpool/knl_thread.cpp Normal file → Executable file
View File

@ -1151,6 +1151,8 @@ static void knl_t_bgwriter_init(knl_t_bgwriter_context* bgwriter_cxt)
static void knl_t_pagewriter_init(knl_t_pagewriter_context* pagewriter_cxt)
{
pagewriter_cxt->got_SIGHUP = false;
pagewriter_cxt->sync_requested = false;
pagewriter_cxt->sync_retry = false;
pagewriter_cxt->shutdown_requested = false;
pagewriter_cxt->page_writer_after = WRITEBACK_MAX_PENDING_FLUSHES;
pagewriter_cxt->pagewriter_id = -1;
@ -1495,7 +1497,7 @@ static void knl_t_postmaster_init(knl_t_postmaster_context* postmaster_cxt)
rc = memset_s(postmaster_cxt->CrossClusterReplConnArray, MAX_REPLNODE_NUM * sizeof(replconninfo*), 0,
MAX_REPLNODE_NUM * sizeof(replconninfo*));
securec_check(rc, "\0", "\0");
rc = memset_s(postmaster_cxt->CrossClusterReplConnChanged, MAX_REPLNODE_NUM * sizeof(bool), 0,
rc = memset_s(postmaster_cxt->CrossClusterReplConnChanged, MAX_REPLNODE_NUM * sizeof(bool), 0,
MAX_REPLNODE_NUM * sizeof(bool));
securec_check(rc, "\0", "\0");
@ -1678,7 +1680,7 @@ knl_t_uheap_stats_init(knl_t_uheap_stats_context* uheap_stats_cxt)
}
#endif
void KnlDcfContextInit(knl_t_dcf_context* dcfContext)
void KnlDcfContextInit(knl_t_dcf_context* dcfContext)
{
dcfContext->isDcfShmemInited = false;
dcfContext->is_dcf_thread = false;
@ -1709,7 +1711,7 @@ void knl_thread_init(knl_thread_role role)
t_thrd.mcxt_group->Init(t_thrd.top_mem_cxt);
MemoryContextSeal(t_thrd.top_mem_cxt);
MemoryContextSwitchTo(THREAD_GET_MEM_CXT_GROUP(MEMORY_CONTEXT_DEFAULT));
KnlLscContextInit(&t_thrd.lsc_cxt);
/* CommProxy Support */
t_thrd.comm_sock_option = g_default_invalid_sock_opt;

View File

@ -422,7 +422,7 @@ void ProcessSyncRequests(void)
(errmsg("could not fsync file \"%s\": %m, this relation has been remove", path)));
break;
}
/*
* Absorb incoming requests and check to see if a cancel arrived
* for this relation fork.

13
src/include/knl/knl_thread.h Normal file → Executable file
View File

@ -187,7 +187,7 @@ typedef enum {
} TimeCostPosition;
/*
for extreme rto
for extreme rto
thread step1 step2 step3 step4
step5 step6 step7 step8
redo batch get a record redo record(total) update stanbystate parse xlog
@ -733,7 +733,7 @@ typedef struct knl_t_xlog_context {
struct HTAB* invalid_page_tab;
struct HTAB* remain_segs;
/* state maintained across calls */
uint32 sendId;
int sendFile;
@ -926,7 +926,7 @@ typedef struct knl_t_shemem_ptr_context {
*/
union LWLockPadded *mainLWLockArray;
// for GTT table to track sessions and their usage of GTTs
// for GTT table to track sessions and their usage of GTTs
struct gtt_ctl_data* gtt_shared_ctl;
struct HTAB* active_gtt_shared_hash;
@ -1567,6 +1567,7 @@ typedef struct knl_t_pagewriter_context {
volatile sig_atomic_t got_SIGHUP;
volatile sig_atomic_t shutdown_requested;
volatile sig_atomic_t sync_requested;
volatile sig_atomic_t sync_retry;
int page_writer_after;
int pagewriter_id;
uint64 next_flush_time;
@ -1813,7 +1814,7 @@ typedef struct knl_t_utils_context {
bool gs_mp_inited;
/* Memory Protecting need flag */
bool memNeedProtect;
bool memNeedProtect;
/* Track memory usage in chunks at individual thread level */
int32 trackedMemChunks;
@ -2724,7 +2725,7 @@ typedef struct knl_t_storage_context {
struct HTAB* DataFileIdCache;
/* Thread shared Seg Spc cache */
struct HTAB* SegSpcCache;
struct HTAB* uidHashCache;
struct HTAB* DisasterCache;
/*
@ -3258,7 +3259,7 @@ typedef struct knl_thrd_context {
MemoryContext top_mem_cxt;
MemoryContextGroup* mcxt_group;
knl_t_lsc_context lsc_cxt;
/* variables to support comm proxy */
CommSocketOption comm_sock_option;
CommEpollOption comm_epoll_option;