yuqi1129 commented on code in PR #14641:
URL: https://github.com/apache/gravitino/pull/14641#discussion_r4480284522
##########
core/src/main/java/org/apache/gravitino/meta/ColumnEntity.java:
##########
@@ -163,13 +164,33 @@ public static Builder builder() {
return new Builder();
}
+ /**
+ * Projects a source column comment into the portable entity-store
representation. The full source
+ * comment remains available from the connector table.
+ *
+ * @param comment the source comment
+ * @return a NUL-free comment bounded by the storage capacity
+ */
+ @Nullable
+ public static String commentForStorage(@Nullable String comment) {
+ if (comment == null) {
+ return null;
+ }
+ String safe = comment.replace("\0", "");
+ int end = Math.min(safe.length(),
EntityFieldLimits.MAX_COLUMN_COMMENT_LENGTH);
Review Comment:
Fixed in
[7d0da2fed3](https://github.com/apache/gravitino/commit/7d0da2fed3301c3bca44435617a71ecf13fbc8a2).
I checked the pinned H2 2.2.224 directly: VARCHAR(4096) accepts 2048 emoji /
4094 BMP characters plus one emoji, but rejects 4096 emoji / 4095 BMP
characters plus one emoji (SQLState 22001). Request validation now enforces the
portable 4096 UTF-16-unit bound before source DDL and on managed CREATE, ADD
COLUMN, and comment updates. Accepted requests round-trip unchanged; only
imported external comments use the lossy projection. The restriction is
documented, and regression tests cover both rejected cases, accepted round
trips, and no source DDL on rejection.
##########
core/src/main/java/org/apache/gravitino/catalog/CatalogManager.java:
##########
@@ -861,7 +861,7 @@ public Catalog createCatalog(
.build();
return TreeLockUtils.doWithTreeLock(
- metalakeIdent,
+ ident,
Review Comment:
Fixed in
[7d0da2fed3](https://github.com/apache/gravitino/commit/7d0da2fed3301c3bca44435617a71ecf13fbc8a2).
Catalog initialization, create-time validation, and response snapshot
construction now finish before persistence. The short store/cache publication
is serialized with acquireCatalogLease so listCatalogsInfo cannot create
another local wrapper in that window; failed insertion retires the initialized
wrapper. Latch-controlled tests cover both listing APIs during
successful/failed verification and a reader arriving between store insertion
and cache publication. One detail: the ordinary load path skips
validateOnCreate because propsToValidate is null, but it could still
initialize/cache a second wrapper, which this change also prevents.
##########
core/src/main/java/org/apache/gravitino/catalog/TableOperationDispatcher.java:
##########
@@ -447,42 +447,47 @@ public Table alterTable(NameIdentifier ident,
TableChange... changes)
@Override
public boolean dropTable(NameIdentifier ident) {
NameIdentifier schemaIdentifier = getSchemaIdentifier(ident);
- return TreeLockUtils.doWithTreeLock(
- schemaIdentifier,
- LockType.WRITE,
- () -> {
- NameIdentifier catalogIdent = getCatalogIdentifier(ident);
- boolean droppedFromCatalog =
- doWithCatalog(
- catalogIdent,
- c -> c.doWithTableOps(t -> t.dropTable(ident)),
- RuntimeException.class);
-
- boolean isManagedTable = isManagedEntity(catalogIdent,
Capability.Scope.TABLE);
- if (isManagedTable) {
- return droppedFromCatalog;
- }
-
- // A false result is ambiguous: the external table may have been
renamed or dropped out of
- // band. Preserve the registration because deleting it after a
rename would lose
- // Gravitino-only metadata. A true out-of-band drop can therefore
leave a stale
- // registration that requires separate cleanup.
- if (droppedFromCatalog) {
- try {
- store.delete(ident, TABLE);
- } catch (OptimisticLockException e) {
- throw e;
- } catch (NoSuchEntityException e) {
- LOG.warn("The table to be dropped does not exist in the store:
{}", ident, e);
- } catch (Exception e) {
- throw new RuntimeException(e);
- }
- }
- // Run unconditionally: an out-of-band drop may have left orphaned
schema entities. The
- // cleanup is best-effort and stops as soon as a schema still exists.
- OrphanedSchemaCleanup.cleanUp(this, catalogIdent, schemaIdentifier);
- return droppedFromCatalog;
- });
+ Pair<Boolean, Boolean> result =
+ TreeLockUtils.doWithTreeLock(
+ ident,
Review Comment:
Documented the remaining scope in
[7d0da2fed3](https://github.com/apache/gravitino/commit/7d0da2fed3301c3bca44435617a71ecf13fbc8a2)
and the PR description: table PURGE and view DROP still hold the schema write
lock across source DDL and can block sibling operations. This PR narrows table
DROP; cold imports also retain their existing locking behavior.
##########
trino-connector/integration-test/src/test/java/org/apache/gravitino/trino/connector/integration/test/TrinoQueryIT.java:
##########
@@ -502,6 +534,7 @@ void executeSqlFileWithGenOutput(
firstLine = false;
String sql = resolveParameters(sqlMatcher.group(1));
+ sql = sql.replaceFirst("^<RETRY_UNTIL_MATCH>\\s*", "");
Review Comment:
Fixed in
[7d0da2fed3](https://github.com/apache/gravitino/commit/7d0da2fed3301c3bca44435617a71ecf13fbc8a2).
Golden generation now reads the existing expected output before executing
queries and routes marked SHOW queries through executeQuery with the same
30-second timeout. It writes the file only after all queries succeed. A missing
expected result fails preflight, and a persistent mismatch leaves the old file
unchanged. Tests cover transient staging-table cleanup, timeout/file
preservation, missing expectations, statement alignment, EOF handling across
repeated generation, and rejecting marked writes.
--
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]