Prompt
Choose the appropriate configuration context based on how changes will be handled by the system. When defining custom configuration variables:
- Use
PGC_POSTMASTERfor options that require a server restart or cannot be changed while the server is running - Use
PGC_SIGHUPonly when there is code to properly handle configuration changes at runtime - Implement appropriate handler functions for configurations that need special processing when changed
Example of proper context selection:
DefineCustomStringVariable(
"neon.safekeeper_extra_conninfo_options",
"libpq keyword parameters and values to apply to safekeeper connections",
NULL,
&safekeeper_extra_conninfo_options,
"",
PGC_POSTMASTER, // Requires restart since we don't have reconnection code
...
);
// For configurations that need special handling when changed:
DefineCustomStringVariable(
"neon.safekeepers",
"List of safekeepers",
NULL,
&safekeepers_list,
"",
PGC_SIGHUP, // Can change during runtime
...
NULL, assign_neon_safekeepers, NULL // Custom handler function
);
Adding clear comments when configurations have special behavior enhances code maintainability.