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 2022/05/03 22:22:55 UTC

[GitHub] [hudi] vinothchandar commented on a diff in pull request #5436: [RFC-51] [HUDI-3478] Change Data Capture RFC

vinothchandar commented on code in PR #5436:
URL: https://github.com/apache/hudi/pull/5436#discussion_r864303561


##########
rfc/rfc-51/rfc-51.md:
##########
@@ -0,0 +1,233 @@
+<!--
+  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.
+-->
+
+# RFC-50: Hudi CDC
+
+# Proposers
+
+- @Yann Byron
+
+# Approvers
+
+- @Raymond
+
+# Statue
+JIRA: [https://issues.apache.org/jira/browse/HUDI-3478](https://issues.apache.org/jira/browse/HUDI-3478)
+
+# Hudi Supports Change-Data-Capture
+
+## Abstract
+
+We want to introduce the Change-Data-Capture(CDC) capacity that make hudi can produce the changeing data by which we can know how the records is changed, to response the CDC cases.
+
+
+## Background
+
+In some use cases where hudi tables is used as streaing source, We want to be aware every records' changing in one commit exactly. In a certain commit or snapshot, which records are inserted, which records are deleted, and which records are updated. Even for the updated records, both the old value before updated and the new value after updated are needed.
+
+To implement this capacity, we have to upgrade the write and read parts. Let hudi can figure out the changing data when read. And in some cases, writing the extra data to help querying the changing data if necessary.
+
+## Scenario Definition
+
+Here use a simply case to explain the CDC.
+
+![](scenario-definition.jpg)
+
+Here one metadata column named `_changing_type` is added. It represents that how the record is changed, and it have four enum values:
+
+- update_preimage: The old value before a certain commit;
+- update_postiamge: The new value after a certain commit;
+- insert: a new coming record in a certain commit;
+- delete: a record that has been deleted in a certain commit;
+
+Notice:
+Here the illustration ignores all the metadata columns like `_hoodie_commit_time`.
+
+## Goals
+
+1. Support row-level CDC records generation and persistence;
+1. Support both MOR and COW tables;
+1. Support all the write operations;
+1. Support Spark DataFrame/SQL/Streaming Query;
+
+## Implementation
+### CDC Architecture
+
+![](arch.jpg)
+
+Notice:
+Other operations like `Compact`, `Clean`, `Index` do not write/change any data. So we don't need to consider in CDC scenario.
+ 
+### Config Definitions
+
+|  | default |  |
+| --- | --- | --- |
+| hoodie.table.cdf.enabled | false | if true, write the changing data to FS. |
+|  |  |  |
+| hoodie.datasource.read.cdc.enabled | false | if true, return the CDC data. |
+| hoodie.datasource.read.start.timestamp | - | requried. |
+| hoodie.datasource.read.end.timestamp | - | optional. |
+
+
+### Write
+
+Hoodie writes data by `HoodieWriteHandle`. In the different sub classes of `HoodieWriteHandle`, we will create `FileWriter`which can receive data and save to `FileSystem`. So We can upgrade these sub classes to archieve the CDC data's generation and persistence.
+
+The directory of the CDC file is`tablePath/.cdc/`. The file structure is like:

Review Comment:
   @danny0405 left some comments on the doc. 



-- 
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