scwhittle commented on code in PR #41549:
URL: https://github.com/apache/beam/pull/41549#discussion_r4798951765
##########
runners/google-cloud-dataflow-java/worker/src/main/java/org/apache/beam/runners/dataflow/worker/streaming/harness/FanOutStreamingEngineWorkerHarness.java:
##########
@@ -312,14 +330,26 @@ private synchronized void
consumeWindmillWorkerEndpoints(WindmillEndpoints newWi
newWindmillEndpoints.globalDataEndpoints().size(),
activeMetadataType,
newWindmillEndpoints.type());
- closeStreamsNotIn(newWindmillEndpoints).join();
+ StreamingEngineBackends previousBackends = backends.get();
+ ImmutableMap<String, GlobalDataStreamSender> newGlobalDataStreams =
+ createNewGlobalDataStreams(
+ previousBackends.globalDataStreams(),
newWindmillEndpoints.globalDataEndpoints());
+ // Publish the new global data senders before closing displaced ones so
concurrent side-input
Review Comment:
it seems we shouldn't join the destruction until we've created and installed
the non-global data windmill streams either
any reason not to just join the closeStreamsNotIn future at the very bottom
of this method?
##########
runners/google-cloud-dataflow-java/worker/src/main/java/org/apache/beam/runners/dataflow/worker/streaming/harness/FanOutStreamingEngineWorkerHarness.java:
##########
@@ -249,10 +257,16 @@ private GetDataStream getGlobalDataStream(String
globalDataKey) {
@Override
public synchronized void shutdown() {
Preconditions.checkState(started, "FanOutStreamingEngineWorkerHarness
never started.");
+ synchronized (metadataLock) {
+ if (isShutdown) {
+ return;
+ }
+ isShutdown = true;
+ }
Preconditions.checkNotNull(getWorkerMetadataStream).shutdown();
workerMetadataConsumer.shutdownNow();
// Close all the streams blocking until this completes to not leak
resources.
- closeStreamsNotIn(WindmillEndpoints.none()).join();
+ closeStreamsNotIn(backends.get(), WindmillEndpoints.none()).join();
Review Comment:
before we do this, should we make sure the metadataconsumer is completed so
that no more backends are added? the consumer checks shutdown but then releases
metadatalock so it seems racy.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]