becketqin commented on a change in pull request #7262: [FLINK-10478] Kafka
Producer wrongly formats % for transaction ID
URL: https://github.com/apache/flink/pull/7262#discussion_r305563931
##########
File path:
flink-connectors/flink-connector-kafka-0.11/src/main/java/org/apache/flink/streaming/connectors/kafka/internal/TransactionalIdsGenerator.java
##########
@@ -55,7 +55,7 @@ public TransactionalIdsGenerator(
checkArgument(safeScaleDownFactor > 0);
checkArgument(subtaskIndex >= 0);
- this.prefix = checkNotNull(prefix);
+ this.prefix = checkNotNull(prefix).replaceAll("%", "%%");
Review comment:
@leesf I meant we could change `String.format(prefix + "-%d",
transactionalId);` to `String.format(prefix.replaceAll("%", "%%") + ā-%dā,
transactionalId;` Since the only reason we need to replace % with %% is this
case, then it might be better to limit the impact to this case. Otherwise, it
may sometimes cause confusion. For example, if users take a heap dump, they may
see the value of the variable `prefix` different from the value they have in
the config.
If we want to avoid replacing a string every time when creating a new
transactional ID (this is probably not a big issue), maybe a separate variable
like `prefixForStringFormat` would be clearer.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services