Skip to content

Commit e5140cd

Browse files
committed
Adjust condition for initializing chasm tree root for new workflows (#8638)
## What changed? Changed the condition to check whether the root component of the chasm tree has been initialized for new workflows ## Why? The root component is never actually empty since we are using `NewEmptyTree` which sets a root component with no type ## How did you test it? - [x] built - [ ] run locally and tested manually - [ ] covered by existing tests - [ ] added new unit test(s) - [ ] added new functional test(s)
1 parent 15acf6d commit e5140cd

File tree

2 files changed

+2
-4
lines changed

2 files changed

+2
-4
lines changed

chasm/tree.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1174,7 +1174,7 @@ func unmarshalProto(
11741174

11751175
value := reflect.New(valueT.Elem())
11761176

1177-
if dataBlob == nil {
1177+
if dataBlob == nil || len(dataBlob.Data) == 0 {
11781178
// If the original data is the zero value of its type, the dataBlob loaded from persistence layer will be nil.
11791179
// But we know for component & data nodes, they won't get persisted in the first place if there's no data,
11801180
// so it must be a zero value.

service/history/workflow/mutable_state_impl.go

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2589,9 +2589,7 @@ func (ms *MutableStateImpl) ApplyWorkflowExecutionStartedEvent(
25892589
root, ok := ms.chasmTree.(*chasm.Node)
25902590
softassert.That(ms.logger, ok, "chasmTree cast failed")
25912591

2592-
validationContext := chasm.NewContext(context.Background(), root)
2593-
_, err := root.Component(validationContext, chasm.ComponentRef{})
2594-
if common.IsNotFoundError(err) {
2592+
if root.Archetype() == "" {
25952593
mutableContext := chasm.NewMutableContext(context.Background(), root)
25962594
root.SetRootComponent(chasmworkflow.NewWorkflow(mutableContext, ms))
25972595
}

0 commit comments

Comments
 (0)