Hi, Dennis

You should send this question to mailbox u...@flink.apache.org, dev is used
to discuss development-related issues.

Back to your question:

- AFAIK, uid will be set up as a random value if not defined. How can I
find the current uid?

Regarding the function of uid, you can see [1] and [2] for more detail. The
framework generates UIDs automatically if they are not set manually, it is
a random value, and it is maybe changed if you modify the job. There is
currently no way to get the UIDs for each operator directly.

- What will happen if I set up a new uid in the code above?

If you set a new uid, and restore from savepoint, the restart may fail
because the old UID can't be found because Kafka source is stateful

- When I want to migrate 'FlinkKafkaConsumer' to 'KafkaSource', is it okay
not to set up 'uid'?

I thinks it is okay.


[1]
https://github.com/apache/flink/blob/dfb9cb851dc1f0908ea6c3ce1230dd8ca2b48733/flink-core/src/main/java/org/apache/flink/configuration/PipelineOptions.java#L70
[2]
https://github.com/apache/flink/blob/dfb9cb851dc1f0908ea6c3ce1230dd8ca2b48733/flink-core/src/main/java/org/apache/flink/api/dag/Transformation.java#L168

Best,
Ron

Dennis Jung <inylov...@gmail.com> 于2023年8月8日周二 10:44写道:

> Hello people,
> As suggested in the following, it seems it is recommended to set 'uid' for
> operators.
>
>
> https://ververica.zendesk.com/hc/en-us/articles/360010248879-Should-I-call-uid-after-addSource-or-addSink-
>
> Currently there is an existing personal project which uses
> 'FlinkKafkaConsumer'(it is a deprecated feature) to consume data from
> Kafka, which 'uid' is not configured.
>
> '''
> ...
> FlinkKafkaConsumer kc = ... ;
> DataStream<T> ds = env.addSource(kc, "flink-kafka-source");
> '''
>
> - AFAIK, uid will be set up as a random value if not defined. How can I
> find the current uid?
> - What will happen if I set up a new uid in the code above?
> - When I want to migrate 'FlinkKafkaConsumer' to 'KafkaSource', is it okay
> not to set up 'uid'?
>
> Thanks.
>

Reply via email to