...
Introduce the flink-config.yaml configuration file as the next generation of Flink configuration files. When flink-config.yaml exists in the Flink conf directory, Flink will use the standard YAML parser to parse it as the Flink configuration.
Modify the Flink packaging process so that when generating flink-dist, the flink-conf.yaml file is no longer generated in the conf directory. Instead, a flink-config.yaml file that conforms to the standard YAML syntax will be generated.
For compatibility reasons, in Flink 1.x, if the old configuration file flink-conf.yaml exists in the Flink conf directory, Flink will ignore the new configuration file flink-config.yaml and use the old parser to parse flink-conf.yaml as the Flink configuration. In Flink 2.x, Flink will no longer support parsing the old configuration file flink-conf.yaml.
To reduce the migration barrier for users and improve compatibility, we plan to extend the functionality of the standard YAML parser. The extended functionality will allow the standard YAML parser to parse List or Map type configOptions according to the FLINK-specific pattern.
Compatibility, Deprecation, and Migration Plan
Compatibility:
There is no compatibility issue here because we use different configuration file names to ensure compatibility. The default configuration file will be changed to "flink-config.yaml" and parsed by the standard YAML parser. If users prefer to use the old parser, they can create a "flink-conf.yaml" file in the conf directory.
Note that there are some behavior changes when using the standard YAML parser as followsparser compared to using current Flink parser:
Standard YAML parser
FLINK parser
ConfigOption key
The key of a ConfigOption cannot be a prefix of another option's key.
No requirements.
Comment
Comments must be separated from other tokens by white space characters.
Anything after the '#' symbol is considered a comment.
Null value
Parses null or blank values as null value.
Anything after the first ':' symbol is treated as a string type value, except for blank values.
that need to be escaped when used in valueStandard YAML have some indicator characters and it is necessary to escape it in quotes to indicate that it is a string type when they used as part of a string value.Special characters
The indicator characters in standard YAML are as follows, and more details can be referred to at: https://yaml.org/spec/1.2.2/.
If you want to use the following special characters as a part of a string value, you need to escape them by using quotation marks.
- -
- ?
- :
- ,
- [
- ]
- {
- }
- #
- &
- *
- !
- |
- >
- '
- "
- %
- @
Currently, there are some special characters in the FLINK parser, as follows:
FLINK parser require escape values by quotes when the config option key is List type or Map type has some special characters:
- ": " (a colon and a whitespace)
- In the FLINK parser, the first ": " in a key-value pair is considered as the delimiter between the key and value, while the remaining ": " will be treated as a part of the value.
- '#'
- In the FLINK parser, anything after the first '#' is considered as a comment and cannot be included as a part of the key-value pair.
List type: When - ';'
- When using the List type In the ConfigOption,
- the semicolon (;) is used as the delimiter between List elements. If you want to include ';' as a part of
the value rather than a separator for list elements.Map type: - an element value, you need to escape it using quotation marks.
- ','
- When using the Map type In the ConfigOption,
When - the comma (,) is used as the delimiter between map elements, If you want to include ',' as a part of the value
rather than a separator for Map elementsWhen - , you need to escape it using quotation marks.
- ':'
- When using the Map type In the ConfigOption, the colon (:) is used as the delimiter between key and value in the map, If you want to include ':' as a part of the
value rather than a separator for key-value pairs - value, you need to escape it using quotation marks.
Duplicate key
Standard YAML does not allow duplicate keys in a map. It states that "The content of a mapping node is an unordered set of key/value node pairs, with the restriction that each of the keys is unique." For more details, please refer to: https://yaml.org/spec/1.2.2/#nodes.
FLINK parser allows users to configure duplicate keys, where the key-value pair that appears later in the file will override the earlier key-value pair.
Sequences style
Standard YAML has two styles for sequences, as follows:
- Flow Style:
- Flowsequence content is denoted by surrounding “
[
” and “]
” characters. Sequence entries are separated by a “,
” character. More details can refer to: https://yaml.org/spec/1.2.2/#741-flow-sequences
- Flowsequence content is denoted by surrounding “
- Blocking Style:
A block sequence is simply a series of nodes, each denoted by a leading “
-
” indicator. The “-
” indicator must be separated from the node by white space. This allows “-
” to be used as the first character in a plain scalar if followed by a non-space character (e.g. “-42
”). More details can refer to: https://yaml.org/spec/1.2.2/#821-block-sequences.
The sequence style in FLINK parser is separated by ";" (semicolon).
For example: A;B;C.
Mapping style
Standard YAML has two styles for Mapping, as follows:
- Flow Style:
- Flow mappings are denoted by surrounding “
{
” and “}
” characters. Mapping entries are separated by a “,” character. More details can refer to: https://yaml.org/spec/1.2.2/#742-flow-mappings
- Flow mappings are denoted by surrounding “
- Blocking Style:
A Block mapping is a series of entries, each presenting a key/value pair and more details can refer to: https://yaml.org/spec/1.2.2/#822-block-mappings.
The Mapping style in FLINK parser separates key-value pairs using ":" (colon), and different key-value pairs are separated by "," (comma).
For example: k1:v1, k2:v2, k3:v3.
Deprecation:
The old configuration file "flink-conf.yaml" will be deprecated by announcing this change in the release notes and user documentation.
Migration Plan:
In FLINK-2.0, the old parser will no longer be supported, nor will the flink-conf.yaml file be used as a configuration file.
...