mirror of
https://github.com/timescale/timescaledb.git
synced 2025-05-14 09:37:00 +08:00
Out of on_proc_exit slots on guc license change
Problem: When the guc timescaledb.license = 'timescale' is set in the conf file and a SIGHUP is sent to postgress process and a reload of the tsl module is triggered. This reload happens in 2 phases 1. tsl_module_load is called which will load the module only if not already loaded and 2.The ts_module_init is called for every ts_license_guc_assign_hook irrespective of if it is new load.This ts_module_init initialization function also registers a on_proc_exit function to be called on exit. The list of on_proc_exit methods are maintained in a fixed array on_proc_exit_list of size MAX_ON_EXITS (20) which gets filled up on repeated SIGHUPs and hence an error. Fix: The fix is to make the ts_module_init() register the on_proc_exit callback, only in case the module is reloaded and not in every init call. Closes #5233
This commit is contained in:
parent
e92d5ba748
commit
5e0391392a
@ -14,9 +14,11 @@ accidentally triggering the load of a previous DB version.**
|
||||
**Bugfixes**
|
||||
* #5396 Fix SEGMENTBY columns predicates to be pushed down
|
||||
* #5410 Fix file trailer handling in the COPY fetcher
|
||||
* #5233 Out of on_proc_exit slots on guc license change
|
||||
|
||||
**Thanks**
|
||||
* @nikolaps for reporting an issue with the COPY fetcher
|
||||
* @S-imo-n for reporting the issue on Background Worker Scheduler crash
|
||||
|
||||
## 2.10.1 (2023-03-07)
|
||||
|
||||
|
@ -20,6 +20,7 @@ static bool load_enabled = false;
|
||||
static GucSource load_source = PGC_S_DEFAULT;
|
||||
static void *tsl_handle = NULL;
|
||||
static PGFunction tsl_init_fn = NULL;
|
||||
static bool tsl_register_proc_exit = false;
|
||||
|
||||
/*
|
||||
* License Functions.
|
||||
@ -128,6 +129,8 @@ tsl_module_load(void)
|
||||
return false;
|
||||
tsl_init_fn = function;
|
||||
tsl_handle = handle;
|
||||
/* the on_proc_exit callback is registered by the tsl_init_fn after load */
|
||||
tsl_register_proc_exit = true;
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -136,7 +139,10 @@ tsl_module_init(void)
|
||||
{
|
||||
Assert(tsl_handle != NULL);
|
||||
Assert(tsl_init_fn != NULL);
|
||||
DirectFunctionCall1(tsl_init_fn, CharGetDatum(0));
|
||||
DirectFunctionCall1(tsl_init_fn, BoolGetDatum(tsl_register_proc_exit));
|
||||
/* register the on_proc_exit only when the module is reloaded */
|
||||
if (tsl_register_proc_exit)
|
||||
tsl_register_proc_exit = false;
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -255,6 +255,7 @@ TS_FUNCTION_INFO_V1(ts_module_init);
|
||||
PGDLLEXPORT Datum
|
||||
ts_module_init(PG_FUNCTION_ARGS)
|
||||
{
|
||||
bool register_proc_exit = PG_GETARG_BOOL(0);
|
||||
ts_cm_functions = &tsl_cm_functions;
|
||||
|
||||
_continuous_aggs_cache_inval_init();
|
||||
@ -264,6 +265,7 @@ ts_module_init(PG_FUNCTION_ARGS)
|
||||
_remote_dist_txn_init();
|
||||
_tsl_process_utility_init();
|
||||
/* Register a cleanup function to be called when the backend exits */
|
||||
if (register_proc_exit)
|
||||
on_proc_exit(ts_module_cleanup_on_pg_exit, 0);
|
||||
PG_RETURN_BOOL(true);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user