Skip to content

Conversation

Mytherin
Copy link
Collaborator

Follow-up from #14018, finalizing the implementation

This PR enables the generation of settings through a JSON file, avoiding having to touch many places in the code to add a single setting. Examples of such settings:

Simple
        "name": "allow_extensions_metadata_mismatch",
        "description": "Allow to load extensions with not compatible metadata",
        "type": "BOOLEAN",
        "scope": "global"
More bells and whistles
    {
        "name": "checkpoint_threshold",
        "description": "The WAL size threshold at which to automatically trigger a checkpoint (e.g. 1GB)",
        "type": "VARCHAR",
        "scope": "global",
        "internal_setting": "checkpoint_wal_size",
        "custom_implementation": [
            "set",
            "get"
        ],
        "aliases": [
            "wal_autocheckpoint"
        ]
    },
Setting Description
name Name of the setting
description Description of the setting
type SQL type of the setting (e.g. BIGINT)
return_type C++ return type of the setting - if not set this is derived from the SQL type (e.g. VARCHAR -> string)
scope Global (DBConfig) or Local (ClientConfig)
internal_setting C++ variable name of the setting - if not provided equal to name
on_callbacks Custom callbacks to generate (set/reset) - generates OnGlobalSet/OnLocalSet/OnGlobalReset/OnLocalReset callbacks that can be used to verify input data
custom_implementation Whether or not the setting code is automatically generated - can be either true/false, or a list providing which has a custom implementation (set/reset/get)
struct Struct name of the setting, defaults to setting name in CamelCase
aliases List of aliases to generate for the setting

Not all settings can be fully auto-generated, therefore they are split between custom_settings.cpp and autogenerated_settings.cpp. The custom_implementation flag controls whether or not code for the setting is automatically generated.

chrisiou and others added 30 commits August 9, 2024 10:52
@Mytherin Mytherin merged commit a411527 into duckdb:feature Oct 16, 2024
36 checks passed
@Mytherin Mytherin deleted the chrisiou-generate-settings branch December 8, 2024 06:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants