From 17ad8a2d92f01ccd12f65864ecd2da88315d104e Mon Sep 17 00:00:00 2001 From: Yingjian Wu Date: Sun, 7 Jul 2024 10:18:05 -0400 Subject: [PATCH] default flags to false --- .../ParentChildRelationshipProperties.java | 26 +++++++++---------- .../metacat-test-cluster/docker-compose.yml | 6 ++++- .../MySqlParentChildRelMetaDataService.java | 4 +-- 3 files changed, 20 insertions(+), 16 deletions(-) diff --git a/metacat-common-server/src/main/java/com/netflix/metacat/common/server/properties/ParentChildRelationshipProperties.java b/metacat-common-server/src/main/java/com/netflix/metacat/common/server/properties/ParentChildRelationshipProperties.java index 84b661f69..c8152595a 100644 --- a/metacat-common-server/src/main/java/com/netflix/metacat/common/server/properties/ParentChildRelationshipProperties.java +++ b/metacat-common-server/src/main/java/com/netflix/metacat/common/server/properties/ParentChildRelationshipProperties.java @@ -18,20 +18,20 @@ @Data @Slf4j public class ParentChildRelationshipProperties { - private boolean createEnabled = true; - private boolean getEnabled = true; - private boolean renameEnabled = true; - private boolean dropEnabled = true; + private static final String MAX_ALLOW_PER_TABLE_PER_REL_PROPERTY_NAME = + "metacat.parentChildRelationshipProperties.maxAllowPerTablePerRelConfig"; + private static final String MAX_ALLOW_PER_DB_PER_REL_PROPERTY_NAME = + "metacat.parentChildRelationshipProperties.maxAllowPerDBPerRelConfig"; + private static final String DEFAULT_MAX_ALLOW_PER_REL_PROPERTY_NAME = + "metacat.parentChildRelationshipProperties.defaultMaxAllowPerRelConfig"; + private boolean createEnabled; + private boolean getEnabled; + private boolean renameEnabled; + private boolean dropEnabled; private int maxAllow = 5; private Map> maxAllowPerTablePerRelType = new HashMap<>(); private Map> maxAllowPerDBPerRelType = new HashMap<>(); private Map defaultMaxAllowPerRelType = new HashMap<>(); - private String maxAllowPerTablePerRelPropertyName = - "metacat.parentChildRelationshipProperties.maxAllowPerTablePerRelConfig"; - private String maxAllowPerDBPerRelPropertyName = - "metacat.parentChildRelationshipProperties.maxAllowPerDBPerRelConfig"; - private String defaultMaxAllowPerRelPropertyName = - "metacat.parentChildRelationshipProperties.defaultMaxAllowPerRelConfig"; /** * Constructor. @@ -41,13 +41,13 @@ public class ParentChildRelationshipProperties { public ParentChildRelationshipProperties(@Nullable final Environment env) { if (env != null) { setMaxAllowPerTablePerRelType( - env.getProperty(maxAllowPerTablePerRelPropertyName, String.class, "") + env.getProperty(MAX_ALLOW_PER_TABLE_PER_REL_PROPERTY_NAME, String.class, "") ); setMaxAllowPerDBPerRelType( - env.getProperty(maxAllowPerDBPerRelPropertyName, String.class, "") + env.getProperty(MAX_ALLOW_PER_DB_PER_REL_PROPERTY_NAME, String.class, "") ); setDefaultMaxAllowPerRelType( - env.getProperty(defaultMaxAllowPerRelPropertyName, String.class, "") + env.getProperty(DEFAULT_MAX_ALLOW_PER_REL_PROPERTY_NAME, String.class, "") ); } } diff --git a/metacat-functional-tests/metacat-test-cluster/docker-compose.yml b/metacat-functional-tests/metacat-test-cluster/docker-compose.yml index 4e422c91f..bdf867b91 100644 --- a/metacat-functional-tests/metacat-test-cluster/docker-compose.yml +++ b/metacat-functional-tests/metacat-test-cluster/docker-compose.yml @@ -73,7 +73,11 @@ services: -Dmetacat.table.delete.noDeleteOnTags=do_not_drop,iceberg_migration_do_not_modify -Dmetacat.table.rename.noRenameOnTags=do_not_rename,iceberg_migration_do_not_modify -Dmetacat.table.update.noUpdateOnTags=iceberg_migration_do_not_modify - -Dmetacat.event.updateIcebergTablePostEventEnabled=true' + -Dmetacat.event.updateIcebergTablePostEventEnabled=true + -Dmetacat.parentChildRelationshipProperties.createEnabled=true + -Dmetacat.parentChildRelationshipProperties.getEnabled=true + -Dmetacat.parentChildRelationshipProperties.renameEnabled=true + -Dmetacat.parentChildRelationshipProperties.dropEnabled=true' labels: - "com.netflix.metacat.oss.test" - "com.netflix.metacat.oss.test.war" diff --git a/metacat-metadata-mysql/src/main/java/com/netflix/metacat/metadata/mysql/MySqlParentChildRelMetaDataService.java b/metacat-metadata-mysql/src/main/java/com/netflix/metacat/metadata/mysql/MySqlParentChildRelMetaDataService.java index f7553a721..2d9861f57 100644 --- a/metacat-metadata-mysql/src/main/java/com/netflix/metacat/metadata/mysql/MySqlParentChildRelMetaDataService.java +++ b/metacat-metadata-mysql/src/main/java/com/netflix/metacat/metadata/mysql/MySqlParentChildRelMetaDataService.java @@ -147,8 +147,8 @@ private void validateMaxAllow(final QualifiedName parentName, if (getChildrenCountPerType(parentName, type) >= maxAllow) { final String errorMsg = String.format( - "Parent table: %s is not allow to have more than %s child table", - parentName, maxAllow); + "Parent table: %s is not allow to have more than %s child table for %s relation type", + parentName, maxAllow, type); throw new ParentChildRelServiceException(errorMsg); } }