Skip to content

World's most powerful open data catalog for building a high-performance, geo-distributed and federated metadata lake.

[#13317] fix(core): Close remaining entity field length gaps (#14821)

Jerry Shao08617b5b0b36
diff --git a/catalogs/catalog-fileset/src/main/java/org/apache/gravitino/catalog/fileset/FilesetCatalogOperations.java b/catalogs/catalog-fileset/src/main/java/org/apache/gravitino/catalog/fileset/FilesetCatalogOperations.java
index dd603a2801..ce3258cf00 100644
--- a/catalogs/catalog-fileset/src/main/java/org/apache/gravitino/catalog/fileset/FilesetCatalogOperations.java
+++ b/catalogs/catalog-fileset/src/main/java/org/apache/gravitino/catalog/fileset/FilesetCatalogOperations.java
@@ -464,6 +464,11 @@ public class FilesetCatalogOperations extends ManagedSchemaOperations
if (StringUtils.isBlank(name)) {
throw new IllegalArgumentException("Location name must not be blank");
}
+ EntityFieldLimits.checkMaxLength(
+ name,
+ EntityFieldLimits.MAX_STORAGE_LOCATION_NAME_LENGTH,
+ "storage location name",
+ Entity.EntityType.FILESET);
if (StringUtils.isBlank(path)) {
throw new IllegalArgumentException(
"Storage location must not be blank for location name: " + name);
@@ -521,6 +526,17 @@ public class FilesetCatalogOperations extends ManagedSchemaOperations
Map<String, Path> filesetPaths =
calculateFilesetPaths(
schemaIdent.name(), ident.name(), storageLocations, schemaPaths, properties);
+ // The names inherited from the catalog or schema locations are only known now, check them
+ // before any directory is created.
+ filesetPaths
+ .keySet()
+ .forEach(
+ name ->
+ EntityFieldLimits.checkMaxLength(
+ name,
+ EntityFieldLimits.MAX_STORAGE_LOCATION_NAME_LENGTH,
+ "storage location name",
+ Entity.EntityType.FILESET));
properties = setDefaultLocationIfAbsent(properties, filesetPaths);
ImmutableMap.Builder<String, Path> filesetPathsBuilder = ImmutableMap.builder();
diff --git a/catalogs/catalog-fileset/src/test/java/org/apache/gravitino/catalog/fileset/TestFilesetCatalogOperations.java b/catalogs/catalog-fileset/src/test/java/org/apache/gravitino/catalog/fileset/TestFilesetCatalogOperations.java
index b56628864e..c196464a07 100644
--- a/catalogs/catalog-fileset/src/test/java/org/apache/gravitino/catalog/fileset/TestFilesetCatalogOperations.java
+++ b/catalogs/catalog-fileset/src/test/java/org/apache/gravitino/catalog/fileset/TestFilesetCatalogOperations.java
@@ -3623,6 +3623,56 @@ public class TestFilesetCatalogOperations {
}
}
+ @Test
+ public void testCreateFilesetRejectsInheritedTooLongLocationName() throws IOException {
+ String tooLongLocationName =
+ StringUtils.repeat("l", EntityFieldLimits.MAX_STORAGE_LOCATION_NAME_LENGTH + 1);
+ String locationPath = TEST_ROOT_PATH + "/inherited_long_location";
+ Map<String, String> catalogPaths =
+ ImmutableMap.of(
+ PROPERTY_MULTIPLE_LOCATIONS_PREFIX + tooLongLocationName, locationPath + "_catalog");
+ Map<String, String> schemaPaths =
+ ImmutableMap.of(
+ PROPERTY_MULTIPLE_LOCATIONS_PREFIX + tooLongLocationName, locationPath + "_schema");
+
+ // The location name is inherited from the catalog location.
+ createMultiLocationSchema("s_inherit_catalog", "comment", ImmutableMap.of(), ImmutableMap.of());
+ assertInheritedLocationRejected(
+ "s_inherit_catalog",
+ catalogPaths,
+ locationPath + "_catalog/s_inherit_catalog/fileset_inherit");
+
+ // The location name is inherited from the schema location.
+ createMultiLocationSchema("s_inherit_schema", "comment", ImmutableMap.of(), schemaPaths);
+ assertInheritedLocationRejected(
+ "s_inherit_schema", ImmutableMap.of(), locationPath + "_schema/fileset_inherit");
+ }
+
+ private void assertInheritedLocationRejected(
+ String schemaName, Map<String, String> catalogPaths, String filesetPath) throws IOException {
+ IllegalArgumentException exception =
+ Assertions.assertThrows(
+ IllegalArgumentException.class,
+ () ->
+ createMultiLocationFileset(
+ "fileset_inherit",
+ schemaName,
+ null,
+ Fileset.Type.MANAGED,
+ catalogPaths,
+ ImmutableMap.of(),
+ null));
+ Assertions.assertEquals(
+ "The storage location name of the fileset must not exceed 256 characters",
+ exception.getMessage());
+
+ // No directory is left behind for the rejected fileset.
+ Path path = new Path(filesetPath);
+ try (FileSystem fs = path.getFileSystem(new Configuration())) {
+ Assertions.assertFalse(fs.exists(path));
+ }
+ }
+
@Test
public void testCreateMultipleLocationsWithExceptions() throws IOException {
// empty location name in catalog location
@@ -3718,6 +3768,25 @@ public class TestFilesetCatalogOperations {
null));
Assertions.assertEquals("Location name must not be blank", exception.getMessage());
+ // too long location name in storage location
+ String tooLongLocationName =
+ StringUtils.repeat("l", EntityFieldLimits.MAX_STORAGE_LOCATION_NAME_LENGTH + 1);
+ exception =
+ Assertions.assertThrows(
+ IllegalArgumentException.class,
+ () ->
+ createMultiLocationFileset(
+ "fileset_test",
+ "s1",
+ null,
+ Fileset.Type.MANAGED,
+ ImmutableMap.of(),
+ ImmutableMap.of(tooLongLocationName, TEST_ROOT_PATH + "/fileset31"),
+ null));
+ Assertions.assertEquals(
+ "The storage location name of the fileset must not exceed 256 characters",
+ exception.getMessage());
+
// empty fileset storage location
exception =
Assertions.assertThrows(
diff --git a/core/src/main/java/org/apache/gravitino/EntityFieldLimits.java b/core/src/main/java/org/apache/gravitino/EntityFieldLimits.java
index 9f71dc0b8c..52de6f9b6b 100644
--- a/core/src/main/java/org/apache/gravitino/EntityFieldLimits.java
+++ b/core/src/main/java/org/apache/gravitino/EntityFieldLimits.java
@@ -42,6 +42,12 @@ public final class EntityFieldLimits {
/** The maximum number of characters of a column comment. */
public static final int MAX_COLUMN_COMMENT_LENGTH = 4096;
+ /** The maximum number of characters of a fileset storage location name. */
+ public static final int MAX_STORAGE_LOCATION_NAME_LENGTH = 256;
+
+ /** The maximum number of characters of a model version URI name. */
+ public static final int MAX_MODEL_VERSION_URI_NAME_LENGTH = 256;
+
private EntityFieldLimits() {}
/**
diff --git a/core/src/main/java/org/apache/gravitino/catalog/TopicNormalizeDispatcher.java b/core/src/main/java/org/apache/gravitino/catalog/TopicNormalizeDispatcher.java
index bc7625020c..6bd1eca22f 100644
--- a/core/src/main/java/org/apache/gravitino/catalog/TopicNormalizeDispatcher.java
+++ b/core/src/main/java/org/apache/gravitino/catalog/TopicNormalizeDispatcher.java
@@ -34,6 +34,7 @@ import org.apache.gravitino.exceptions.TopicAlreadyExistsException;
import org.apache.gravitino.messaging.DataLayout;
import org.apache.gravitino.messaging.Topic;
import org.apache.gravitino.messaging.TopicChange;
+import org.apache.gravitino.meta.TopicEntity;
/**
* Note on list operations: names returned by list methods (e.g. {@link #listTopics(Namespace)}) are
@@ -74,9 +75,12 @@ public class TopicNormalizeDispatcher implements TopicDispatcher {
public Topic createTopic(
NameIdentifier ident, String comment, DataLayout dataLayout, Map<String, String> properties)
throws NoSuchSchemaException, TopicAlreadyExistsException {
- // Check the comment before the underlying catalog creates the topic.
+ // Apply the catalog capability first, since it may reject the name with a more specific
+ // message, then check the name and comment before the underlying catalog creates the topic.
+ NameIdentifier normalizedIdent = normalizeNameIdentifier(ident);
+ TopicEntity.NAME.validate(normalizedIdent.name(), Entity.EntityType.TOPIC);
checkCommentLength(comment);
- return dispatcher.createTopic(normalizeNameIdentifier(ident), comment, dataLayout, properties);
+ return dispatcher.createTopic(normalizedIdent, comment, dataLayout, properties);
}
@Override
diff --git a/core/src/main/java/org/apache/gravitino/meta/FilesetEntity.java b/core/src/main/java/org/apache/gravitino/meta/FilesetEntity.java
index db8a466c33..45e208bdfe 100644
--- a/core/src/main/java/org/apache/gravitino/meta/FilesetEntity.java
+++ b/core/src/main/java/org/apache/gravitino/meta/FilesetEntity.java
@@ -191,6 +191,15 @@ public class FilesetEntity implements Entity, Auditable, HasIdentifier {
Preconditions.checkArgument(
!storageLocations.isEmpty(),
"The storage locations of the fileset entity must not be empty.");
+ storageLocations
+ .keySet()
+ .forEach(
+ locationName ->
+ EntityFieldLimits.checkMaxLength(
+ locationName,
+ EntityFieldLimits.MAX_STORAGE_LOCATION_NAME_LENGTH,
+ "storage location name",
+ type()));
}
@Override
diff --git a/core/src/main/java/org/apache/gravitino/meta/ModelVersionEntity.java b/core/src/main/java/org/apache/gravitino/meta/ModelVersionEntity.java
index 4f4446581d..69683b587d 100644
--- a/core/src/main/java/org/apache/gravitino/meta/ModelVersionEntity.java
+++ b/core/src/main/java/org/apache/gravitino/meta/ModelVersionEntity.java
@@ -146,6 +146,14 @@ public class ModelVersionEntity implements Entity, Auditable, HasIdentifier {
EntityFieldLimits.checkMaxLength(
alias, EntityFieldLimits.MAX_NAME_LENGTH, "alias", type()));
}
+ uris.keySet()
+ .forEach(
+ uriName ->
+ EntityFieldLimits.checkMaxLength(
+ uriName,
+ EntityFieldLimits.MAX_MODEL_VERSION_URI_NAME_LENGTH,
+ "uri name",
+ type()));
}
@Override
diff --git a/core/src/main/java/org/apache/gravitino/meta/TopicEntity.java b/core/src/main/java/org/apache/gravitino/meta/TopicEntity.java
index 03a3d58b09..c8d46115ec 100644
--- a/core/src/main/java/org/apache/gravitino/meta/TopicEntity.java
+++ b/core/src/main/java/org/apache/gravitino/meta/TopicEntity.java
@@ -36,7 +36,7 @@ public class TopicEntity implements Entity, Auditable, HasIdentifier {
public static final Field ID =
Field.required("id", Long.class, "The unique id of the topic entity.");
public static final Field NAME =
- Field.required("name", String.class, "The name of the topic entity.");
+ Field.required("name", "The name of the topic entity.", EntityFieldLimits.MAX_NAME_LENGTH);
public static final Field COMMENT =
Field.optional(
"comment",
diff --git a/core/src/test/java/org/apache/gravitino/catalog/TestTopicNormalizeDispatcher.java b/core/src/test/java/org/apache/gravitino/catalog/TestTopicNormalizeDispatcher.java
index 6b6d8e9608..e44251a767 100644
--- a/core/src/test/java/org/apache/gravitino/catalog/TestTopicNormalizeDispatcher.java
+++ b/core/src/test/java/org/apache/gravitino/catalog/TestTopicNormalizeDispatcher.java
@@ -104,6 +104,22 @@ public class TestTopicNormalizeDispatcher extends TestOperationDispatcher {
"The TOPIC name 'a?' is illegal. Illegal name: a?", exception.getMessage());
}
+ @Test
+ public void testNameLength() {
+ Namespace topicNs = Namespace.of(metalake, catalog, "testNameLength");
+ Map<String, String> props = ImmutableMap.of("k1", "v1");
+ schemaNormalizeDispatcher.createSchema(NameIdentifier.of(topicNs.levels()), "comment", props);
+
+ NameIdentifier tooLongIdent =
+ NameIdentifier.of(topicNs, StringUtils.repeat("a", EntityFieldLimits.MAX_NAME_LENGTH + 1));
+ // The catalog capability may reject the name with its own message first, either way the topic
+ // must be rejected before it is created.
+ Assertions.assertThrows(
+ IllegalArgumentException.class,
+ () -> topicNormalizeDispatcher.createTopic(tooLongIdent, "comment", null, props));
+ Assertions.assertFalse(topicNormalizeDispatcher.topicExists(tooLongIdent));
+ }
+
@Test
public void testCommentLength() {
Namespace topicNs = Namespace.of(metalake, catalog, "testCommentLength");
diff --git a/core/src/test/java/org/apache/gravitino/catalog/TestTopicOperationDispatcher.java b/core/src/test/java/org/apache/gravitino/catalog/TestTopicOperationDispatcher.java
index 2078bd9b42..c1da8293f2 100644
--- a/core/src/test/java/org/apache/gravitino/catalog/TestTopicOperationDispatcher.java
+++ b/core/src/test/java/org/apache/gravitino/catalog/TestTopicOperationDispatcher.java
@@ -42,6 +42,7 @@ import java.util.Map;
import org.apache.commons.lang3.reflect.FieldUtils;
import org.apache.gravitino.Config;
import org.apache.gravitino.Entity;
+import org.apache.gravitino.EntityFieldLimits;
import org.apache.gravitino.GravitinoEnv;
import org.apache.gravitino.NameIdentifier;
import org.apache.gravitino.Namespace;
@@ -285,6 +286,29 @@ public class TestTopicOperationDispatcher extends TestOperationDispatcher {
}
}
+ @Test
+ public void testImportTopicRejectsOversizedName() throws IOException {
+ Namespace topicNs = Namespace.of(metalake, catalog, "schema_import_topic_long_name");
+ Map<String, String> props = ImmutableMap.of("k1", "v1", "k2", "v2");
+ schemaOperationDispatcher.createSchema(NameIdentifier.of(topicNs.levels()), "comment", props);
+
+ // Create the topic directly in the catalog, as if it was created externally. A Kafka topic name
+ // can be longer than the topic_name column of the entity store.
+ NameIdentifier topicIdent =
+ NameIdentifier.of(topicNs, "t".repeat(EntityFieldLimits.MAX_NAME_LENGTH + 1));
+ TestCatalog testCatalog =
+ (TestCatalog)
+ catalogManager.loadCatalogAndWrap(NameIdentifier.of(metalake, catalog)).catalog();
+ ((TestCatalogOperations) testCatalog.ops()).createTopic(topicIdent, "comment", null, props);
+
+ IllegalArgumentException exception =
+ Assertions.assertThrows(
+ IllegalArgumentException.class, () -> topicOperationDispatcher.loadTopic(topicIdent));
+ Assertions.assertEquals(
+ "The name of the topic must not exceed 128 characters", exception.getMessage());
+ Assertions.assertFalse(entityStore.exists(topicIdent, Entity.EntityType.TOPIC));
+ }
+
@Test
public void testDropTopicPropagatesOptimisticLockConflict() throws IOException {
Namespace topicNs = Namespace.of(metalake, catalog, "schema_drop_topic_occ");
diff --git a/core/src/test/java/org/apache/gravitino/meta/TestEntityFieldLimits.java b/core/src/test/java/org/apache/gravitino/meta/TestEntityFieldLimits.java
index 78eff70279..e78666b87d 100644
--- a/core/src/test/java/org/apache/gravitino/meta/TestEntityFieldLimits.java
+++ b/core/src/test/java/org/apache/gravitino/meta/TestEntityFieldLimits.java
@@ -76,6 +76,38 @@ public class TestEntityFieldLimits {
assertLengthLimit(builder, "alias", "model version", EntityFieldLimits.MAX_NAME_LENGTH);
}
+ @Test
+ public void testFilesetStorageLocationNameLength() {
+ Function<String, Entity> builder =
+ locationName ->
+ FilesetEntity.builder()
+ .withId(1L)
+ .withName("fileset")
+ .withFilesetType(Fileset.Type.MANAGED)
+ .withStorageLocations(ImmutableMap.of(locationName, "location"))
+ .withAuditInfo(AuditInfo.EMPTY)
+ .build();
+ assertLengthLimit(
+ builder,
+ "storage location name",
+ "fileset",
+ EntityFieldLimits.MAX_STORAGE_LOCATION_NAME_LENGTH);
+ }
+
+ @Test
+ public void testModelVersionUriNameLength() {
+ Function<String, Entity> builder =
+ uriName ->
+ ModelVersionEntity.builder()
+ .withModelIdentifier(NameIdentifier.of("m1", "c1", "s1", "model1"))
+ .withVersion(1)
+ .withUris(ImmutableMap.of(uriName, "test_uri"))
+ .withAuditInfo(AuditInfo.EMPTY)
+ .build();
+ assertLengthLimit(
+ builder, "uri name", "model version", EntityFieldLimits.MAX_MODEL_VERSION_URI_NAME_LENGTH);
+ }
+
/** Verifies column names use their own limit while other entity names keep the existing limit. */
@Test
public void testColumnNameLength() {
@@ -150,6 +182,16 @@ public class TestEntityFieldLimits {
.withAuditInfo(AuditInfo.EMPTY)
.build()),
Arguments.of("tag", (Function<String, Entity>) name -> tagBuilder(name, null)),
+ Arguments.of(
+ "topic",
+ (Function<String, Entity>)
+ name ->
+ TopicEntity.builder()
+ .withId(1L)
+ .withName(name)
+ .withNamespace(NAMESPACE)
+ .withAuditInfo(AuditInfo.EMPTY)
+ .build()),
Arguments.of(
"policy",
(Function<String, Entity>)
diff --git a/core/src/test/java/org/apache/gravitino/storage/TestSQLScripts.java b/core/src/test/java/org/apache/gravitino/storage/TestSQLScripts.java
index 55f4fff8b5..f9910aab05 100644
--- a/core/src/test/java/org/apache/gravitino/storage/TestSQLScripts.java
+++ b/core/src/test/java/org/apache/gravitino/storage/TestSQLScripts.java
@@ -105,6 +105,7 @@ public class TestSQLScripts extends TestJDBCBackend {
}
if ("2.0.0".equals(versionScripts.getKey())) {
assertCleanupIndexes("schema " + versionScripts.getKey());
+ assertNameColumnWidths("schema " + versionScripts.getKey());
}
}
}
@@ -138,6 +139,7 @@ public class TestSQLScripts extends TestJDBCBackend {
executeScript(upgradeScript);
if ("2.0.0".equals(upgradeMatcher.group(2))) {
assertCleanupIndexes(upgradeScript.getName());
+ assertNameColumnWidths(upgradeScript.getName());
}
}
}
@@ -605,6 +607,39 @@ public class TestSQLScripts extends TestJDBCBackend {
}
}
+ /**
+ * Verifies the fileset storage location name and model version URI name columns are 256
+ * characters wide on every backend, both on a fresh install and after the 2.0.0 upgrade.
+ */
+ private void assertNameColumnWidths(String source) throws SQLException {
+ Map<String, String> columns =
+ Map.of(
+ "fileset_version_info", "storage_location_name",
+ "model_version_info", "model_version_uri_name");
+ try (SqlSession sqlSession =
+ SqlSessionFactoryHelper.getInstance().getSqlSessionFactory().openSession(true);
+ Connection connection = sqlSession.getConnection()) {
+ DatabaseMetaData metaData = connection.getMetaData();
+ for (Map.Entry<String, String> entry : columns.entrySet()) {
+ String table = entry.getKey();
+ String tableName =
+ metaData.storesUpperCaseIdentifiers() ? table.toUpperCase(Locale.ROOT) : table;
+ String columnName =
+ metaData.storesUpperCaseIdentifiers()
+ ? entry.getValue().toUpperCase(Locale.ROOT)
+ : entry.getValue();
+ try (ResultSet result =
+ metaData.getColumns(connection.getCatalog(), null, tableName, columnName)) {
+ Assertions.assertTrue(result.next(), "Column not found: " + table);
+ Assertions.assertEquals(
+ 256,
+ result.getInt("COLUMN_SIZE"),
+ entry.getValue() + " of " + table + " must be 256 wide after " + source);
+ }
+ }
+ }
+ }
+
private void assertCleanupIndexes(String source) throws SQLException {
Map<String, String> leadingColumns =
Map.of(
diff --git a/core/src/test/java/org/apache/gravitino/storage/relational/service/TestFilesetMetaService.java b/core/src/test/java/org/apache/gravitino/storage/relational/service/TestFilesetMetaService.java
index bb95266903..0a77a2b954 100644
--- a/core/src/test/java/org/apache/gravitino/storage/relational/service/TestFilesetMetaService.java
+++ b/core/src/test/java/org/apache/gravitino/storage/relational/service/TestFilesetMetaService.java
@@ -1013,16 +1013,29 @@ public class TestFilesetMetaService extends TestJDBCBackend {
original.nameIdentifier(),
entity -> {
FilesetEntity current = (FilesetEntity) entity;
- return FilesetEntity.builder()
- .withId(current.id())
- .withName(current.name())
- .withNamespace(current.namespace())
- .withFilesetType(current.filesetType())
- .withStorageLocations(ImmutableMap.of(tooLongLocationName, "/tmp-v2"))
- .withComment("new comment")
- .withProperties(current.properties())
- .withAuditInfo(current.auditInfo())
- .build();
+ FilesetEntity updated =
+ FilesetEntity.builder()
+ .withId(current.id())
+ .withName(current.name())
+ .withNamespace(current.namespace())
+ .withFilesetType(current.filesetType())
+ .withStorageLocations(ImmutableMap.of("valid", "/tmp-v2"))
+ .withComment("new comment")
+ .withProperties(current.properties())
+ .withAuditInfo(current.auditInfo())
+ .build();
+ // The entity validation rejects the over-long name, so it is set
+ // afterwards to exercise the database error.
+ try {
+ FieldUtils.writeField(
+ updated,
+ "storageLocations",
+ ImmutableMap.of(tooLongLocationName, "/tmp-v2"),
+ true);
+ } catch (IllegalAccessException e) {
+ throw new IllegalStateException(e);
+ }
+ return updated;
}));
Assertions.assertEquals(
"The fileset entity has a value that exceeds the maximum length of its column.",
diff --git a/scripts/h2/schema-2.0.0-h2.sql b/scripts/h2/schema-2.0.0-h2.sql
index 035007284f..d443c0824d 100644
--- a/scripts/h2/schema-2.0.0-h2.sql
+++ b/scripts/h2/schema-2.0.0-h2.sql
@@ -139,7 +139,7 @@ CREATE TABLE IF NOT EXISTS `fileset_version_info` (
`version` INT UNSIGNED NOT NULL COMMENT 'fileset info version',
`fileset_comment` VARCHAR(256) DEFAULT '' COMMENT 'fileset comment',
`properties` CLOB DEFAULT NULL COMMENT 'fileset properties',
- `storage_location_name` VARCHAR(128) NOT NULL DEFAULT 'default' COMMENT 'fileset storage location name',
+ `storage_location_name` VARCHAR(256) NOT NULL DEFAULT 'default' COMMENT 'fileset storage location name',
`storage_location` CLOB DEFAULT NULL COMMENT 'fileset storage location',
`deleted_at` BIGINT(20) UNSIGNED NOT NULL DEFAULT 0 COMMENT 'fileset deleted at',
PRIMARY KEY (id),
@@ -370,7 +370,7 @@ CREATE TABLE IF NOT EXISTS `model_version_info` (
`version` INT UNSIGNED NOT NULL COMMENT 'model version',
`model_version_comment` CLOB DEFAULT NULL COMMENT 'model version comment',
`model_version_properties` CLOB DEFAULT NULL COMMENT 'model version properties',
- `model_version_uri_name` VARCHAR(128) NOT NULL COMMENT 'model version uri name',
+ `model_version_uri_name` VARCHAR(256) NOT NULL COMMENT 'model version uri name',
`model_version_uri` CLOB NOT NULL COMMENT 'model storage uri',
`audit_info` CLOB NOT NULL COMMENT 'model version audit info',
`deleted_at` BIGINT(20) UNSIGNED NOT NULL DEFAULT 0 COMMENT 'model version deleted at',
diff --git a/scripts/h2/upgrade-1.3.0-to-2.0.0-h2.sql b/scripts/h2/upgrade-1.3.0-to-2.0.0-h2.sql
index d246e6cea0..ddd8470561 100644
--- a/scripts/h2/upgrade-1.3.0-to-2.0.0-h2.sql
+++ b/scripts/h2/upgrade-1.3.0-to-2.0.0-h2.sql
@@ -246,3 +246,7 @@ CREATE TABLE IF NOT EXISTS `semantic_model_source_rel` (
CREATE INDEX IF NOT EXISTS `idx_smsr_model` ON `semantic_model_source_rel` (`semantic_model_id`, `deleted_at`);
CREATE INDEX IF NOT EXISTS `idx_smsr_source` ON `semantic_model_source_rel` (`metalake_id`, `source_type`, `source_id`, `deleted_at`);
CREATE INDEX IF NOT EXISTS `idx_smsr_deleted_at` ON `semantic_model_source_rel` (`deleted_at`);
+
+-- Align the location and uri name widths with the MySQL and PostgreSQL schemas.
+ALTER TABLE `fileset_version_info` ALTER COLUMN `storage_location_name` VARCHAR(256) NOT NULL DEFAULT 'default';
+ALTER TABLE `model_version_info` ALTER COLUMN `model_version_uri_name` VARCHAR(256) NOT NULL;