@@ -179,9 +179,6 @@ public final class StreamingDataflowWorker {
179179 // Experiment make the monitor within BoundedQueueExecutor fair
180180 public static final String BOUNDED_QUEUE_EXECUTOR_USE_FAIR_MONITOR_EXPERIMENT =
181181 "windmill_bounded_queue_executor_use_fair_monitor" ;
182- // Don't use. Experiment guarding multi key bundles. The feature is work in progress and
183- // incomplete.
184- private static final String UNSTABLE_ENABLE_MULTI_KEY_BUNDLE = "unstable_enable_multi_key_bundle" ;
185182
186183 private final WindmillStateCache stateCache ;
187184 private AtomicReference <StreamingWorkerStatusPages > statusPages = new AtomicReference <>();
@@ -211,7 +208,7 @@ public final class StreamingDataflowWorker {
211208 private StreamingDataflowWorker (
212209 WindmillServerStub windmillServer ,
213210 long clientId ,
214- ComputationConfig . Fetcher configFetcher ,
211+ Fetcher configFetcher ,
215212 ComputationStateCache computationStateCache ,
216213 WindmillStateCache windmillStateCache ,
217214 BoundedQueueExecutor workUnitExecutor ,
@@ -228,7 +225,8 @@ private StreamingDataflowWorker(
228225 GrpcWindmillStreamFactory windmillStreamFactory ,
229226 ScheduledExecutorService activeWorkRefreshExecutorFn ,
230227 ConcurrentMap <String , StageInfo > stageInfoMap ,
231- @ Nullable GrpcDispatcherClient dispatcherClient ) {
228+ @ Nullable GrpcDispatcherClient dispatcherClient ,
229+ MultiKeyBundleOptions multiKeyBundleOptions ) {
232230 // Register standard file systems.
233231 FileSystems .setDefaultPipelineOptions (options );
234232 this .configFetcher = configFetcher ;
@@ -257,6 +255,7 @@ private StreamingDataflowWorker(
257255 this .streamingWorkScheduler =
258256 StreamingWorkScheduler .create (
259257 options ,
258+ multiKeyBundleOptions ,
260259 clock ,
261260 readerCache ,
262261 mapTaskExecutorFactory ,
@@ -627,7 +626,8 @@ public static StreamingDataflowWorker fromOptions(DataflowWorkerHarnessOptions o
627626 ConcurrentMap <String , StageInfo > stageInfo = new ConcurrentHashMap <>();
628627 StreamingCounters streamingCounters = StreamingCounters .create ();
629628 WorkUnitClient dataflowServiceClient = new DataflowWorkUnitClient (options , LOG );
630- BoundedQueueExecutor workExecutor = createWorkUnitExecutor (options );
629+ MultiKeyBundleOptions multiKeyBundleOptions = MultiKeyBundleOptions .fromOptions (options );
630+ BoundedQueueExecutor workExecutor = createWorkUnitExecutor (options , multiKeyBundleOptions );
631631 ScheduledExecutorService commitFinalizerCleanupExecutor =
632632 Executors .newScheduledThreadPool (
633633 1 ,
@@ -726,7 +726,8 @@ public static StreamingDataflowWorker fromOptions(DataflowWorkerHarnessOptions o
726726 Executors .newSingleThreadScheduledExecutor (
727727 new ThreadFactoryBuilder ().setNameFormat ("RefreshWork" ).build ()),
728728 stageInfo ,
729- configFetcherComputationStateCacheAndWindmillClient .windmillDispatcherClient ());
729+ configFetcherComputationStateCacheAndWindmillClient .windmillDispatcherClient (),
730+ multiKeyBundleOptions );
730731 }
731732
732733 /**
@@ -876,7 +877,8 @@ static StreamingDataflowWorker forTesting(
876877 StreamingCounters streamingCounters ,
877878 WindmillStubFactoryFactory stubFactory ) {
878879 ConcurrentMap <String , StageInfo > stageInfo = new ConcurrentHashMap <>();
879- BoundedQueueExecutor workExecutor = createWorkUnitExecutor (options );
880+ MultiKeyBundleOptions multiKeyBundleOptions = MultiKeyBundleOptions .fromOptions (options );
881+ BoundedQueueExecutor workExecutor = createWorkUnitExecutor (options , multiKeyBundleOptions );
880882 ScheduledExecutorService commitFinalizerCleanupExecutor =
881883 Executors .newScheduledThreadPool (
882884 1 ,
@@ -990,7 +992,8 @@ static StreamingDataflowWorker forTesting(
990992 : windmillStreamFactory .build (),
991993 executorSupplier .apply ("RefreshWork" ),
992994 stageInfo ,
993- grpcDispatcherClient );
995+ grpcDispatcherClient ,
996+ multiKeyBundleOptions );
994997 }
995998
996999 private static GrpcWindmillStreamFactory .Builder createGrpcwindmillStreamFactoryBuilder (
@@ -1020,11 +1023,11 @@ private static JobHeader createJobHeader(DataflowWorkerHarnessOptions options, l
10201023 .build ();
10211024 }
10221025
1023- private static BoundedQueueExecutor createWorkUnitExecutor (DataflowWorkerHarnessOptions options ) {
1026+ private static BoundedQueueExecutor createWorkUnitExecutor (
1027+ DataflowWorkerHarnessOptions options , MultiKeyBundleOptions multiKeyBundleOptions ) {
10241028 boolean useFairMonitor =
10251029 DataflowRunner .hasExperiment (options , BOUNDED_QUEUE_EXECUTOR_USE_FAIR_MONITOR_EXPERIMENT );
1026- boolean useKeyGroupWorkQueue =
1027- DataflowRunner .hasExperiment (options , UNSTABLE_ENABLE_MULTI_KEY_BUNDLE );
1030+ boolean useKeyGroupWorkQueue = multiKeyBundleOptions .multiKeyBundleEnabled ();
10281031 return new BoundedQueueExecutor (
10291032 chooseMaxThreads (options ),
10301033 THREAD_EXPIRATION_TIME_SEC ,
@@ -1206,9 +1209,14 @@ private void onCompleteCommit(CompleteCommit completeCommit) {
12061209 computationStateCache
12071210 .getIfPresent (completeCommit .computationId ())
12081211 .ifPresent (
1209- state ->
1212+ state -> {
1213+ if (completeCommit .retryableFailure ()) {
1214+ state .reexecuteActiveWork (completeCommit .shardedKey (), completeCommit .workId ());
1215+ } else {
12101216 state .completeWorkAndScheduleNextWorkForKey (
1211- completeCommit .shardedKey (), completeCommit .workId ()));
1217+ completeCommit .shardedKey (), completeCommit .workId ());
1218+ }
1219+ });
12121220 }
12131221
12141222 @ AutoValue
0 commit comments