Skip to content

Commit

Permalink
Drop pointer on binary checksum fields (#3943)
Browse files Browse the repository at this point in the history
  • Loading branch information
vytautas-karpavicius authored Feb 1, 2021
1 parent ece6cac commit b22be7c
Show file tree
Hide file tree
Showing 9 changed files with 51 additions and 51 deletions.
4 changes: 2 additions & 2 deletions common/persistence/persistence-tests/executionManagerTest.go
Original file line number Diff line number Diff line change
Expand Up @@ -1112,7 +1112,7 @@ func (s *ExecutionManagerSuite) TestGetWorkflow() {
testResetPoints := types.ResetPoints{
Points: []*types.ResetPointInfo{
{
BinaryChecksum: common.StringPtr("test-binary-checksum"),
BinaryChecksum: "test-binary-checksum",
RunID: "test-runID",
FirstDecisionCompletedID: common.Int64Ptr(123),
CreatedTimeNano: common.Int64Ptr(456),
Expand Down Expand Up @@ -3041,7 +3041,7 @@ func (s *ExecutionManagerSuite) TestContinueAsNew() {
testResetPoints := types.ResetPoints{
Points: []*types.ResetPointInfo{
{
BinaryChecksum: common.StringPtr("test-binary-checksum"),
BinaryChecksum: "test-binary-checksum",
RunID: "test-runID",
FirstDecisionCompletedID: common.Int64Ptr(123),
CreatedTimeNano: common.Int64Ptr(456),
Expand Down
2 changes: 1 addition & 1 deletion common/persistence/serializer_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ func (s *cadenceSerializerSuite) TestSerializer() {
resetPoints0 := &types.ResetPoints{
Points: []*types.ResetPointInfo{
{
BinaryChecksum: common.StringPtr("bad-binary-cs"),
BinaryChecksum: "bad-binary-cs",
RunID: "test-run-id",
FirstDecisionCompletedID: common.Int64Ptr(123),
CreatedTimeNano: common.Int64Ptr(456),
Expand Down
2 changes: 1 addition & 1 deletion common/testing/history_event_util.go
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ func InitializeHistoryEventGenerator(
ScheduledEventID: lastEvent.GetDecisionTaskStartedEventAttributes().ScheduledEventID,
StartedEventID: lastEvent.EventID,
Identity: identity,
BinaryChecksum: common.StringPtr(checksum),
BinaryChecksum: checksum,
}
return historyEvent
})
Expand Down
24 changes: 12 additions & 12 deletions common/types/mapper/thrift/shared.go
Original file line number Diff line number Diff line change
Expand Up @@ -1044,7 +1044,7 @@ func FromDecisionTaskCompletedEventAttributes(t *types.DecisionTaskCompletedEven
ScheduledEventId: t.ScheduledEventID,
StartedEventId: t.StartedEventID,
Identity: &t.Identity,
BinaryChecksum: t.BinaryChecksum,
BinaryChecksum: &t.BinaryChecksum,
}
}

Expand All @@ -1058,7 +1058,7 @@ func ToDecisionTaskCompletedEventAttributes(t *shared.DecisionTaskCompletedEvent
ScheduledEventID: t.ScheduledEventId,
StartedEventID: t.StartedEventId,
Identity: t.GetIdentity(),
BinaryChecksum: t.BinaryChecksum,
BinaryChecksum: t.GetBinaryChecksum(),
}
}

Expand Down Expand Up @@ -1235,7 +1235,7 @@ func FromDecisionTaskFailedEventAttributes(t *types.DecisionTaskFailedEventAttri
BaseRunId: &t.BaseRunID,
NewRunId: &t.NewRunID,
ForkEventVersion: t.ForkEventVersion,
BinaryChecksum: t.BinaryChecksum,
BinaryChecksum: &t.BinaryChecksum,
}
}

Expand All @@ -1254,7 +1254,7 @@ func ToDecisionTaskFailedEventAttributes(t *shared.DecisionTaskFailedEventAttrib
BaseRunID: t.GetBaseRunId(),
NewRunID: t.GetNewRunId(),
ForkEventVersion: t.ForkEventVersion,
BinaryChecksum: t.BinaryChecksum,
BinaryChecksum: t.GetBinaryChecksum(),
}
}

Expand Down Expand Up @@ -3355,7 +3355,7 @@ func FromPollForDecisionTaskRequest(t *types.PollForDecisionTaskRequest) *shared
Domain: &t.Domain,
TaskList: FromTaskList(t.TaskList),
Identity: &t.Identity,
BinaryChecksum: t.BinaryChecksum,
BinaryChecksum: &t.BinaryChecksum,
}
}

Expand All @@ -3368,7 +3368,7 @@ func ToPollForDecisionTaskRequest(t *shared.PollForDecisionTaskRequest) *types.P
Domain: t.GetDomain(),
TaskList: ToTaskList(t.TaskList),
Identity: t.GetIdentity(),
BinaryChecksum: t.BinaryChecksum,
BinaryChecksum: t.GetBinaryChecksum(),
}
}

Expand Down Expand Up @@ -4058,7 +4058,7 @@ func FromResetPointInfo(t *types.ResetPointInfo) *shared.ResetPointInfo {
return nil
}
return &shared.ResetPointInfo{
BinaryChecksum: t.BinaryChecksum,
BinaryChecksum: &t.BinaryChecksum,
RunId: &t.RunID,
FirstDecisionCompletedId: t.FirstDecisionCompletedID,
CreatedTimeNano: t.CreatedTimeNano,
Expand All @@ -4073,7 +4073,7 @@ func ToResetPointInfo(t *shared.ResetPointInfo) *types.ResetPointInfo {
return nil
}
return &types.ResetPointInfo{
BinaryChecksum: t.BinaryChecksum,
BinaryChecksum: t.GetBinaryChecksum(),
RunID: t.GetRunId(),
FirstDecisionCompletedID: t.FirstDecisionCompletedId,
CreatedTimeNano: t.CreatedTimeNano,
Expand Down Expand Up @@ -4393,7 +4393,7 @@ func FromRespondDecisionTaskCompletedRequest(t *types.RespondDecisionTaskComplet
StickyAttributes: FromStickyExecutionAttributes(t.StickyAttributes),
ReturnNewDecisionTask: t.ReturnNewDecisionTask,
ForceCreateNewDecisionTask: t.ForceCreateNewDecisionTask,
BinaryChecksum: t.BinaryChecksum,
BinaryChecksum: &t.BinaryChecksum,
QueryResults: FromWorkflowQueryResultMap(t.QueryResults),
}
}
Expand All @@ -4411,7 +4411,7 @@ func ToRespondDecisionTaskCompletedRequest(t *shared.RespondDecisionTaskComplete
StickyAttributes: ToStickyExecutionAttributes(t.StickyAttributes),
ReturnNewDecisionTask: t.ReturnNewDecisionTask,
ForceCreateNewDecisionTask: t.ForceCreateNewDecisionTask,
BinaryChecksum: t.BinaryChecksum,
BinaryChecksum: t.GetBinaryChecksum(),
QueryResults: ToWorkflowQueryResultMap(t.QueryResults),
}
}
Expand Down Expand Up @@ -4448,7 +4448,7 @@ func FromRespondDecisionTaskFailedRequest(t *types.RespondDecisionTaskFailedRequ
Cause: FromDecisionTaskFailedCause(t.Cause),
Details: t.Details,
Identity: &t.Identity,
BinaryChecksum: t.BinaryChecksum,
BinaryChecksum: &t.BinaryChecksum,
}
}

Expand All @@ -4462,7 +4462,7 @@ func ToRespondDecisionTaskFailedRequest(t *shared.RespondDecisionTaskFailedReque
Cause: ToDecisionTaskFailedCause(t.Cause),
Details: t.Details,
Identity: t.GetIdentity(),
BinaryChecksum: t.BinaryChecksum,
BinaryChecksum: t.GetBinaryChecksum(),
}
}

Expand Down
54 changes: 27 additions & 27 deletions common/types/shared.go
Original file line number Diff line number Diff line change
Expand Up @@ -1594,11 +1594,11 @@ func (v *Decision) GetUpsertWorkflowSearchAttributesDecisionAttributes() (o *Ups

// DecisionTaskCompletedEventAttributes is an internal type (TBD...)
type DecisionTaskCompletedEventAttributes struct {
ExecutionContext []byte `json:"executionContext,omitempty"`
ScheduledEventID *int64 `json:"scheduledEventId,omitempty"`
StartedEventID *int64 `json:"startedEventId,omitempty"`
Identity string `json:"identity,omitempty"`
BinaryChecksum *string `json:"binaryChecksum,omitempty"`
ExecutionContext []byte `json:"executionContext,omitempty"`
ScheduledEventID *int64 `json:"scheduledEventId,omitempty"`
StartedEventID *int64 `json:"startedEventId,omitempty"`
Identity string `json:"identity,omitempty"`
BinaryChecksum string `json:"binaryChecksum,omitempty"`
}

// GetExecutionContext is an internal getter (TBD...)
Expand Down Expand Up @@ -1635,8 +1635,8 @@ func (v *DecisionTaskCompletedEventAttributes) GetIdentity() (o string) {

// GetBinaryChecksum is an internal getter (TBD...)
func (v *DecisionTaskCompletedEventAttributes) GetBinaryChecksum() (o string) {
if v != nil && v.BinaryChecksum != nil {
return *v.BinaryChecksum
if v != nil {
return v.BinaryChecksum
}
return
}
Expand Down Expand Up @@ -1850,7 +1850,7 @@ type DecisionTaskFailedEventAttributes struct {
BaseRunID string `json:"baseRunId,omitempty"`
NewRunID string `json:"newRunId,omitempty"`
ForkEventVersion *int64 `json:"forkEventVersion,omitempty"`
BinaryChecksum *string `json:"binaryChecksum,omitempty"`
BinaryChecksum string `json:"binaryChecksum,omitempty"`
}

// GetScheduledEventID is an internal getter (TBD...)
Expand Down Expand Up @@ -1927,8 +1927,8 @@ func (v *DecisionTaskFailedEventAttributes) GetForkEventVersion() (o int64) {

// GetBinaryChecksum is an internal getter (TBD...)
func (v *DecisionTaskFailedEventAttributes) GetBinaryChecksum() (o string) {
if v != nil && v.BinaryChecksum != nil {
return *v.BinaryChecksum
if v != nil {
return v.BinaryChecksum
}
return
}
Expand Down Expand Up @@ -5203,7 +5203,7 @@ type PollForDecisionTaskRequest struct {
Domain string `json:"domain,omitempty"`
TaskList *TaskList `json:"taskList,omitempty"`
Identity string `json:"identity,omitempty"`
BinaryChecksum *string `json:"binaryChecksum,omitempty"`
BinaryChecksum string `json:"binaryChecksum,omitempty"`
}

// GetDomain is an internal getter (TBD...)
Expand Down Expand Up @@ -5232,8 +5232,8 @@ func (v *PollForDecisionTaskRequest) GetIdentity() (o string) {

// GetBinaryChecksum is an internal getter (TBD...)
func (v *PollForDecisionTaskRequest) GetBinaryChecksum() (o string) {
if v != nil && v.BinaryChecksum != nil {
return *v.BinaryChecksum
if v != nil {
return v.BinaryChecksum
}
return
}
Expand Down Expand Up @@ -6312,18 +6312,18 @@ func (v *RequestCancelWorkflowExecutionRequest) GetRequestID() (o string) {

// ResetPointInfo is an internal type (TBD...)
type ResetPointInfo struct {
BinaryChecksum *string `json:"binaryChecksum,omitempty"`
RunID string `json:"runId,omitempty"`
FirstDecisionCompletedID *int64 `json:"firstDecisionCompletedId,omitempty"`
CreatedTimeNano *int64 `json:"createdTimeNano,omitempty"`
ExpiringTimeNano *int64 `json:"expiringTimeNano,omitempty"`
Resettable *bool `json:"resettable,omitempty"`
BinaryChecksum string `json:"binaryChecksum,omitempty"`
RunID string `json:"runId,omitempty"`
FirstDecisionCompletedID *int64 `json:"firstDecisionCompletedId,omitempty"`
CreatedTimeNano *int64 `json:"createdTimeNano,omitempty"`
ExpiringTimeNano *int64 `json:"expiringTimeNano,omitempty"`
Resettable *bool `json:"resettable,omitempty"`
}

// GetBinaryChecksum is an internal getter (TBD...)
func (v *ResetPointInfo) GetBinaryChecksum() (o string) {
if v != nil && v.BinaryChecksum != nil {
return *v.BinaryChecksum
if v != nil {
return v.BinaryChecksum
}
return
}
Expand Down Expand Up @@ -6803,7 +6803,7 @@ type RespondDecisionTaskCompletedRequest struct {
StickyAttributes *StickyExecutionAttributes `json:"stickyAttributes,omitempty"`
ReturnNewDecisionTask *bool `json:"returnNewDecisionTask,omitempty"`
ForceCreateNewDecisionTask *bool `json:"forceCreateNewDecisionTask,omitempty"`
BinaryChecksum *string `json:"binaryChecksum,omitempty"`
BinaryChecksum string `json:"binaryChecksum,omitempty"`
QueryResults map[string]*WorkflowQueryResult `json:"queryResults,omitempty"`
}

Expand Down Expand Up @@ -6865,8 +6865,8 @@ func (v *RespondDecisionTaskCompletedRequest) GetForceCreateNewDecisionTask() (o

// GetBinaryChecksum is an internal getter (TBD...)
func (v *RespondDecisionTaskCompletedRequest) GetBinaryChecksum() (o string) {
if v != nil && v.BinaryChecksum != nil {
return *v.BinaryChecksum
if v != nil {
return v.BinaryChecksum
}
return
}
Expand Down Expand Up @@ -6907,7 +6907,7 @@ type RespondDecisionTaskFailedRequest struct {
Cause *DecisionTaskFailedCause `json:"cause,omitempty"`
Details []byte `json:"details,omitempty"`
Identity string `json:"identity,omitempty"`
BinaryChecksum *string `json:"binaryChecksum,omitempty"`
BinaryChecksum string `json:"binaryChecksum,omitempty"`
}

// GetTaskToken is an internal getter (TBD...)
Expand Down Expand Up @@ -6944,8 +6944,8 @@ func (v *RespondDecisionTaskFailedRequest) GetIdentity() (o string) {

// GetBinaryChecksum is an internal getter (TBD...)
func (v *RespondDecisionTaskFailedRequest) GetBinaryChecksum() (o string) {
if v != nil && v.BinaryChecksum != nil {
return *v.BinaryChecksum
if v != nil {
return v.BinaryChecksum
}
return
}
Expand Down
2 changes: 1 addition & 1 deletion service/history/execution/mutable_state_builder.go
Original file line number Diff line number Diff line change
Expand Up @@ -1954,7 +1954,7 @@ func (e *mutableStateBuilder) addBinaryCheckSumIfNotExists(
resettable = false
}
info := &types.ResetPointInfo{
BinaryChecksum: common.StringPtr(binChecksum),
BinaryChecksum: binChecksum,
RunID: exeInfo.RunID,
FirstDecisionCompletedID: common.Int64Ptr(event.GetEventID()),
CreatedTimeNano: common.Int64Ptr(e.timeSource.Now().UnixNano()),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -560,7 +560,7 @@ func (m *mutableStateDecisionTaskManagerImpl) AddDecisionTaskFailedEvent(
Details: details,
Identity: identity,
Reason: common.StringPtr(reason),
BinaryChecksum: common.StringPtr(binChecksum),
BinaryChecksum: binChecksum,
BaseRunID: baseRunID,
NewRunID: newRunID,
ForkEventVersion: common.Int64Ptr(forkEventVersion),
Expand Down
10 changes: 5 additions & 5 deletions service/history/execution/mutable_state_util_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,28 +43,28 @@ func TestFindAutoResetPoint(t *testing.T) {
assert.Nil(t, pt)

pt0 := &types.ResetPointInfo{
BinaryChecksum: common.StringPtr("abc"),
BinaryChecksum: "abc",
Resettable: common.BoolPtr(true),
}
pt1 := &types.ResetPointInfo{
BinaryChecksum: common.StringPtr("def"),
BinaryChecksum: "def",
Resettable: common.BoolPtr(true),
}
pt3 := &types.ResetPointInfo{
BinaryChecksum: common.StringPtr("ghi"),
BinaryChecksum: "ghi",
Resettable: common.BoolPtr(false),
}

expiredNowNano := time.Now().UnixNano() - int64(time.Hour)
notExpiredNowNano := time.Now().UnixNano() + int64(time.Hour)
pt4 := &types.ResetPointInfo{
BinaryChecksum: common.StringPtr("expired"),
BinaryChecksum: "expired",
Resettable: common.BoolPtr(true),
ExpiringTimeNano: common.Int64Ptr(expiredNowNano),
}

pt5 := &types.ResetPointInfo{
BinaryChecksum: common.StringPtr("notExpired"),
BinaryChecksum: "notExpired",
Resettable: common.BoolPtr(true),
ExpiringTimeNano: common.Int64Ptr(notExpiredNowNano),
}
Expand Down
2 changes: 1 addition & 1 deletion service/history/historyEngine_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1665,7 +1665,7 @@ func (s *engineSuite) TestRespondDecisionTaskCompletedBadBinary() {
Decisions: decisions,
ExecutionContext: executionContext,
Identity: identity,
BinaryChecksum: common.StringPtr("test-bad-binary"),
BinaryChecksum: "test-bad-binary",
},
})
s.Nil(err, s.printHistory(msBuilder))
Expand Down

0 comments on commit b22be7c

Please sign in to comment.