usberkeley commented on code in PR #11793:
URL: https://github.com/apache/hudi/pull/11793#discussion_r1723391264


##########
rfc/rfc-81/rfc-81.md:
##########
@@ -0,0 +1,108 @@
+<!--
+  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-81: Log Compaction with Merge Sort
+
+## Proposers
+- @usberkeley
+
+## Approvers
+- @danny0405
+
+## Status
+JIRA: https://issues.apache.org/jira/browse/HUDI-8033
+
+## Abstract
+Add lightweight LogCompaction to improve the writing performance of the write 
side, and improve the query performance of the read side (Spark/Presto, etc.) 
in some scenarios without having to wait for heavy and time-consuming 
operations such as Compaction or Clustering.
+
+## Background
+The previous LogCompaction mainly merged log files through 
HoodieMergedLogRecordScanner, and used ExternalSpillableMap internally to 
achieve record merging, which resulted in performance loss of writing to disk.
+LogCompaction with Merge Sort is introduced to achieve lightweight minor 
compaction by merging records through N-way streaming of ordered data, thus 
improving the writing performance of the write side. At the same time, thanks 
to the ordered data, the query performance on the read side can be improved 
when the primary key is met.

Review Comment:
   > Would the additional sorting, add some extra cost on the write? lets 
please call this out.
   
   The additional cost of enabling LogCompaction with Merge Sort, taking the 
Flink MOR table as an example:
   ### Conditions
   1) write.batch.size = 256MB (default value)
   2) Use List#sort (Timsort sorting algorithm)
   ### Assumptions
   1) A record size is 1KB
   2) Worst case, fill the Flink Write Bucket (256MB), that is, 250,000 rows of 
records
   ### Conclusion
   1) CPU: Time complexity O(4,500,000)
   2) Memory: 128MB
   
   ### Remarks:
   1) Calculation formula for time complexity O(4,500,000): Timsort sorting 
algorithm time complexity is O(n logn)
   2) Calculation formula for an additional 128MB of memory: Timsort sorting 
algorithm may need an additional n/2 elements of space for merge operations in 
the worst case



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

Reply via email to