Skip to content

Conversation

@mandesero
Copy link
Contributor

This patch adds the ability to keep and adjust the cluster declarative configuration with cluster:modify_config(), and then apply the changes later via cluster:apply_config_changes() without passing an explicit config.

Motivation

Instead of overloading cluster:sync(...), I decided to introduce a dedicated method :apply_config_changes(). This avoids awkward patterns such as:

  • cluster:sync(nil, opts)
  • cluster:sync(cluster:modify_config():<some-conf>:config(), opts)
  • or other ad-hoc workarounds.

Usage example

local c = cluster:new(config, opts)
c:start()
-- <..do workload..>

c:modify_config()
    :set_global_option('replication.failover', 'manual')
c:apply_config_changes(<..maybe-opts..>)

-- <..do workload..>

Backward compatibility

The old API continues to work.
However, to avoid ambiguous states when using the new API, the following rules now apply:

  • If modify_config() has been used and the changes were not committed via apply_config_changes(), calling:

    • c:sync(new_config, opts),
    • c:reload(new_config)

    will raise an exception.

  • New c:config() returns the last applied configuration, so calling it while there is an uncommitted builder also raises an exception.

This ensures the cluster object never ends up in a half-modified state.


That said, I’m open to discussion if this behavior doesn’t fully meet expectations for this feature.

Closes #426

@mandesero mandesero requested a review from locker November 24, 2025 09:53
This patch adds ability to keep and adjust cluster declarative
configuration with `cluster:modify_config()` and apply it later
via `сluster:apply_config_changes()` without passing an explicit
config.

Closes tarantool#426
@mandesero mandesero force-pushed the gh-426-cfg-modify-api branch from 12e53a9 to 957276a Compare November 25, 2025 09:11
@mandesero mandesero assigned locker and unassigned mandesero Nov 25, 2025
@locker locker merged commit 9f574e9 into tarantool:master Nov 25, 2025
8 checks passed
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.

cluster: provide cbuilder config modifying API right inside cluster

2 participants