Skip to content

Commit

Permalink
[HUDI-5082] Improve the cdc log file name format (#7042)
Browse files Browse the repository at this point in the history
  • Loading branch information
YannByron committed Nov 8, 2022
1 parent bc4c0fc commit 655afdb
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ public class FSUtils {
// Log files are of this pattern - .b5068208-e1a4-11e6-bf01-fe55135034f3_20170101134598.log.1_1-0-1
// Archive log files are of this pattern - .commits_.archive.1_1-0-1
private static final Pattern LOG_FILE_PATTERN =
Pattern.compile("\\.(.+)_(.*)\\.(.+)\\.(\\d+)(_((\\d+)-(\\d+)-(\\d+))(-cdc)?)?");
Pattern.compile("\\.(.+)_(.*)\\.(.+)\\.(\\d+)(_((\\d+)-(\\d+)-(\\d+))(.cdc)?)?");
private static final String LOG_FILE_PREFIX = ".";
private static final int MAX_ATTEMPTS_RECOVER_LEASE = 10;
private static final long MIN_CLEAN_TO_KEEP = 10;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
*/
public class HoodieCDCUtils {

public static final String CDC_LOGFILE_SUFFIX = "-cdc";
public static final String CDC_LOGFILE_SUFFIX = ".cdc";

/* the `op` column represents how a record is changed. */
public static final String CDC_OPERATION_TYPE = "op";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import org.apache.hudi.DataSourceReadOptions._
import org.apache.hudi.DataSourceWriteOptions._
import org.apache.hudi.common.config.HoodieMetadataConfig
import org.apache.hudi.common.model.{HoodieCommitMetadata, HoodieKey, HoodieLogFile, HoodieRecord}
import org.apache.hudi.common.table.cdc.HoodieCDCOperation
import org.apache.hudi.common.table.cdc.{HoodieCDCOperation, HoodieCDCUtils}
import org.apache.hudi.common.table.HoodieTableConfig
import org.apache.hudi.common.table.log.HoodieLogFormat
import org.apache.hudi.common.table.log.block.HoodieDataBlock
Expand Down Expand Up @@ -101,7 +101,8 @@ abstract class HoodieCDCTestBase extends HoodieClientTestBase {
val hoodieWriteStats = commitMetadata.getWriteStats.asScala
hoodieWriteStats.exists { hoodieWriteStat =>
val cdcPaths = hoodieWriteStat.getCdcStats
cdcPaths != null && cdcPaths.nonEmpty
cdcPaths != null && cdcPaths.nonEmpty &&
cdcPaths.keySet().asScala.forall(_.endsWith(HoodieCDCUtils.CDC_LOGFILE_SUFFIX))
}
}

Expand Down

0 comments on commit 655afdb

Please sign in to comment.