hudi icon indicating copy to clipboard operation
hudi copied to clipboard

[SUPPORT]如何让数据尽快的刷新到hudi中呢

Open XXwhite opened this issue 4 years ago • 9 comments

我使用FlinkCDC读取MongoDB的数据写入到hudi中,但是我发现hudi中总数始终比mongo的总数少一部分(几条或者更多),并且很久之后也不会追上,貌似最后一批数据不会马上刷新到hudi中,这可能不是一个问题,但是我想验证数据一致性,请问我该怎么配置,这是我的建表语句,compaction部分的配置貌似没起作用。

CREATE TABLE hudi_hesuan_box(
_id STRING,
gm STRING,
kg TIMESTAMP(3),
kr STRING,
kj STRING,
rs INT,
zt INT,
sg INT,
v BIGINT,
uid STRING,
s INT,
xm STRING,
bg TIMESTAMP(3),
bj STRING,
br STRING,
rlb ARRAY<ROW<_id STRING, md STRING, xm STRING, zj STRING, sj STRING, lx STRING, cj TIMESTAMP(3),s INT>>,
PRIMARY KEY(_id) NOT ENFORCED 
)with(
'connector'='hudi',
'path'= 'hdfs://cdh07:8020/cdc_test/hudi/hesuan_box',
'hoodie.datasource.write.recordkey.field'= '_id',
'hoodie.metadata.enable'='false',
'write.precombine.field'= 'kg',
'write.tasks'= '1',
'write.rate.limit'= '2000',
'table.type'= 'MERGE_ON_READ' ,
'compaction.tasks'= '1',
'compaction.async.enabled'= 'true',
'compaction.trigger.strategy'= 'num_or_time',
'compaction.delta_commits'= '1',
'compaction.delta_seconds'= '120',
'changelog.enabled'= 'true',
'read.streaming.enabled'= 'true',
'read.streaming.check-interval'= '3',
'hive_sync.enable'= 'true',
'hive_sync.mode'= 'hms',
'hive_sync.metastore.uris'= 'thrift://cdh06:9083',
'hive_sync.jdbc_url'= 'jdbc:hive2://cdh11:10000',
'hive_sync.table'= 'hesuan_box',
'hive_sync.db'= 'cdc_test',
'hive_sync.username'= 'hdfs',
'hive_sync.support_timestamp'= 'true'
);

XXwhite avatar Jul 01 '22 02:07 XXwhite

@yihua hello can you help me

XXwhite avatar Jul 01 '22 05:07 XXwhite

If Flink Checkpoints is triggered or the write buffer size is greater than that you set in the options of ’write.batch.size‘, 256MB by default, the data will be flished into the underneath filesystem. You can decrease the checkpoint interval or reduce the value of ’write.batch.size' to flush the data faster

xiaozhch5 avatar Jul 02 '22 07:07 xiaozhch5

@xiaozhch5 @yihua Hudi中数据延迟貌似不是因为Checkpoints,我的表类型是MERGE_ON_READ,我发现hudi并不会按照我的策略('compaction.trigger.strategy'= 'num_or_time')来压缩合并数据,才导致我不能及时看到数据,不知道有没有相关说明?

XXwhite avatar Jul 11 '22 03:07 XXwhite

@XXwhite Can you provide hudi and flink versions?

yuzhaojing avatar Jul 19 '22 15:07 yuzhaojing

hudi:0.11.1,flink:1.13.6

XXwhite avatar Jul 20 '22 03:07 XXwhite

hudi:0.11.1,flink:1.13.6

@yuzhaojing

XXwhite avatar Aug 08 '22 07:08 XXwhite

It looks like a bug,i meet this too. flink 1.13.3 ,hudi 0.11.1, hive 2.1.1 'compaction.trigger.strategy'= num_or_time 'compaction.delta_commits'= '1' it is normal when there is a small amount of data, but when I with the mysql CDC sink 10 million datas, every time there will be no compactions file, so,The data queried by the Hive is low

sunmingqiaa avatar Aug 09 '22 02:08 sunmingqiaa

@yuzhaojing : can we follow up here please. If its already fixed in already released version of hudi, can we close it out.

nsivabalan avatar Nov 04 '22 02:11 nsivabalan

Yeah, let's close it out, use release 0.12.1 then if there are still problems, feel free to re-open it again ~

danny0405 avatar Nov 04 '22 04:11 danny0405