apache / apache/doris-flink-connector

[Bug] Wrong label random generation method leads to illegal doris label

Open
#420 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Java
Stars
385
Forks
279
Avg merge
2d 2h
Merged PRs (30d)
6

Description

### Search before asking

- [X] I had searched in the [issues](https://github.com/apache/incubator-doris/issues?q=is%3Aissue) and found no similar issues.

### Version

Doris:2.1
doris-flink-connector:1.5.0+
Flink:1.16.2
Flink CDC: 3.0.1

### What's Wrong?

I use Flink+Flink CDC to synchronize data from MySQL to Doris.
I found that Doris's label generator generates a label name like this: label _7_test_cust_d547cac0-d2d8-4705-8769-d1a03d364272.
This label contains an illegal "-" hyphen.
Such a label name is not recognized and accepted by Doris.
When you need to clean this label, an error will be generated: Encountered:-
![image](https://github.com/apache/doris-flink-connector/assets/57579439/4ff17c0e-5b02-49cc-8f77-6caafa595ccb)

![image](https://github.com/apache/doris-flink-connector/assets/57579439/937328ce-fcaa-446d-9231-090c8f82e2bd)

By reading the source code, I found that many label generation methods in the LabelGenerator class use the UUID.randomUUID() method to generate random numbers. This is where the "-" symbol is introduced. [1]

[1] UUID is usually a string containing 32 hexadecimal characters in the following form:
550e8400-e29b-41d4-a716-446655440000
Each UUID consists of five parts, separated by hyphens "-".

I think this is a problem and needs to be fixed.

### What You Expected?

Replace the "-" in label with "_" to ensure the generation of a legal random label.

### How to Reproduce?

_No response_

### Anything Else?

_No response_

### Are you willing to submit PR?

- [X] Yes I am willing to submit a PR!

### Code of Conduct

- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)

Contributor guide

Open the contributing guide

Research direction

Start in the LabelGenerator class and inspect the UUID.randomUUID() call sites that produce Doris labels. Confirm the generated labels are accepted by Doris and that hyphens are replaced with underscores, then check the connector's existing tests for coverage of label generation and cleanup.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
database
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
55/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.