You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hudi.apache.org by GitBox <gi...@apache.org> on 2021/11/04 09:36:27 UTC

[GitHub] [hudi] yuzhaojing commented on a change in pull request #3915: [HUDI-2677] Add DFS based message queue for flink writer

yuzhaojing commented on a change in pull request #3915:
URL: https://github.com/apache/hudi/pull/3915#discussion_r742669034



##########
File path: hudi-flink/src/main/java/org/apache/hudi/sink/message/MessageBus.java
##########
@@ -0,0 +1,173 @@
+/*
+ * 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.hudi.sink.message;
+
+import org.apache.hudi.common.fs.FSUtils;
+import org.apache.hudi.common.table.HoodieTableMetaClient;
+import org.apache.hudi.common.util.FileIOUtils;
+import org.apache.hudi.common.util.ValidationUtils;
+import org.apache.hudi.util.StreamerUtil;
+
+import org.apache.hadoop.fs.FSDataInputStream;
+import org.apache.hadoop.fs.FileSystem;
+import org.apache.hadoop.fs.Path;
+
+import java.io.IOException;
+import java.nio.charset.StandardCharsets;
+
+/**
+ * A message bus for transferring the checkpoint messages.
+ *
+ * <p>Each time the driver starts a new instant, it writes a commit message into the bus, the write tasks
+ * then consume the message and unblocking the data flush.
+ *
+ * <p>Why we use the DFS based message queue instead of sending
+ * the {@link org.apache.flink.runtime.operators.coordination.OperatorEvent} ?
+ * The write task handles the operator event using the main mailbox executor which has the lowest priority for mails,
+ * it is also used to process the inputs. When the write task blocks and waits for the operator event to ack the valid instant to write,
+ * it actually blocks all the following events in the mailbox, the operator event can never be consumed then it causes deadlock.
+ *
+ * <p>The message bus is also more lightweight than the active timeline.
+ */
+public abstract class MessageBus implements AutoCloseable {
+
+  public static final long INITIAL_CKP_ID = 0L;
+
+  public static final String ABORTED_CKP_INSTANT = "aborted";
+
+  protected static final int MESSAGE_QUEUE_LENGTH = 20;
+
+  protected static final int CLIENT_MESSAGE_CACHE_SIZE = 10;

Review comment:
       Should we add these Config in FlinkOptions?




-- 
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@hudi.apache.org

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