diff --git a/infra/reachability-metadata/src/main/resources/META-INF/native-image/org.apache.shardingsphere/generated-reachability-metadata/reflect-config.json b/infra/reachability-metadata/src/main/resources/META-INF/native-image/org.apache.shardingsphere/generated-reachability-metadata/reflect-config.json index aea90f251fd4d..55fb5da627a1c 100644 --- a/infra/reachability-metadata/src/main/resources/META-INF/native-image/org.apache.shardingsphere/generated-reachability-metadata/reflect-config.json +++ b/infra/reachability-metadata/src/main/resources/META-INF/native-image/org.apache.shardingsphere/generated-reachability-metadata/reflect-config.json @@ -147,6 +147,10 @@ "condition":{"typeReachable":"org.apache.shardingsphere.mode.repository.standalone.jdbc.JDBCRepository"}, "name":"org.apache.shardingsphere.driver.ShardingSphereDriver" }, +{ + "condition":{"typeReachable":"org.apache.shardingsphere.driver.jdbc.core.statement.ShardingSphereStatement"}, + "name":"org.apache.shardingsphere.driver.executor.engine.facade.standard.StandardDriverExecutorFacadeFactory" +}, { "condition":{"typeReachable":"org.apache.shardingsphere.infra.util.yaml.YamlEngine"}, "name":"org.apache.shardingsphere.driver.yaml.YamlJDBCConfiguration", @@ -329,6 +333,11 @@ "condition":{"typeReachable":"org.apache.shardingsphere.infra.util.yaml.YamlEngine"}, "name":"org.apache.shardingsphere.infra.algorithm.core.yaml.YamlAlgorithmConfigurationCustomizer" }, +{ + "condition":{"typeReachable":"org.apache.shardingsphere.encrypt.algorithm.standard.AESEncryptAlgorithm"}, + "name":"org.apache.shardingsphere.infra.algorithm.cryptographic.aes.AESCryptographicAlgorithm", + "methods":[{"name":"","parameterTypes":[] }] +}, { "condition":{"typeReachable":"org.apache.shardingsphere.sharding.checker.ShardingRuleConfigurationChecker"}, "name":"org.apache.shardingsphere.infra.algorithm.keygen.snowflake.SnowflakeKeyGenerateAlgorithm", @@ -591,15 +600,6 @@ }, { "condition":{"typeReachable":"org.apache.shardingsphere.infra.util.eventbus.EventBusContext"}, - "name":"org.apache.shardingsphere.infra.util.eventbus.EventSubscriber" -}, -{ - "condition":{"typeReachable":"org.apache.shardingsphere.mode.event.subsciber.DeliverEventSubscriberRegistry$$Lambda/0x00007fce7f479688"}, - "name":"org.apache.shardingsphere.infra.util.eventbus.EventSubscriber", - "queryAllDeclaredMethods":true -}, -{ - "condition":{"typeReachable":"org.apache.shardingsphere.mode.manager.cluster.event.subscriber.registry.ClusterDispatchEventSubscriberRegistry$$Lambda/0x00007fce7f490a30"}, "name":"org.apache.shardingsphere.infra.util.eventbus.EventSubscriber", "queryAllDeclaredMethods":true }, @@ -913,80 +913,72 @@ "name":"org.apache.shardingsphere.mask.yaml.config.rule.YamlMaskTableRuleConfigurationCustomizer" }, { - "condition":{"typeReachable":"org.apache.shardingsphere.mode.event.subsciber.DeliverEventSubscriberRegistry$$Lambda/0x00007fce7f479688"}, + "condition":{"typeReachable":"org.apache.shardingsphere.infra.util.eventbus.EventBusContext"}, "name":"org.apache.shardingsphere.mode.manager.cluster.event.subscriber.deliver.DeliverQualifiedDataSourceSubscriber", "queryAllDeclaredMethods":true }, { "condition":{"typeReachable":"org.apache.shardingsphere.infra.util.eventbus.EventBusContext"}, "name":"org.apache.shardingsphere.mode.manager.cluster.event.subscriber.dispatch.CacheEvictedSubscriber", + "queryAllDeclaredMethods":true, "methods":[{"name":"cleanCache","parameterTypes":["org.apache.shardingsphere.mode.event.dispatch.DispatchEvent"] }] }, { - "condition":{"typeReachable":"org.apache.shardingsphere.mode.manager.cluster.event.subscriber.registry.ClusterDispatchEventSubscriberRegistry$$Lambda/0x00007fce7f490a30"}, - "name":"org.apache.shardingsphere.mode.manager.cluster.event.subscriber.dispatch.CacheEvictedSubscriber", - "queryAllDeclaredMethods":true -}, -{ - "condition":{"typeReachable":"org.apache.shardingsphere.mode.manager.cluster.event.subscriber.registry.ClusterDispatchEventSubscriberRegistry$$Lambda/0x00007fce7f490a30"}, - "name":"org.apache.shardingsphere.mode.manager.cluster.event.subscriber.dispatch.ComputeNodeOnlineSubscriber", + "condition":{"typeReachable":"org.apache.shardingsphere.infra.util.eventbus.EventBusContext"}, + "name":"org.apache.shardingsphere.mode.manager.cluster.event.subscriber.dispatch.ComputeNodeStateSubscriber", "queryAllDeclaredMethods":true }, { - "condition":{"typeReachable":"org.apache.shardingsphere.mode.manager.cluster.event.subscriber.registry.ClusterDispatchEventSubscriberRegistry$$Lambda/0x00007fce7f490a30"}, - "name":"org.apache.shardingsphere.mode.manager.cluster.event.subscriber.dispatch.DatabaseChangedSubscriber", + "condition":{"typeReachable":"org.apache.shardingsphere.infra.util.eventbus.EventBusContext"}, + "name":"org.apache.shardingsphere.mode.manager.cluster.event.subscriber.dispatch.DatabaseDataChangedSubscriber", "queryAllDeclaredMethods":true }, { - "condition":{"typeReachable":"org.apache.shardingsphere.mode.manager.cluster.event.subscriber.registry.ClusterDispatchEventSubscriberRegistry$$Lambda/0x00007fce7f490a30"}, + "condition":{"typeReachable":"org.apache.shardingsphere.infra.util.eventbus.EventBusContext"}, "name":"org.apache.shardingsphere.mode.manager.cluster.event.subscriber.dispatch.GlobalRuleConfigurationEventSubscriber", "queryAllDeclaredMethods":true }, { - "condition":{"typeReachable":"org.apache.shardingsphere.mode.manager.cluster.event.subscriber.registry.ClusterDispatchEventSubscriberRegistry$$Lambda/0x00007fce7f490a30"}, + "condition":{"typeReachable":"org.apache.shardingsphere.infra.util.eventbus.EventBusContext"}, "name":"org.apache.shardingsphere.mode.manager.cluster.event.subscriber.dispatch.ListenerAssistedSubscriber", "queryAllDeclaredMethods":true }, { - "condition":{"typeReachable":"org.apache.shardingsphere.mode.manager.cluster.event.subscriber.registry.ClusterDispatchEventSubscriberRegistry$$Lambda/0x00007fce7f490a30"}, - "name":"org.apache.shardingsphere.mode.manager.cluster.event.subscriber.dispatch.ProcessListChangedSubscriber", + "condition":{"typeReachable":"org.apache.shardingsphere.infra.util.eventbus.EventBusContext"}, + "name":"org.apache.shardingsphere.mode.manager.cluster.event.subscriber.dispatch.MetaDataChangedSubscriber", "queryAllDeclaredMethods":true }, { - "condition":{"typeReachable":"org.apache.shardingsphere.mode.manager.cluster.event.subscriber.registry.ClusterDispatchEventSubscriberRegistry$$Lambda/0x00007fce7f490a30"}, - "name":"org.apache.shardingsphere.mode.manager.cluster.event.subscriber.dispatch.PropertiesEventSubscriber", - "queryAllDeclaredMethods":true + "condition":{"typeReachable":"org.apache.shardingsphere.mode.manager.cluster.listener.MetaDataChangedListener$$Lambda/0x00007f04a35d5a38"}, + "name":"org.apache.shardingsphere.mode.manager.cluster.event.subscriber.dispatch.MetaDataChangedSubscriber" }, { - "condition":{"typeReachable":"org.apache.shardingsphere.mode.manager.cluster.event.subscriber.registry.ClusterDispatchEventSubscriberRegistry$$Lambda/0x00007fce7f490a30"}, - "name":"org.apache.shardingsphere.mode.manager.cluster.event.subscriber.dispatch.QualifiedDataSourceSubscriber", + "condition":{"typeReachable":"org.apache.shardingsphere.infra.util.eventbus.EventBusContext"}, + "name":"org.apache.shardingsphere.mode.manager.cluster.event.subscriber.dispatch.ProcessListChangedSubscriber", "queryAllDeclaredMethods":true }, { "condition":{"typeReachable":"org.apache.shardingsphere.infra.util.eventbus.EventBusContext"}, - "name":"org.apache.shardingsphere.mode.manager.cluster.event.subscriber.dispatch.ResourceMetaDataChangedSubscriber" -}, -{ - "condition":{"typeReachable":"org.apache.shardingsphere.mode.manager.cluster.event.subscriber.registry.ClusterDispatchEventSubscriberRegistry$$Lambda/0x00007fce7f490a30"}, - "name":"org.apache.shardingsphere.mode.manager.cluster.event.subscriber.dispatch.ResourceMetaDataChangedSubscriber", + "name":"org.apache.shardingsphere.mode.manager.cluster.event.subscriber.dispatch.PropertiesEventSubscriber", "queryAllDeclaredMethods":true }, { - "condition":{"typeReachable":"org.apache.shardingsphere.mode.manager.cluster.listener.MetaDataChangedListener$$Lambda/0x00007fce7f5d5000"}, - "name":"org.apache.shardingsphere.mode.manager.cluster.event.subscriber.dispatch.ResourceMetaDataChangedSubscriber" + "condition":{"typeReachable":"org.apache.shardingsphere.infra.util.eventbus.EventBusContext"}, + "name":"org.apache.shardingsphere.mode.manager.cluster.event.subscriber.dispatch.QualifiedDataSourceSubscriber", + "queryAllDeclaredMethods":true }, { - "condition":{"typeReachable":"org.apache.shardingsphere.mode.manager.cluster.event.subscriber.registry.ClusterDispatchEventSubscriberRegistry$$Lambda/0x00007fce7f490a30"}, + "condition":{"typeReachable":"org.apache.shardingsphere.infra.util.eventbus.EventBusContext"}, "name":"org.apache.shardingsphere.mode.manager.cluster.event.subscriber.dispatch.RuleItemChangedSubscriber", "queryAllDeclaredMethods":true }, { - "condition":{"typeReachable":"org.apache.shardingsphere.mode.manager.cluster.event.subscriber.registry.ClusterDispatchEventSubscriberRegistry$$Lambda/0x00007fce7f490a30"}, + "condition":{"typeReachable":"org.apache.shardingsphere.infra.util.eventbus.EventBusContext"}, "name":"org.apache.shardingsphere.mode.manager.cluster.event.subscriber.dispatch.StateChangedSubscriber", "queryAllDeclaredMethods":true }, { - "condition":{"typeReachable":"org.apache.shardingsphere.mode.manager.cluster.event.subscriber.registry.ClusterDispatchEventSubscriberRegistry$$Lambda/0x00007fce7f490a30"}, + "condition":{"typeReachable":"org.apache.shardingsphere.infra.util.eventbus.EventBusContext"}, "name":"org.apache.shardingsphere.mode.manager.cluster.event.subscriber.dispatch.StorageUnitEventSubscriber", "queryAllDeclaredMethods":true }, diff --git a/infra/reachability-metadata/src/main/resources/META-INF/native-image/org.apache.shardingsphere/generated-reachability-metadata/resource-config.json b/infra/reachability-metadata/src/main/resources/META-INF/native-image/org.apache.shardingsphere/generated-reachability-metadata/resource-config.json index 988ed917e9a52..fd1b1b92e6ce2 100644 --- a/infra/reachability-metadata/src/main/resources/META-INF/native-image/org.apache.shardingsphere/generated-reachability-metadata/resource-config.json +++ b/infra/reachability-metadata/src/main/resources/META-INF/native-image/org.apache.shardingsphere/generated-reachability-metadata/resource-config.json @@ -120,6 +120,9 @@ }, { "condition":{"typeReachable":"org.apache.shardingsphere.authority.rule.AuthorityRule"}, "pattern":"\\QMETA-INF/services/org.apache.shardingsphere.authority.spi.PrivilegeProvider\\E" + }, { + "condition":{"typeReachable":"org.apache.shardingsphere.driver.jdbc.core.statement.ShardingSphereStatement"}, + "pattern":"\\QMETA-INF/services/org.apache.shardingsphere.driver.executor.engine.facade.DriverExecutorFacadeFactory\\E" }, { "condition":{"typeReachable":"org.apache.shardingsphere.infra.spi.type.ordered.OrderedSPILoader"}, "pattern":"\\QMETA-INF/services/org.apache.shardingsphere.infra.config.rule.checker.RuleConfigurationChecker\\E" 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 d06109806703f..dd637384c684b 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 @@ -46,13 +46,13 @@ }, { "condition":{"typeReachable":"org.apache.shardingsphere.infra.util.eventbus.EventBusContext"}, - "name":"org.apache.shardingsphere.mode.manager.cluster.event.subscriber.dispatch.ResourceMetaDataChangedSubscriber", - "methods":[{"name":"renew","parameterTypes":["org.apache.shardingsphere.mode.event.dispatch.metadata.schema.table.CreateOrAlterTableEvent"] }, {"name":"renew","parameterTypes":["org.apache.shardingsphere.mode.event.dispatch.metadata.schema.table.DropTableEvent"] }] + "name":"org.apache.shardingsphere.mode.manager.cluster.event.subscriber.dispatch.MetaDataChangedSubscriber", + "allPublicMethods":true }, { "condition":{"typeReachable":"org.apache.shardingsphere.infra.util.eventbus.EventBusContext"}, "name":"org.apache.shardingsphere.mode.manager.cluster.event.subscriber.dispatch.StateChangedSubscriber", - "methods":[{"name":"renew","parameterTypes":["org.apache.shardingsphere.mode.event.dispatch.state.cluster.ClusterStateEvent"] }] + "allPublicMethods":true }, { "condition":{"typeReachable":"org.apache.shardingsphere.driver.jdbc.core.statement.ShardingSpherePreparedStatement"}, diff --git a/test/native/src/test/java/org/apache/shardingsphere/test/natived/jdbc/commons/TestShardingService.java b/test/native/src/test/java/org/apache/shardingsphere/test/natived/jdbc/commons/TestShardingService.java index 97d5a2236e246..42a4215b1ca90 100644 --- a/test/native/src/test/java/org/apache/shardingsphere/test/natived/jdbc/commons/TestShardingService.java +++ b/test/native/src/test/java/org/apache/shardingsphere/test/natived/jdbc/commons/TestShardingService.java @@ -24,10 +24,12 @@ import org.apache.shardingsphere.test.natived.jdbc.commons.repository.AddressRepository; import org.apache.shardingsphere.test.natived.jdbc.commons.repository.OrderItemRepository; import org.apache.shardingsphere.test.natived.jdbc.commons.repository.OrderRepository; +import org.awaitility.Awaitility; import javax.sql.DataSource; import java.sql.SQLException; import java.sql.Statement; +import java.time.Duration; import java.util.ArrayList; import java.util.Arrays; import java.util.Collection; @@ -88,6 +90,8 @@ public void processSuccess() throws SQLException { /** * Process success in ClickHouse. + * TODO On low-performance devices like Github Actions, it takes longer to execute DELETE statements, + * which leads to the use of {@code org.awaitility.Awaitility.await()} here. Maybe there is room for improvement in Clickhouse JDBC Driver. * ClickHouse has not fully supported transactions. Refer to ClickHouse/clickhouse-docs#2300. * So ShardingSphere should not use {@link OrderItemRepository#assertRollbackWithTransactions()} in the method here. * @@ -114,6 +118,7 @@ public void processSuccessInClickHouse() throws SQLException { assertThat(addressRepository.selectAll(), equalTo(LongStream.range(1L, 11L).mapToObj(each -> new Address(each, "address_test_" + each)).collect(Collectors.toList()))); deleteDataInClickHouse(orderIds); + Awaitility.await().pollDelay(Duration.ofSeconds(5L)).until(() -> true); assertThat(orderRepository.selectAll(), equalTo(Collections.emptyList())); assertThat(orderItemRepository.selectAll(), equalTo(Collections.emptyList())); assertThat(addressRepository.selectAll(), equalTo(Collections.emptyList())); diff --git a/test/native/src/test/java/org/apache/shardingsphere/test/natived/jdbc/modes/cluster/EtcdTest.java b/test/native/src/test/java/org/apache/shardingsphere/test/natived/jdbc/modes/cluster/EtcdTest.java index abf2e44b903d0..184f41a92cb8c 100644 --- a/test/native/src/test/java/org/apache/shardingsphere/test/natived/jdbc/modes/cluster/EtcdTest.java +++ b/test/native/src/test/java/org/apache/shardingsphere/test/natived/jdbc/modes/cluster/EtcdTest.java @@ -73,10 +73,7 @@ void assertShardingInLocalTransactions() throws SQLException { DataSource dataSource = createDataSource(CLUSTER.clientEndpoints()); testShardingService = new TestShardingService(dataSource); initEnvironment(); - Awaitility.await().atMost(Duration.ofSeconds(30L)).ignoreExceptions().until(() -> { - dataSource.getConnection().close(); - return true; - }); + Awaitility.await().pollDelay(Duration.ofSeconds(5L)).until(() -> true); testShardingService.processSuccess(); testShardingService.cleanEnvironment(); } diff --git a/test/native/src/test/java/org/apache/shardingsphere/test/natived/jdbc/modes/cluster/ZookeeperTest.java b/test/native/src/test/java/org/apache/shardingsphere/test/natived/jdbc/modes/cluster/ZookeeperTest.java index 5ff2a61e44ed5..68355db0733fb 100644 --- a/test/native/src/test/java/org/apache/shardingsphere/test/natived/jdbc/modes/cluster/ZookeeperTest.java +++ b/test/native/src/test/java/org/apache/shardingsphere/test/natived/jdbc/modes/cluster/ZookeeperTest.java @@ -28,6 +28,7 @@ import org.junit.jupiter.api.AfterAll; import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.condition.EnabledInNativeImage; import javax.sql.DataSource; import java.sql.SQLException; @@ -38,6 +39,7 @@ import static org.hamcrest.Matchers.is; import static org.hamcrest.Matchers.nullValue; +@EnabledInNativeImage class ZookeeperTest { private static final String SYSTEM_PROP_KEY_PREFIX = "fixture.test-native.yaml.mode.cluster.zookeeper."; @@ -68,10 +70,7 @@ void assertShardingInLocalTransactions() throws Exception { DataSource dataSource = createDataSource(connectString); testShardingService = new TestShardingService(dataSource); initEnvironment(); - Awaitility.await().atMost(Duration.ofSeconds(30L)).ignoreExceptions().until(() -> { - dataSource.getConnection().close(); - return true; - }); + Awaitility.await().pollDelay(Duration.ofSeconds(5L)).until(() -> true); testShardingService.processSuccess(); testShardingService.cleanEnvironment(); }