github-actions[bot] commented on code in PR #68307:
URL: https://github.com/apache/doris/pull/68307#discussion_r4079713811
##########
fe/fe-core/src/main/java/org/apache/doris/catalog/Env.java:
##########
@@ -4330,6 +4330,13 @@ public static void
getCreateTableLikeStmt(CreateTableLikeInfo createTableLikeInf
sb.append(" (\n");
int idx = 0;
List<Column> columns = table.getBaseSchema(false);
+ // The emitted statement is parsed again by CREATE TABLE LIKE and by
anyone replaying
+ // SHOW CREATE TABLE, so escape comments for the mode that parse will
run under. Read it
+ // once here: a synced statement is built on the journal replay
thread, which has no
+ // session, and reading the mode per column would clone the whole
SessionVariable each time.
+ // Synced DDL travels to another cluster, so pin it to the default
mode instead, otherwise
+ // the master and a replaying follower would ship different text for
the same table.
+ boolean noBackslashEscapes = !getDdlForSync &&
SqlModeHelper.hasNoBackSlashEscapes();
Review Comment:
[P2] Pin the CCR parser to this canonical SQL mode
This forces synced DDL to ordinary backslash-escape mode, so one stored
backslash is serialized as two. However, `CreateTableRecord` carries only the
SQL, and the current CCR
[`CreateTableOrView`](https://github.com/selectdb/ccr-syncer/blob/d35c41120972c1074ca357656f83ab962baf904d/pkg/ccr/base/spec.go#L615-L634)
->
[`Spec.Exec`](https://github.com/selectdb/ccr-syncer/blob/d35c41120972c1074ca357656f83ab962baf904d/pkg/ccr/base/spec.go#L1210-L1223)
path executes it through a pooled `db.Exec` without setting `sql_mode`. If the
destination global mode includes `NO_BACKSLASH_ESCAPES` before CCR opens its
connection, that session reads both backslashes literally and stores two, so
nested comments still diverge across clusters. This is downstream of the
earlier interactive-mode thread: generation is now canonical, but the
consumer's parse context is not. Please pin ordinary mode and execute CREATE on
the same physical connection (or use a mode-independent representation), then
cover diffe
ring source/target modes.
--
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.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]