From 86a9efe0775767787c5e3362e2933fc7e65b23f5 Mon Sep 17 00:00:00 2001 From: linghengqian Date: Tue, 2 Jan 2024 21:36:47 +0800 Subject: [PATCH] Host GraalVM Reachability Metadata of `ch.qos.logback:logback-core:1.2.12` to fix Error Log in NativeTest --- .../logback-core/1.2.12/reflect-config.json | 82 +++++++++++++++++++ .../8.0.31/reflect-config.json | 5 -- .../calcite-core/1.35.0/reflect-config.json | 12 --- .../3.0.4/reflect-config.json | 25 ------ .../reflect-config.json | 65 ++++++++++++--- .../resource-config.json | 3 + .../src/test/resources/logback-test.xml | 34 ++++++++ 7 files changed, 174 insertions(+), 52 deletions(-) create mode 100644 infra/reachability-metadata/src/main/resources/META-INF/native-image/ch.qos.logback/logback-core/1.2.12/reflect-config.json create mode 100644 test/native/src/test/resources/logback-test.xml diff --git a/infra/reachability-metadata/src/main/resources/META-INF/native-image/ch.qos.logback/logback-core/1.2.12/reflect-config.json b/infra/reachability-metadata/src/main/resources/META-INF/native-image/ch.qos.logback/logback-core/1.2.12/reflect-config.json new file mode 100644 index 0000000000000..642c144850d3f --- /dev/null +++ b/infra/reachability-metadata/src/main/resources/META-INF/native-image/ch.qos.logback/logback-core/1.2.12/reflect-config.json @@ -0,0 +1,82 @@ +[ +{ + "condition":{"typeReachable":"ch.qos.logback.core.joran.action.NestedComplexPropertyIA"}, + "name":"ch.qos.logback.classic.encoder.PatternLayoutEncoder", + "methods":[{"name":"","parameterTypes":[] }] +}, +{ + "condition":{"typeReachable":"ch.qos.logback.core.joran.util.beans.BeanDescriptionFactory"}, + "name":"ch.qos.logback.classic.encoder.PatternLayoutEncoder", + "queryAllPublicMethods":true +}, +{ + "condition":{"typeReachable":"ch.qos.logback.core.pattern.parser.Compiler"}, + "name":"ch.qos.logback.classic.pattern.DateConverter", + "methods":[{"name":"","parameterTypes":[] }] +}, +{ + "condition":{"typeReachable":"ch.qos.logback.core.pattern.parser.Compiler"}, + "name":"ch.qos.logback.classic.pattern.LevelConverter", + "methods":[{"name":"","parameterTypes":[] }] +}, +{ + "condition":{"typeReachable":"ch.qos.logback.core.pattern.parser.Compiler"}, + "name":"ch.qos.logback.classic.pattern.LineSeparatorConverter", + "methods":[{"name":"","parameterTypes":[] }] +}, +{ + "condition":{"typeReachable":"ch.qos.logback.core.pattern.parser.Compiler"}, + "name":"ch.qos.logback.classic.pattern.LoggerConverter", + "methods":[{"name":"","parameterTypes":[] }] +}, +{ + "condition":{"typeReachable":"ch.qos.logback.core.pattern.parser.Compiler"}, + "name":"ch.qos.logback.classic.pattern.MessageConverter", + "methods":[{"name":"","parameterTypes":[] }] +}, +{ + "condition":{"typeReachable":"ch.qos.logback.core.pattern.parser.Compiler"}, + "name":"ch.qos.logback.classic.pattern.ThreadConverter", + "methods":[{"name":"","parameterTypes":[] }] +}, +{ + "condition":{"typeReachable":"ch.qos.logback.core.joran.action.AppenderAction"}, + "name":"ch.qos.logback.core.ConsoleAppender", + "methods":[{"name":"","parameterTypes":[] }] +}, +{ + "condition":{"typeReachable":"ch.qos.logback.core.joran.util.beans.BeanDescriptionFactory"}, + "name":"ch.qos.logback.core.ConsoleAppender", + "queryAllPublicMethods":true +}, +{ + "condition":{"typeReachable":"ch.qos.logback.core.joran.util.PropertySetter"}, + "name":"ch.qos.logback.core.OutputStreamAppender", + "methods":[{"name":"setEncoder","parameterTypes":["ch.qos.logback.core.encoder.Encoder"] }] +}, +{ + "condition":{"typeReachable":"ch.qos.logback.core.joran.action.NestedComplexPropertyIA"}, + "name":"ch.qos.logback.core.encoder.Encoder", + "methods":[{"name":"valueOf","parameterTypes":["java.lang.String"] }] +}, +{ + "condition":{"typeReachable":"ch.qos.logback.core.joran.util.PropertySetter"}, + "name":"ch.qos.logback.core.encoder.LayoutWrappingEncoder", + "methods":[{"name":"setParent","parameterTypes":["ch.qos.logback.core.spi.ContextAware"] }] +}, +{ + "condition":{"typeReachable":"ch.qos.logback.core.joran.util.PropertySetter"}, + "name":"ch.qos.logback.core.pattern.PatternLayoutEncoderBase", + "methods":[{"name":"setPattern","parameterTypes":["java.lang.String"] }] +}, +{ + "condition":{"typeReachable":"ch.qos.logback.core.joran.action.NestedComplexPropertyIA"}, + "name":"ch.qos.logback.core.spi.ContextAware", + "methods":[{"name":"valueOf","parameterTypes":["java.lang.String"] }] +}, +{ + "condition":{"typeReachable":"ch.qos.logback.core.joran.action.StatusListenerAction"}, + "name":"ch.qos.logback.core.status.NopStatusListener", + "methods":[{"name":"","parameterTypes":[] }] +} +] diff --git a/infra/reachability-metadata/src/main/resources/META-INF/native-image/com.mysql/mysql-connector-j/8.0.31/reflect-config.json b/infra/reachability-metadata/src/main/resources/META-INF/native-image/com.mysql/mysql-connector-j/8.0.31/reflect-config.json index bb5e3f4c34a4f..1fa6b3a5cd7a7 100644 --- a/infra/reachability-metadata/src/main/resources/META-INF/native-image/com.mysql/mysql-connector-j/8.0.31/reflect-config.json +++ b/infra/reachability-metadata/src/main/resources/META-INF/native-image/com.mysql/mysql-connector-j/8.0.31/reflect-config.json @@ -32,10 +32,5 @@ "condition":{"typeReachable":"com.mysql.cj.NativeSession"}, "name":"com.mysql.cj.util.PerVmServerConfigCacheFactory", "methods":[{"name":"","parameterTypes":[] }] -}, -{ - "condition":{"typeReachable":"com.mysql.cj.protocol.StandardSocketFactory"}, - "name":"java.lang.Thread", - "fields":[{"name":"threadLocalRandomProbe"}] } ] diff --git a/infra/reachability-metadata/src/main/resources/META-INF/native-image/org.apache.calcite/calcite-core/1.35.0/reflect-config.json b/infra/reachability-metadata/src/main/resources/META-INF/native-image/org.apache.calcite/calcite-core/1.35.0/reflect-config.json index 8803134e75906..a1b09266a6fc8 100644 --- a/infra/reachability-metadata/src/main/resources/META-INF/native-image/org.apache.calcite/calcite-core/1.35.0/reflect-config.json +++ b/infra/reachability-metadata/src/main/resources/META-INF/native-image/org.apache.calcite/calcite-core/1.35.0/reflect-config.json @@ -1,16 +1,4 @@ [ -{ - "condition":{"typeReachable":"org.apache.calcite.plan.RelOptCluster"}, - "name":"[B" -}, -{ - "condition":{"typeReachable":"org.apache.calcite.plan.RelOptCluster"}, - "name":"[Ljava.lang.String;" -}, -{ - "condition":{"typeReachable":"org.apache.calcite.plan.RelOptCluster"}, - "name":"[Lsun.security.pkcs.SignerInfo;" -}, { "condition":{"typeReachable":"org.apache.calcite.linq4j.tree.Types"}, "name":"java.lang.Boolean", diff --git a/infra/reachability-metadata/src/main/resources/META-INF/native-image/org.apache.shardingsphere.elasticjob/elasticjob-lite-core/3.0.4/reflect-config.json b/infra/reachability-metadata/src/main/resources/META-INF/native-image/org.apache.shardingsphere.elasticjob/elasticjob-lite-core/3.0.4/reflect-config.json index 0f72d7a24a107..ee1b6fdacc5d5 100644 --- a/infra/reachability-metadata/src/main/resources/META-INF/native-image/org.apache.shardingsphere.elasticjob/elasticjob-lite-core/3.0.4/reflect-config.json +++ b/infra/reachability-metadata/src/main/resources/META-INF/native-image/org.apache.shardingsphere.elasticjob/elasticjob-lite-core/3.0.4/reflect-config.json @@ -1,29 +1,4 @@ [ -{ - "condition":{"typeReachable":"org.apache.shardingsphere.elasticjob.executor.ElasticJobExecutor"}, - "name":"java.util.Properties", - "methods":[{"name":"","parameterTypes":[] }] -}, -{ - "condition":{"typeReachable":"org.apache.shardingsphere.elasticjob.lite.internal.failover.FailoverListenerManager"}, - "name":"java.util.Properties", - "methods":[{"name":"","parameterTypes":[] }] -}, -{ - "condition":{"typeReachable":"org.apache.shardingsphere.elasticjob.lite.internal.reconcile.ReconcileService"}, - "name":"java.util.Properties", - "methods":[{"name":"","parameterTypes":[] }] -}, -{ - "condition":{"typeReachable":"org.apache.shardingsphere.elasticjob.lite.internal.sharding.ShardingListenerManager$ListenServersChangedJobListener"}, - "name":"java.util.Properties", - "methods":[{"name":"","parameterTypes":[] }] -}, -{ - "condition":{"typeReachable":"org.apache.shardingsphere.elasticjob.lite.internal.sharding.ShardingListenerManager$ShardingTotalCountChangedJobListener"}, - "name":"java.util.Properties", - "methods":[{"name":"","parameterTypes":[] }] -}, { "condition":{"typeReachable":"org.apache.shardingsphere.elasticjob.lite.internal.instance.InstanceNode"}, "name":"org.apache.shardingsphere.elasticjob.infra.handler.sharding.JobInstance", diff --git a/infra/reachability-metadata/src/main/resources/META-INF/native-image/org.apache.shardingsphere/shardingsphere-infra-reachability-metadata/reflect-config.json b/infra/reachability-metadata/src/main/resources/META-INF/native-image/org.apache.shardingsphere/shardingsphere-infra-reachability-metadata/reflect-config.json index a3737a72f055e..79f4c06a06048 100644 --- a/infra/reachability-metadata/src/main/resources/META-INF/native-image/org.apache.shardingsphere/shardingsphere-infra-reachability-metadata/reflect-config.json +++ b/infra/reachability-metadata/src/main/resources/META-INF/native-image/org.apache.shardingsphere/shardingsphere-infra-reachability-metadata/reflect-config.json @@ -4,16 +4,6 @@ "name":"java.util.Properties", "methods":[{"name":"","parameterTypes":[] }] }, -{ - "condition":{"typeReachable":"org.apache.shardingsphere.authority.rule.AuthorityRule"}, - "name":"org.apache.shardingsphere.authority.provider.database.DatabasePermittedAuthorityRegistryProvider", - "methods":[{"name":"","parameterTypes":[] }] -}, -{ - "condition":{"typeReachable":"org.apache.shardingsphere.authority.rule.AuthorityRule"}, - "name":"org.apache.shardingsphere.authority.provider.simple.AllPermittedAuthorityRegistryProvider", - "methods":[{"name":"","parameterTypes":[] }] -}, { "condition":{"typeReachable":"org.apache.shardingsphere.infra.yaml.config.shortcut.YamlRuleConfigurationShortcuts"}, "name":"org.apache.shardingsphere.authority.yaml.config.YamlAuthorityRuleConfiguration" @@ -1064,6 +1054,61 @@ "name":"org.apache.shardingsphere.sqlfederation.optimizer.planner.util.SQLFederationFunctionUtils", "queryAllPublicMethods":true }, +{ + "condition":{"typeReachable":"org.apache.shardingsphere.infra.connection.refresher.type.table.DropTableStatementSchemaRefresher"}, + "name":"org.apache.shardingsphere.sqlfederation.optimizer.planner.util.SQLFederationFunctionUtils", + "queryAllPublicMethods":true +}, +{ + "condition":{"typeReachable":"org.apache.shardingsphere.infra.rule.builder.global.GlobalRulesBuilder"}, + "name":"org.apache.shardingsphere.sqlfederation.optimizer.planner.util.SQLFederationFunctionUtils" +}, +{ + "condition":{"typeReachable":"org.apache.shardingsphere.mode.manager.cluster.NewClusterContextManagerBuilder"}, + "name":"org.apache.shardingsphere.sqlfederation.optimizer.planner.util.SQLFederationFunctionUtils", + "queryAllPublicMethods":true +}, +{ + "condition":{"typeReachable":"org.apache.shardingsphere.mode.manager.context.ConfigurationContextManager"}, + "name":"org.apache.shardingsphere.sqlfederation.optimizer.planner.util.SQLFederationFunctionUtils" +}, +{ + "condition":{"typeReachable":"org.apache.shardingsphere.mode.manager.context.ResourceMetaDataContextManager"}, + "name":"org.apache.shardingsphere.sqlfederation.optimizer.planner.util.SQLFederationFunctionUtils" +}, +{ + "condition":{"typeReachable":"org.apache.shardingsphere.mode.manager.standalone.NewStandaloneModeContextManager"}, + "name":"org.apache.shardingsphere.sqlfederation.optimizer.planner.util.SQLFederationFunctionUtils" +}, +{ + "condition":{"typeReachable":"org.apache.shardingsphere.mode.metadata.NewMetaDataContextsFactory"}, + "name":"org.apache.shardingsphere.sqlfederation.optimizer.planner.util.SQLFederationFunctionUtils", + "queryAllPublicMethods":true +}, +{ + "condition":{"typeReachable":"org.apache.shardingsphere.sqlfederation.optimizer.context.OptimizerContextFactory"}, + "name":"org.apache.shardingsphere.sqlfederation.optimizer.planner.util.SQLFederationFunctionUtils" +}, +{ + "condition":{"typeReachable":"org.apache.shardingsphere.sqlfederation.optimizer.context.planner.OptimizerPlannerContextFactory"}, + "name":"org.apache.shardingsphere.sqlfederation.optimizer.planner.util.SQLFederationFunctionUtils" +}, +{ + "condition":{"typeReachable":"org.apache.shardingsphere.sqlfederation.optimizer.planner.util.SQLFederationFunctionUtils"}, + "name":"org.apache.shardingsphere.sqlfederation.optimizer.planner.util.SQLFederationFunctionUtils" +}, +{ + "condition":{"typeReachable":"org.apache.shardingsphere.sqlfederation.optimizer.planner.util.SQLFederationPlannerUtils"}, + "name":"org.apache.shardingsphere.sqlfederation.optimizer.planner.util.SQLFederationFunctionUtils" +}, +{ + "condition":{"typeReachable":"org.apache.shardingsphere.sqlfederation.rule.SQLFederationRule"}, + "name":"org.apache.shardingsphere.sqlfederation.optimizer.planner.util.SQLFederationFunctionUtils" +}, +{ + "condition":{"typeReachable":"org.apache.shardingsphere.sqlfederation.rule.builder.SQLFederationRuleBuilder"}, + "name":"org.apache.shardingsphere.sqlfederation.optimizer.planner.util.SQLFederationFunctionUtils" +}, { "condition":{"typeReachable":"org.apache.shardingsphere.infra.yaml.config.shortcut.YamlRuleConfigurationShortcuts"}, "name":"org.apache.shardingsphere.sqlfederation.yaml.config.YamlSQLFederationRuleConfiguration" diff --git a/test/native/src/test/resources/META-INF/native-image/shardingsphere-test-native-test-metadata/resource-config.json b/test/native/src/test/resources/META-INF/native-image/shardingsphere-test-native-test-metadata/resource-config.json index c904b01b54796..67d2b4b367604 100644 --- a/test/native/src/test/resources/META-INF/native-image/shardingsphere-test-native-test-metadata/resource-config.json +++ b/test/native/src/test/resources/META-INF/native-image/shardingsphere-test-native-test-metadata/resource-config.json @@ -3,6 +3,9 @@ "includes":[{ "condition":{"typeReachable":"org.apache.shardingsphere.test.natived.jdbc.databases.MSSQLServerTest"}, "pattern":"\\Qcontainer-license-acceptance.txt\\E" + }, { + "condition":{"typeReachable":"ch.qos.logback.core.util.Loader"}, + "pattern":"\\Qlogback-test.xml\\E" }, { "condition":{"typeReachable":"org.apache.shardingsphere.test.natived.jdbc.databases.MSSQLServerTest"}, "pattern":"\\Qtest-native/yaml/databases/mssqlserver.yaml\\E" diff --git a/test/native/src/test/resources/logback-test.xml b/test/native/src/test/resources/logback-test.xml new file mode 100644 index 0000000000000..5367fd2b1a339 --- /dev/null +++ b/test/native/src/test/resources/logback-test.xml @@ -0,0 +1,34 @@ + + + + + + + + [%-5level] %d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %logger{36} - %msg%n + + + + + + + + + + +