yuqi1129 commented on code in PR #10383:
URL: https://github.com/apache/gravitino/pull/10383#discussion_r2964776902
##########
catalogs-contrib/catalog-jdbc-clickhouse/src/main/java/org/apache/gravitino/catalog/clickhouse/operations/ClickHouseClusterUtils.java:
##########
@@ -36,11 +36,60 @@
* <li>{@code system.databases.cluster} is only populated for {@code
Replicated}-engine databases.
* </ul>
*
- * <p>Gravitino therefore embeds the cluster name inside the object's COMMENT
field at creation time
- * using a non-printable SOH separator ({@code \u0001}). The metadata is
invisible to end users
- * because Gravitino strips it before surfacing the comment.
+ * <p>Gravitino therefore embeds the cluster name inside the object's COMMENT
field at creation
+ * time, separated from the user comment by a newline. The metadata line is
always stripped before
+ * surfacing the comment to callers.
*
- * <p><b>Stored format:</b> {@code userComment\u0001ch.cluster=clusterName}
+ * <p><b>Stored format:</b>
+ *
+ * <pre>userComment
+ * [Gravitino] ch.cluster=clusterName</pre>
+ *
+ * <p><b>Example — database created ON CLUSTER:</b>
+ *
+ * <pre>
+ * -- Gravitino issues:
+ * CREATE DATABASE `my_db` ON CLUSTER `ck_cluster`
+ * COMMENT 'my comment\n[Gravitino] ch.cluster=ck_cluster'
+ *
+ * -- ClickHouse SHOW CREATE DATABASE output (ON CLUSTER is omitted):
+ * CREATE DATABASE my_db
+ * ENGINE = Atomic
+ * COMMENT 'my comment
+ * [Gravitino] ch.cluster=ck_cluster'
+ *
+ * -- Gravitino reads back from system.databases.comment:
+ * -- stored : 'my comment\n[Gravitino] ch.cluster=ck_cluster'
+ * -- cluster: 'ck_cluster' (extracted by extractClusterFromComment)
+ * -- user : 'my comment' (stripped by stripClusterMetadata)
+ * </pre>
+ *
+ * <p><b>Example — table created ON CLUSTER:</b>
+ *
+ * <pre>
+ * -- Gravitino issues:
+ * CREATE TABLE `orders` ON CLUSTER `ck_cluster`
+ * (`id` Int32, `amount` Decimal(10,2))
+ * ENGINE = MergeTree()
+ * ORDER BY `id`
+ * COMMENT 'order records\n[Gravitino] ch.cluster=ck_cluster'
+ *
Review Comment:
Do you mean users will update the comment without using Gravitino and add
something at the end of `\n[Gravitino] ch.cluster=ck_cluster`?
We can't avoid such a problem as long as users can update comments without
notifying Gravitino.
--
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]