996
ctx context.Context,
997
request *p.InternalSetWorkflowExecutionRequest,
999
>
batch := d.Session.NewBatch(gocql.LoggedBatch).WithContext(ctx)
1000
>
1001
>
shardID := request.ShardID
1002
>
setSnapshot := request.SetWorkflowSnapshot
1003
>
1004
>
if err := applyWorkflowSnapshotBatchAsReset(batch, shardID, &setSnapshot); err != nil {
1005
return err
1006
}
1007
1008
// Verifies that the RangeID has not changed
1010
>
request.RangeID,
1011
>
request.ShardID,
1012
>
rowTypeShard,
1013
>
rowTypeShardNamespaceID,
1014
>
rowTypeShardWorkflowID,
1015
>
rowTypeShardRunID,
1016
>
defaultVisibilityTimestamp,
1017
>
rowTypeShardTaskID,
1018
>
request.RangeID,
1019
>
)
1020
>
1021
>
conflictRecord := newConflictRecord()
1022
>
applied, conflictIter, err := d.Session.MapExecuteBatchCAS(batch, conflictRecord)
1023
>
if err != nil {
1024
return gocql.ConvertError("SetWorkflowExecution", err)
1025
}
1027
>
_ = conflictIter.Close()
1028
>
}()
1029
1031
executionCASConditions := []executionCASCondition{{
1032
runID: setSnapshot.RunID,