@@ -64,6 +64,7 @@ func init() {
6464 register .Function2x1 (combineIntSum )
6565
6666 register.DoFn3x1 [* sdf.LockRTracker , SourceConfig , func (int64 ), error ]((* intRangeFn )(nil ))
67+ register.DoFn4x1 [context.Context , * sdf.LockRTracker , SourceConfig , func (int64 ), error ]((* slowFailSDF )(nil ))
6768 register .Emitter1 [int64 ]()
6869 register .Emitter2 [int64 , int64 ]()
6970}
@@ -404,3 +405,37 @@ func (fn *selfCheckpointingDoFn) ProcessElement(rt *sdf.LockRTracker, _ []byte,
404405 }
405406 }
406407}
408+
409+ type errorSplitTracker struct {
410+ * offsetrange.Tracker
411+ }
412+
413+ func (t * errorSplitTracker ) TrySplit (fraction float64 ) (any , any , error ) {
414+ return nil , nil , fmt .Errorf ("intentional split error from tracker" )
415+ }
416+
417+ type slowFailSDF struct {}
418+
419+ func (fn * slowFailSDF ) CreateInitialRestriction (config SourceConfig ) offsetrange.Restriction {
420+ return offsetrange.Restriction {Start : 0 , End : config .NumElements }
421+ }
422+
423+ func (fn * slowFailSDF ) SplitRestriction (config SourceConfig , rest offsetrange.Restriction ) []offsetrange.Restriction {
424+ return rest .EvenSplits (config .InitialSplits )
425+ }
426+
427+ func (fn * slowFailSDF ) RestrictionSize (_ SourceConfig , rest offsetrange.Restriction ) float64 {
428+ return rest .Size ()
429+ }
430+
431+ func (fn * slowFailSDF ) CreateTracker (rest offsetrange.Restriction ) * sdf.LockRTracker {
432+ return sdf .NewLockRTracker (& errorSplitTracker {Tracker : offsetrange .NewTracker (rest )})
433+ }
434+
435+ func (fn * slowFailSDF ) ProcessElement (ctx context.Context , rt * sdf.LockRTracker , config SourceConfig , emit func (int64 )) error {
436+ fmt .Println ("DEBUG: slowFailSDF.ProcessElement invoked" )
437+ for i := rt .GetRestriction ().(offsetrange.Restriction ).Start ; rt .TryClaim (i ); i ++ {
438+ <- ctx .Done ()
439+ }
440+ return nil
441+ }
0 commit comments