mynameborat commented on a change in pull request #912: SEP-19 : Refactoring 
sideInputs from SamzaContainer to ContainerStorageManager
URL: https://github.com/apache/samza/pull/912#discussion_r260972792
 
 

 ##########
 File path: 
samza-core/src/main/scala/org/apache/samza/storage/ContainerStorageManager.java
 ##########
 @@ -407,14 +789,33 @@ public void stopStores() {
   }
 
   public void shutdown() {
-    this.taskRestoreManagers.forEach((taskInstance, taskRestoreManager) -> {
-        if (taskRestoreManager != null) {
-          LOG.debug("Shutting down task storage manager for taskName: {} ", 
taskInstance);
-          taskRestoreManager.stop();
-        } else {
-          LOG.debug("Skipping task storage manager shutdown for taskName: {}", 
taskInstance);
-        }
-      });
+    // stop all nonsideinputstores including persistent and non-persistent 
stores
+    this.containerModel.getTasks().forEach((taskName, taskModel) ->
+        getNonSideInputStores(taskName).forEach((storeName, store) -> 
store.stop())
+    );
+
+    // stop reading sideInputs
+    this.shutDownSideInputRead = true;
+
+    // stop all sideinput consumers and stores
+    if (sideInputSystemConsumers != null) {
+      this.sideInputSystemConsumers.stop();
+    }
+
+    // cancel all future sideInput flushes, shutdown the executor, and await 
for finish
+    if (sideInputsFlushFuture != null) {
+      sideInputsFlushFuture.cancel(false);
+    }
+    sideInputsFlushExecutor.shutdown();
+    try {
+      
sideInputsFlushExecutor.awaitTermination(SIDE_INPUT_FLUSH_TIMEOUT.toMillis(), 
TimeUnit.MILLISECONDS);
+    } catch (InterruptedException e) {
+      throw new SamzaException("Exception while shutting down side inputs", e);
+    }
+
+    // stop all sideInputStores -- this will perform one last flush on the KV 
stores, and write the offset file
+    
this.sideInputStorageManagers.values().stream().collect(Collectors.toSet()).
 
 Review comment:
   nit: reuse getSideInputStorageManagers()

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

Reply via email to