@@ -172,12 +172,6 @@ workflow_state = ? ` +
172172 `VALUES(?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?` +
173173 `, ?, ?, ?, ?, ?) IF NOT EXISTS `
174174
175- templateCreateWorkflowExecutionWithVersionHistoriesQuery = `INSERT INTO executions (` +
176- `shard_id, namespace_id, workflow_id, run_id, type, ` +
177- `execution, execution_encoding, execution_state, execution_state_encoding, next_event_id, ` +
178- `visibility_ts, task_id, version_histories, version_histories_encoding, checksum, checksum_encoding) ` +
179- `VALUES(?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) IF NOT EXISTS `
180-
181175 templateCreateTransferTaskQuery = `INSERT INTO executions (` +
182176 `shard_id, type, namespace_id, workflow_id, run_id, transfer, transfer_encoding, visibility_ts, task_id) ` +
183177 `VALUES(?, ?, ?, ?, ?, ?, ?, ?, ?)`
@@ -203,7 +197,7 @@ workflow_state = ? ` +
203197
204198 templateGetWorkflowExecutionQuery = `SELECT execution, execution_encoding, execution_state, execution_state_encoding, next_event_id, replication_metadata, replication_metadata_encoding, activity_map, activity_map_encoding, timer_map, timer_map_encoding, ` +
205199 `child_executions_map, child_executions_map_encoding, request_cancel_map, request_cancel_map_encoding, signal_map, signal_map_encoding, signal_requested, buffered_events_list, ` +
206- `version_histories, version_histories_encoding, checksum, checksum_encoding ` +
200+ `checksum, checksum_encoding ` +
207201 `FROM executions ` +
208202 `WHERE shard_id = ? ` +
209203 `and type = ? ` +
@@ -275,25 +269,6 @@ workflow_state = ? ` +
275269 `and task_id = ? ` +
276270 `IF next_event_id = ? `
277271
278- templateUpdateWorkflowExecutionWithVersionHistoriesQuery = `UPDATE executions ` +
279- `SET execution = ?` +
280- `, execution_encoding = ?` +
281- `, execution_state = ? ` +
282- `, execution_state_encoding = ? ` +
283- `, next_event_id = ? ` +
284- `, version_histories = ? ` +
285- `, version_histories_encoding = ? ` +
286- `, checksum = ? ` +
287- `, checksum_encoding = ? ` +
288- `WHERE shard_id = ? ` +
289- `and type = ? ` +
290- `and namespace_id = ? ` +
291- `and workflow_id = ? ` +
292- `and run_id = ? ` +
293- `and visibility_ts = ? ` +
294- `and task_id = ? ` +
295- `IF next_event_id = ? `
296-
297272 templateUpdateActivityInfoQuery = `UPDATE executions ` +
298273 `SET activity_map[ ? ] = ?, activity_map_encoding = ? ` +
299274 `WHERE shard_id = ? ` +
@@ -1109,16 +1084,11 @@ func (d *cassandraPersistence) GetWorkflowExecution(request *p.GetWorkflowExecut
11091084 return nil , convertCommonErrors ("GetWorkflowExecution" , err )
11101085 }
11111086
1112- info , replicationState , err := workflowExecutionFromRow (result )
1087+ state , err := mutableStateFromRow (result )
11131088 if err != nil {
11141089 return nil , serviceerror .NewInternal (fmt .Sprintf ("GetWorkflowExecution operation failed. Error: %v" , err ))
11151090 }
11161091
1117- state := & p.InternalWorkflowMutableState {
1118- ExecutionInfo : info ,
1119- ReplicationState : replicationState ,
1120- VersionHistories : p .NewDataBlob (result ["version_histories" ].([]byte ), common .EncodingType (result ["version_histories_encoding" ].(string ))),
1121- }
11221092
11231093 if state .VersionHistories != nil && state .ReplicationState != nil {
11241094 return nil , serviceerror .NewInternal (fmt .Sprintf ("GetWorkflowExecution operation failed. VersionHistories and ReplicationState both are set." ))
@@ -1929,7 +1899,8 @@ func (d *cassandraPersistence) ListConcreteExecutions(
19291899 continue
19301900 }
19311901 if _ , ok := result ["execution" ]; ok {
1932- wfInfo , _ , _ := workflowExecutionFromRow (result )
1902+ state , _ := mutableStateFromRow (result )
1903+ wfInfo := state .ExecutionInfo
19331904 response .ExecutionInfos = append (response .ExecutionInfos , wfInfo )
19341905 }
19351906 result = make (map [string ]interface {})
@@ -2806,30 +2777,30 @@ func (d *cassandraPersistence) RangeDeleteReplicationTaskFromDLQ(
28062777 return nil
28072778}
28082779
2809- func workflowExecutionFromRow (result map [string ]interface {}) (* p.InternalWorkflowExecutionInfo , * persistenceblobs. ReplicationState , error ) {
2780+ func mutableStateFromRow (result map [string ]interface {}) (* p.InternalWorkflowMutableState , error ) {
28102781 eiBytes , ok := result ["execution" ].([]byte )
28112782 if ! ok {
2812- return nil , nil , newPersistedTypeMismatchError ("execution" , "" , eiBytes , result )
2783+ return nil , newPersistedTypeMismatchError ("execution" , "" , eiBytes , result )
28132784 }
28142785
28152786 eiEncoding , ok := result ["execution_encoding" ].(string )
28162787 if ! ok {
2817- return nil , nil , newPersistedTypeMismatchError ("execution_encoding" , "" , eiEncoding , result )
2788+ return nil , newPersistedTypeMismatchError ("execution_encoding" , "" , eiEncoding , result )
28182789 }
28192790
28202791 protoInfo , err := serialization .WorkflowExecutionInfoFromBlob (eiBytes , eiEncoding )
28212792 if err != nil {
2822- return nil , nil , err
2793+ return nil , err
28232794 }
28242795
28252796 nextEventID , ok := result ["next_event_id" ].(int64 )
28262797 if ! ok {
2827- return nil , nil , newPersistedTypeMismatchError ("next_event_id" , "" , nextEventID , result )
2798+ return nil , newPersistedTypeMismatchError ("next_event_id" , "" , nextEventID , result )
28282799 }
28292800
28302801 protoState , err := protoExecutionStateFromRow (result )
28312802 if err != nil {
2832- return nil , nil , err
2803+ return nil , err
28332804 }
28342805
28352806 info := p .ProtoWorkflowExecutionToPartialInternalExecution (protoInfo , protoState , nextEventID )
@@ -2838,13 +2809,18 @@ func workflowExecutionFromRow(result map[string]interface{}) (*p.InternalWorkflo
28382809 if protoInfo .ReplicationData != nil {
28392810 protoReplVersions , err := ProtoReplicationVersionsFromResultMap (result )
28402811 if err != nil {
2841- return nil , nil , err
2812+ return nil , err
28422813 }
28432814
28442815 state = ReplicationStateFromProtos (protoInfo , protoReplVersions )
28452816 }
28462817
2847- return info , state , nil
2818+ mutableState := & p.InternalWorkflowMutableState {
2819+ ExecutionInfo : info ,
2820+ ReplicationState : state ,
2821+ VersionHistories : protoInfo .VersionHistories ,
2822+ }
2823+ return mutableState , nil
28482824}
28492825
28502826func ProtoReplicationVersionsFromResultMap (result map [string ]interface {}) (* persistenceblobs.ReplicationVersions , error ) {
0 commit comments