vitess icon indicating copy to clipboard operation
vitess copied to clipboard

VReplication: make flags workflow-specific and dynamically changeable

Open rohit-nayak-ps opened this issue 6 months ago • 1 comments

Description

Currently several configuration options for VReplication Workflows are vttablet flags. This means that any change requires restarts of vttablets. This PR allows Workflow Update to set these flags for a specific workflow. On a workflow init the config changes are merged into the default values (which are the ones specified via the vttablet flags).

A major refactor was required to pass the config through to the various components where the vttablet flag values were directly used.

Note:

  • Any change to the configuration should be made via WorkflowUpdate, otherwise the existing controllers will not pick up the new values.

Todos

  • [ ] Add flags to MoveTables/Reshard
  • [ ] Pass flags to VStreamer: this will be done after https://github.com/vitessio/vitess/pull/16593 is merged since that already adds options to the required APIs and mocks

Persistence

A new sub-object config has been added to the options json document column in _vt.vreplication. This is a map of key/value pairs with the key being the flag name and value a string representation of the value. Appropriate serialization and deserialization is done while storing the values and reading it back.

Related Changes

  • When ever a workflow starts the controller loads the config values into its local scope
  • The flag variables have been made private except for a few yet to be migrated (todo: list all)
  • All code locations which accessed the flag values have been modified to use the locally scoped values
  • Tests and API signature changes required a lot of related tedious code change

List of all dynamic flags

S. No. Flag Name Current Default Value
1 vreplication_max_time_to_retry_on_error 0s
2 vstream_dynamic_packet_size true
3 vreplication_net_write_timeout 600
4 vreplication_heartbeat_update_interval 1
5 vreplication-parallel-insert-workers 1
6 vstream_packet_size 250000
7 vreplication_experimental_flags 3
8 vreplication_retry_delay 5s
9 relay_log_max_size 250000
10 vstream_binlog_rotation_threshold 67108864
11 vreplication_store_compressed_gtid false
12 vreplication_net_read_timeout 300
13 vreplication_copy_phase_duration 1h
14 relay_log_max_items 5000
15 vreplication_replica_lag_tolerance 1m

Related Issue(s)

https://github.com/vitessio/vitess/issues/16489

Checklist

  • [ ] "Backport to:" labels have been added if this change should be back-ported to release branches
  • [ ] If this change is to be back-ported to previous releases, a justification is included in the PR description
  • [ ] Tests were added or are not required
  • [ ] Did the new or modified tests pass consistently locally and on CI?
  • [ ] Documentation was added or is not required

rohit-nayak-ps avatar Aug 12 '24 08:08 rohit-nayak-ps