cadence
cadence copied to clipboard
Decouple StateBuilder from TaskGenerator
What changed?
Decoupled StateBuilder
from TaskGenerator
by moving task generation to Replicate<...>
functions on mutable state. Task generation is needed on both active and passive side, so there is no need to call them separately. There were only a few places where active/passive side differs slightly. For them we can simply pass additional flag modifying that behavior. In particular, more attention is needed for:
-
ReplicateWorkflowExecutionStartedEvent
willGenerateDelayedDecisionTasks
only for passive side. Active side does that separately duringAddFirstDecisionTaskScheduled
. - After rebuilding
GenerateActivityTimerTasks
/GenerateUserTimerTasks
was called. This can be skipped here, and instead call when closing a transaction. Previously it was not done due totransactionPolicy == TransactionPolicyPassive
, now this is removed. And they will be generated for both active/passive cases.
Why?
- Reduced tech debt as indicates by
// TODO merge active & passive task generation
. - This also decouples StateBuilder which makes it possible to further refactor and simplify.
- Task generation is more centralized.
How did you test it? Existing tests
Potential risks
Release notes
Documentation Changes
Pull Request Test Coverage Report for Build 01845b66-af76-468b-b785-8fd9f14ff9ae
- 62 of 71 (87.32%) changed or added relevant lines in 3 files are covered.
- 118 unchanged lines in 16 files lost coverage.
- Overall coverage decreased (-0.06%) to 57.253%
Changes Missing Coverage | Covered Lines | Changed/Added Lines | % |
---|---|---|---|
service/history/execution/mutable_state_decision_task_manager.go | 9 | 12 | 75.0% |
service/history/execution/mutable_state_builder.go | 37 | 43 | 86.05% |
<!-- | Total: | 62 | 71 |
Files with Coverage Reduction | New Missed Lines | % |
---|---|---|
common/types/shared.go | 1 | 41.66% |
service/history/execution/mutable_state_builder.go | 1 | 68.81% |
common/task/parallelTaskProcessor.go | 2 | 92.75% |
common/util.go | 2 | 52.44% |
service/history/execution/mutable_state_util.go | 2 | 36.14% |
service/history/task/transfer_active_task_executor.go | 2 | 72.15% |
service/matching/taskListManager.go | 2 | 75.87% |
common/persistence/statsComputer.go | 3 | 93.57% |
common/persistence/serialization/parser.go | 4 | 62.41% |
common/persistence/serialization/thrift_decoder.go | 4 | 53.06% |
<!-- | Total: | 118 |
Totals | |
---|---|
Change from base Build 018451f7-faad-49b3-945b-1604e2186a55: | -0.06% |
Covered Lines: | 85070 |
Relevant Lines: | 148586 |