-
Notifications
You must be signed in to change notification settings - Fork 188
*: add etcd key for start-relay
without worker name
#2249
Conversation
[REVIEW NOTIFICATION] This pull request has been approved by:
To complete the pull request process, please ask the reviewers in the list to review by filling The full list of commands accepted by this bot can be found here. Reviewer can indicate their review by submitting an approval review. |
@@ -275,3 +275,5 @@ func upgradeToVer3(ctx context.Context, cli *clientv3.Client) error { | |||
func upgradeToVer4(cli *clientv3.Client, uctx Context) error { | |||
return nil | |||
} | |||
|
|||
// TODO: should we set UpstreamEnableRelayKeyAdapter when upgrading from <2.0.2 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I prefer not, user will not aware of this behaviour if we automatically do for him, so when he adds new sources he will not meet expectation.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sgtm
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe it's OK if we automatically start-relay for source added before upgrading. And for newly added sources, operate-source
will return a message to notify user 🤔
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If a source with enable-relay: true
has to be automatically start-relayed after the upgrade.
If the source is added later, the enable-relay
configuration is no longer valid, so you should give him an error and indicate that the configuration has been replaced with the start-relay command. Tell him to remove enable-relay
from the configuration and create it again.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please check the expected behaviour:
case 1)
- in v2.0.1, user creates
enable-relay: true
source - upgrade to v2.1.0. That source should automatically turn on relay log when bound to any workers
- newly added sources should has an ERROR message failing
operate-source create
(QuestionA: WARN message and not failing the command is enough?)
case 2)
- in v2.0.1, user creates
enable-relay: true
source - upgrade to v2.0.7. That source has not automatically turn on relay log
- further upgrade to v2.1.0. That source should also not automatically turn on relay log. And
dmctl export
will writeenable-relay: true
when exporting. (QuestionB: should we writeenable-relay: false
, so that these source config files can be used for this version?)
case 3)
- in v2.0.1, user creates
enable-relay: true
source - upgrade to v2.0.7. That source has not automatically turn on relay log
- user turns on relay log by
start-relay -s <source-id> workerA
- upgrade to v2.1.0. That source should only turn on relay log when bound to workerA
please check if this is expected, and check we don't choose behaviour of questions.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
case 1) QuestionA: report a warning is enough, consider changing to error in future versions
case 2) QuestionB: exported source config should not include enable-relay
, it is invalid.
rest LGTM
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
QuestionB: exported source config should not include
enable-relay
, it is invalid.
dmctl export
is mainly used for downgrading, if we don't write enable-relay
, user will have to adjust the content of every files when downgrading to v2.0.1 to keep relay enabled
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I did not consider this scenario, but I still find it strange that the new version of the software exports the currently obsolete parameters, and there are very few degradations, which may not be a big problem.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK, i'll implement it in next PR.
can you tell me the reason ? actually we already update the user input source-cfg when they Line 164 in 4327e5c
|
currently we don't want to start relay for |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i am not sure if we need to add some adapter logic with this key when pause/resume relay ?
rest LGTM
@@ -275,3 +275,5 @@ func upgradeToVer3(ctx context.Context, cli *clientv3.Client) error { | |||
func upgradeToVer4(cli *clientv3.Client, uctx Context) error { | |||
return nil | |||
} | |||
|
|||
// TODO: should we set UpstreamEnableRelayKeyAdapter when upgrading from <2.0.2 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sgtm
func (s *Scheduler) recoverRelayConfigs(cli *clientv3.Client) error { | ||
relayWorkers, _, err := ha.GetAllRelayConfig(cli) | ||
if err != nil { | ||
return err | ||
} | ||
s.relayWorkers = relayWorkers | ||
sources, _, err := ha.GetAllEnabledRelaySources(cli) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can we add a test when Scheduler
start ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
in next PR, when this field can really take effect
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i am not sure if we need to add some adapter logic with this key when pause/resume relay ?
The pause/resume action will change the status of all relay workers, and this key helps to create relay worker, not sure what logic you want to add
func (s *Scheduler) recoverRelayConfigs(cli *clientv3.Client) error { | ||
relayWorkers, _, err := ha.GetAllRelayConfig(cli) | ||
if err != nil { | ||
return err | ||
} | ||
s.relayWorkers = relayWorkers | ||
sources, _, err := ha.GetAllEnabledRelaySources(cli) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
in next PR, when this field can really take effect
@@ -275,3 +275,5 @@ func upgradeToVer3(ctx context.Context, cli *clientv3.Client) error { | |||
func upgradeToVer4(cli *clientv3.Client, uctx Context) error { | |||
return nil | |||
} | |||
|
|||
// TODO: should we set UpstreamEnableRelayKeyAdapter when upgrading from <2.0.2 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe it's OK if we automatically start-relay for source added before upgrading. And for newly added sources, operate-source
will return a message to notify user 🤔
/run-integration-test |
/run-unit-test |
/cc @GMHDBJD |
replaced by https://github.com/pingcap/ticdc/pull/3190 |
What problem does this PR solve?
part of #2241. The rest work will be done in another PR after #2219 is merged to reduce conflict.
What is changed and how it works?
as title, this key is just a marker like
enable-relay
in source config. But we'll dynamically change the value, and we should not modify the original input source config, so I persist it in etcd.Check List
Tests
Code changes
Side effects
Related changes