Skip to content

Proposal: sys.configuration, a queryable catalog of Druid process configuration #20946

Open

Description

@FrankChen021

Motivation

  • Defaults are invisible. sys.server_properties lists only properties that are explicitly set. You can't see defaults, unset properties, or values a getter normalizes: druid.indexer.tasklock.batchAllocationNumThreads=0 actually runs as 1.
  • Configuration is hard to find. Properties are scattered across docs, extension pages, and code, and some are undocumented.
  • Tools and agents need the real configuration of the running version, not remembered docs.

Proposed changes

Add a system table, sys.configuration, with one row per configuration property per process, including properties that aren't set, showing the configured, effective, and default values.

SET useDruidEngineForSystemTables = TRUE;
SELECT server, property, configured_value, effective_value, default_value, is_changed
FROM sys.configuration
WHERE property LIKE 'druid.sql.planner.%'

Columns

Column Type Description
server VARCHAR Host and port
service_name VARCHAR Service name
node_roles VARCHAR Roles of the process
property VARCHAR Full property name
config_class VARCHAR Java class that holds the property
value_type VARCHAR Declared Java type
value_source VARCHAR PROPERTY (set directly), PARENT_JSON (set inside a parent key's JSON), or DEFAULT (not set)
configured_value VARCHAR Text as written in the runtime properties, before ${...} substitution
effective_value VARCHAR Value the process is using
default_value VARCHAR Value from the config class when nothing is set
is_changed LONG 1 if the effective value differs from the default
is_redacted LONG 1 if values are hidden because the property is sensitive
status VARCHAR AVAILABLE, NOT_INITIALIZED, UNSUPPORTED, CONFLICT, or ERROR
error_message VARCHAR Generic diagnostic

How it works

  • Discovery. Each process lists the properties of every config class bound through JsonConfigProvider, using the same Jackson metadata JsonConfigurator uses to read them. No existing config class or bind call changes.
  • Values. The effective value is read from the config object's getter, so normalization is visible. The default value comes from building the config class with no properties set. Configs the process has never used aren't created: they show NOT_INITIALIZED, but still have defaults.
  • is_changed is computed on the node by comparing typed values, so formatting differences such as PT60S vs PT1M don't count.
  • Redaction. Values are hidden for properties matched by druid.server.hiddenProperties (the rule /status/properties uses) and for secret types such as PasswordProvider. Credentials inside URLs are stripped.
  • Execution. Built on the native system-table framework from feat(sql): add experimental native query support for system tables #20183, so no new API is added. Reading the table requires CONFIG READ, the same as /status/properties.
Detailed semantics

Discovery

  • Walks both the service injector and the startup injector, which holds druid.extensions.*, druid.modules.*, and druid.expressions.*. ServerInjectorBuilder binds the startup injector so the inspector can reach it. Overridden bindings are excluded.
  • JsonConfigProvider gets read-only accessors for its property base, config class, default class, and initialized instance; its instance field becomes volatile.
  • Nested beans are expanded. For polymorphic configs such as druid.cache, the type row and the leaves of the selected subtype are listed.

Values

  • configured_value is read with Properties.getProperty and is not parsed, so PT2M stays PT2M. It is null when the exact key isn't set, the row is redacted, or the type is unsupported.
  • effective_value is read from the getter, else the field. Supported types: primitives, strings, enums, Duration, Period, HumanReadableBytes, and collections of these. Other types are UNSUPPORTED. Serializers are never called.
  • value_source: when both the exact key and a parent JSON key set a leaf, JsonConfigurator applies them in undefined order, so the row shows PARENT_JSON and effective_value is authoritative.

Defaults

  • Built lazily, the way JsonConfigurator would with no properties: the provider's default class if it has one, else {} deserialized into the class. Polymorphic configs use {"type": <selected subtype>}.
  • Injection is limited to objects that already exist or are free to create: constants, already-initialized configs, and RuntimeInfo. Anything else is refused and the config has no default; if it was waiting on an uninitialized config, it is retried later.
  • A construction, injection, or validation failure means no default. It never fails the row.
  • Host-derived defaults, such as the thread count from RuntimeInfo, can differ between nodes.

is_changed

  • Compares Java values with collection equality. A Period without years or months compares by duration.
  • Null when unknown: ERROR, CONFLICT, NOT_INITIALIZED, UNSUPPORTED, or no default. A property explicitly set to its default is 0.
  • Also computed for redacted rows, where it reveals only whether the secret equals its public default.

Status

  • Precedence: ERROR > CONFLICT > NOT_INITIALIZED > UNSUPPORTED > AVAILABLE.
  • CONFLICT: bindings that share a path, such as Client and EscalatedClient, disagree on type, effective value, or default value. Effective and default values are hidden.
  • ERROR: a getter failed, or the node was unreachable. A node-failure row carries only the node identity and a generic message.

Redaction

  • By name: SensitiveProperties. By type: PasswordProvider, DynamicConfigProvider, and write-only properties.
  • By value: URL userinfo and password/pwd parameters are stripped. These rows keep is_redacted = 0.
  • Error messages are always generic.

Execution

  • Components: ConfigurationTableDescriptor and ConfigurationTableDataProvider in server, SystemConfigurationTable in sql.
  • Only connection failures become ERROR rows. Other node errors fail the query.
  • With druid.auth.authorizeSystemTablesDirectly, SYSTEM_TABLE READ on configuration is also required.
  • Requires the framework to be enabled (druid.query.enableDruidEngineForSystemTables and useDruidEngineForSystemTables). There is no fallback.

Rationale

Operational impact

  • A new experimental system table that requires CONFIG READ. No new endpoints and no change to existing behavior.
  • Depends on feat(sql): add experimental native query support for system tables #20183 and is opt-in with it. During a rolling upgrade, keep useDruidEngineForSystemTables off until all services are upgraded.
  • Core changes: read-only accessors on JsonConfigProvider, and one binding in ServerInjectorBuilder.
  • Not covered: properties read directly from Properties, bindInstance objects, dynamic configs, task specs, unloaded extensions, unselected polymorphic subtypes, and loaded keys that match no config, such as typos or removed properties. Those keys remain visible in sys.server_properties.

Future work

  • Generate the configuration docs from config metadata, as QueryContextParameters and ParameterDocumentationGenerator do for query context parameters. A build check would catch docs that drift from code, and the same metadata could add description and since columns.

Example use

On every upgrade, users, or an agent acting for them, can capture all configuration properties that differ from the defaults and compare them with the result from the previous release, to confirm that every change is expected:

SET useDruidEngineForSystemTables = TRUE;
SELECT server, property, effective_value, default_value, status
FROM sys.configuration
WHERE is_changed = 1 OR status = 'ERROR'

Including ERROR rows keeps an unreachable node from looking unchanged. Capturing default_value for all rows, without the filter, and comparing it across the upgrade also catches changes to code defaults.

This catches changes that are easy to miss. For example, #19115 set druid.sql.planner.metadataSegmentPollPeriod=5000 in every bundled Broker runtime.properties, which Docker images and quickstart use. The default in code and in the docs is still 60000. After upgrading, such deployments poll the Coordinator 12 times as often, and nothing announces it. The query returns that row with effective 5000 and default 60000.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions