danny0405 commented on code in PR #11793: URL: https://github.com/apache/hudi/pull/11793#discussion_r1721489236
########## 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. + +## Implementation +### HoodieConfig etc +Added a new configuration item for the HoodieLogBlock streaming read buffer size. The default value is 10MB. +#### Flink +Added a new configuration item to enable LogCompaction. The default value is false. +Note: +1. After Flink enables LogCompaction, the default implementation is MergeSort. +2. Currently, the log format only supports AVRO. After enabling LogCompaction, need to check whether the hoodie.logfile.data.block.format configuration item is correct. + +#### Spark +Added a new configuration item for whether to enable MergeSort in LogCompaction. The default value is false. +Note: +1. Currently, the log format only supports AVRO. After LogCompaction turns on MergeSort, you need to check whether the hoodie.logfile.data.block.format configuration item is correct. + +### DeltaCommit +#### Flink +When LogCompaction is enabled, DeltaCommit sorts the written data by RecordKey to achieve orderly records in LogBlock. Review Comment: We should use the original data type for sorting because string comparison may lose the semantics. We can cast it back to string if needed. -- 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]
