Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wire up dynamic config-backed history DLQ #4876

Merged
merged 1 commit into from Sep 27, 2023

Conversation

MichaelSnowden
Copy link
Contributor

What changed?
This is the final PR to actually wire up the history task DLQ.

Note about the PR structure: The merge base is dlq-5-base, but it will be changed to dlq-feature after #4875 is merged. I did it this way because 4875 is a PR against main (because it's independent of the DLQ project), but this PR depends on both that and another PR in the dlq-feature branch.

Why?
I made this so that we can actually use the DLQ. All previous PRs were basically library code--this hooks it up to our main entry point.

How did you test it?
There's an fx test which verifies that any executable we create will use the DLQ iff the dynamic config flag is on.

Potential risks
The dynamic config defaults to false, and I added a comment to not turn it on if you aren't using Cassandra.

Is hotfix candidate?
No.

return &executableToggle{
Executable: e,
executableDLQ: executableDLQ,
useDLQ: d.DC.GetBoolProperty(dynamicconfig.HistoryTaskDLQEnabled, false),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: plz define it in history/configs.Config

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There's a lot of variables in the history/configs.Config object that aren't required by this object, and it seems to be another property bag. Having the DC client where we can specify only the key for the value we need seems like better information-hiding to me. Is there a reason we want to use the Config instead?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

syned offline. Idea is not pass the entire config struct in but define dc functions in a central place so that func can be reused and also easier to find default values for all defined configs. The struct should still take in one config.

Comment on lines 47 to 57
executableToggle struct {
queues.Executable
executableDLQ *queues.ExecutableDLQ
useDLQ dynamicconfig.BoolPropertyFn
}
Copy link
Member

@yycptt yycptt Sep 25, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do you plan to use this struct for other functionalities in the future? If so, it should probably live in a dedicated file, instead of dlq.go. If no, we can move the dc into ExecuableDLQ or rename to DLQToggle?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I want this to be specific to the main entry point because the other unit tests don't need this. Basically, in general, I think feature flags should be decoupled from the feature itself and just wrap them in the main entry point so that we don't end up with a bunch of places in tests where we have to do something like dcOverrides: map[string]interface{}{ dynamicconfig.HistoryTaskDLQEnabled: true }. I also think this should only be a temporary thing because we probably want the DLQ on always once it's tested.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

synced offline, plz rename to executableDLQToggle or something similar.

Copy link
Member

@yycptt yycptt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

plz address the comments before landing.

Comment on lines 47 to 57
executableToggle struct {
queues.Executable
executableDLQ *queues.ExecutableDLQ
useDLQ dynamicconfig.BoolPropertyFn
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

synced offline, plz rename to executableDLQToggle or something similar.

return &executableToggle{
Executable: e,
executableDLQ: executableDLQ,
useDLQ: d.DC.GetBoolProperty(dynamicconfig.HistoryTaskDLQEnabled, false),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

syned offline. Idea is not pass the entire config struct in but define dc functions in a central place so that func can be reused and also easier to find default values for all defined configs. The struct should still take in one config.

@MichaelSnowden MichaelSnowden changed the base branch from snowden/dlq-5-base to snowden/dlq-feature September 27, 2023 21:13
@MichaelSnowden MichaelSnowden merged commit 14605b0 into snowden/dlq-feature Sep 27, 2023
2 of 3 checks passed
@MichaelSnowden MichaelSnowden deleted the snowden/dlq-5 branch September 27, 2023 21:15
mindaugasrukas pushed a commit that referenced this pull request Sep 28, 2023
<!-- Describe what has changed in this PR -->
**What changed?**
This is the final PR to actually wire up the history task DLQ. 

_Note about the PR structure: The merge base is dlq-5-base, but it will
be changed to dlq-feature after
#4875 is merged. I did it
this way because 4875 is a PR against main (because it's independent of
the DLQ project), but this PR depends on both that and another PR in the
dlq-feature branch._

<!-- Tell your future self why have you made these changes -->
**Why?**
I made this so that we can actually use the DLQ. All previous PRs were
basically library code--this hooks it up to our main entry point.

<!-- How have you verified this change? Tested locally? Added a unit
test? Checked in staging env? -->
**How did you test it?**
There's an fx test which verifies that any executable we create will use
the DLQ iff the dynamic config flag is on.

<!-- Assuming the worst case, what can be broken when deploying this
change to production? -->
**Potential risks**
The dynamic config defaults to false, and I added a comment to not turn
it on if you aren't using Cassandra.

<!-- Is this PR a hotfix candidate or require that a notification be
sent to the broader community? (Yes/No) -->
**Is hotfix candidate?**
No.
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.

None yet

2 participants