178
ctx context.Context,
179
request *p.InternalAddHistoryTasksRequest,
181
>
batch := d.Session.NewBatch(gocql.LoggedBatch).WithContext(ctx)
182
>
183
>
if err := applyTasks(
184
>
batch,
185
>
request.ShardID,
186
>
request.Tasks,
187
>
); err != nil {
188
return err
189
}
190
192
>
request.RangeID,
193
>
request.ShardID,
194
>
rowTypeShard,
195
>
rowTypeShardNamespaceID,
196
>
rowTypeShardWorkflowID,
197
>
rowTypeShardRunID,
198
>
defaultVisibilityTimestamp,
199
>
rowTypeShardTaskID,
200
>
request.RangeID,
201
>
)
202
>
203
>
previous := make(map[string]any)
204
>
applied, iter, err := d.Session.MapExecuteBatchCAS(batch, previous)
205
>
if err != nil {
206
return gocql.ConvertError("AddTasks", err)
207
}
209
>
_ = iter.Close()
210
>
}()
211
213
if previousRangeID, ok := previous["range_id"].(int64); ok && previousRangeID != request.RangeID {
214
// CreateWorkflowExecution failed because rangeID was modified