You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@samza.apache.org by GitBox <gi...@apache.org> on 2022/11/16 23:15:47 UTC

[GitHub] [samza] ajothomas commented on a diff in pull request #1642: SAMZA-2769: [PipelineDrain] Add drainMode to DrainNotification

ajothomas commented on code in PR #1642:
URL: https://github.com/apache/samza/pull/1642#discussion_r1024598787


##########
samza-api/src/main/java/org/apache/samza/drain/DrainMode.java:
##########
@@ -0,0 +1,31 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.samza.drain;
+
+/**
+ * Defines the type of drain operation.
+ * */
+public enum DrainMode {
+  /**
+   * Simple drain mode is the default behavior of the drain operation.
+   * All intermediate streams and any samza managed state will be drained and the pipeline will be gracefully shutdown
+   * as a result. User state will not be drained.
+   * */
+  SIMPLE;

Review Comment:
   Done



##########
samza-api/src/main/java/org/apache/samza/drain/DrainNotification.java:
##########
@@ -35,9 +35,23 @@ public class DrainNotification {
    */
   private final String runId;
 
-  public DrainNotification(UUID uuid, String runId) {
+  /***/
+  private final DrainMode drainMode;
+
+  public DrainNotification(UUID uuid, String runId, DrainMode drainMode) {
+    Preconditions.checkNotNull(uuid);
+    Preconditions.checkNotNull(runId);
+    Preconditions.checkNotNull(drainMode);
     this.uuid = uuid;
     this.runId = runId;
+    this.drainMode = drainMode;
+  }
+
+  /**
+   * Creates a DrainNotification in {@link DrainMode#SIMPLE} mode.
+   * */
+  public static DrainNotification simple(UUID uuid, String runId) {

Review Comment:
   Done



##########
samza-core/src/main/java/org/apache/samza/drain/DrainUtils.java:
##########
@@ -45,6 +45,26 @@ public class DrainUtils {
   private DrainUtils() {
   }
 
+  /**
+   * Writes a {@link DrainNotification} to the underlying metastore. This method should be used by external controllers
+   * to issue a DrainNotification to the JobCoordinator and Samza Containers.
+   * @param metadataStore Metadata store to write drain notification to.
+   *
+   * @return generated uuid for the DrainNotification
+   */
+  public static UUID writeSimpleDrainNotification(MetadataStore metadataStore) {

Review Comment:
   Changed it



-- 
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: commits-unsubscribe@samza.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org