-
Notifications
You must be signed in to change notification settings - Fork 6.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Enable Safe Composition of Metadata for ShardingSphere Proxy Native
- Loading branch information
1 parent
e279df2
commit a38c3ea
Showing
48 changed files
with
2,676 additions
and
220 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -251,9 +251,10 @@ Caused by: java.io.UnsupportedEncodingException: Codepage Cp1252 is not supporte | |
```json | ||
[ | ||
{ | ||
"condition":{"typeReachable":"com.mysql.cj.jdbc.MysqlXADataSource"}, | ||
"name":"com.mysql.cj.jdbc.MysqlXADataSource", | ||
"allDeclaredConstructors": true | ||
"condition":{"typeReachable":"com.mysql.cj.jdbc.MysqlXADataSource"}, | ||
"name":"com.mysql.cj.jdbc.MysqlXADataSource", | ||
"allPublicMethods": true, | ||
"methods": [{"name":"<init>","parameterTypes":[] }] | ||
} | ||
] | ||
``` | ||
|
@@ -484,7 +485,7 @@ sudo apt-get install build-essential zlib1g-dev -y | |
git clone [email protected]:apache/shardingsphere.git | ||
cd ./shardingsphere/ | ||
./mvnw -PnativeTestInShardingSphere -e clean test | ||
./mvnw -PnativeTestInShardingSphere -e -T 1C clean test | ||
``` | ||
|
||
当贡献者发现缺少与 ShardingSphere 无关的第三方库的 GraalVM Reachability Metadata 时,应当在 | ||
|
@@ -513,10 +514,26 @@ Reachability Metadata 位于 `shardingsphere-infra-reachability-metadata` 子模 | |
```bash | ||
git clone [email protected]:apache/shardingsphere.git | ||
cd ./shardingsphere/ | ||
./mvnw -PgenerateMetadata -DskipNativeTests -e clean test native:metadata-copy | ||
./mvnw -PgenerateMetadata -DskipNativeTests -e -T 1C clean test native:metadata-copy | ||
``` | ||
|
||
在使用 GraalVM Native Build Tools 的 Maven Plugin 时, | ||
贡献者应避免使用 Maven 的并行构建功能。 | ||
GraalVM Native Build Tools 的 Maven Plugin并不是线程安全的, | ||
它与 https://cwiki.apache.org/confluence/display/MAVEN/Parallel+builds+in+Maven+3 不兼容。 | ||
受 https://github.com/apache/shardingsphere/issues/33206 影响, | ||
贡献者执行 `./mvnw -PgenerateMetadata -DskipNativeTests -T 1C -e clean test native:metadata-copy` 后, | ||
`infra/reachability-metadata/src/main/resources/META-INF/native-image/org.apache.shardingsphere/generated-reachability-metadata/resource-config.json` 会生成不必要的包含绝对路径的 JSON 条目, | ||
类似如下, | ||
|
||
```json | ||
{ | ||
"resources":{ | ||
"includes":[{ | ||
"condition":{"typeReachable":"org.apache.shardingsphere.proxy.backend.config.ProxyConfigurationLoader"}, | ||
"pattern":"\\QcustomPath/shardingsphere/test/native/src/test/resources/test-native/yaml/proxy/databases/postgresql//global.yaml\\E" | ||
}, { | ||
"condition":{"typeReachable":"org.apache.shardingsphere.proxy.backend.config.ProxyConfigurationLoader"}, | ||
"pattern":"\\QcustomPath/shardingsphere/test/native/src/test/resources/test-native/yaml/proxy/databases/postgresql/\\E" | ||
}]}, | ||
"bundles":[] | ||
} | ||
``` | ||
|
||
贡献者应始终手动删除这些包含绝对路径的 JSON 条目,并等待 https://github.com/oracle/graal/issues/8417 被解决。 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -264,9 +264,10 @@ to define the constructor of `com.mysql.cj.jdbc.MysqlXADataSource` inside the Gr | |
```json | ||
[ | ||
{ | ||
"condition":{"typeReachable":"com.mysql.cj.jdbc.MysqlXADataSource"}, | ||
"name":"com.mysql.cj.jdbc.MysqlXADataSource", | ||
"allDeclaredConstructors": true | ||
"condition":{"typeReachable":"com.mysql.cj.jdbc.MysqlXADataSource"}, | ||
"name":"com.mysql.cj.jdbc.MysqlXADataSource", | ||
"allPublicMethods": true, | ||
"methods": [{"name":"<init>","parameterTypes":[] }] | ||
} | ||
] | ||
``` | ||
|
@@ -502,7 +503,7 @@ sudo apt-get install build-essential zlib1g-dev -y | |
git clone [email protected]:apache/shardingsphere.git | ||
cd ./shardingsphere/ | ||
./mvnw -PnativeTestInShardingSphere -e clean test | ||
./mvnw -PnativeTestInShardingSphere -e -T 1C clean test | ||
``` | ||
|
||
When contributors discover that GraalVM Reachability Metadata is missing for a third-party library not related to ShardingSphere, | ||
|
@@ -532,8 +533,26 @@ contributors should place it on the classpath of the `shardingsphere-test-native | |
```bash | ||
git clone [email protected]:apache/shardingsphere.git | ||
cd ./shardingsphere/ | ||
./mvnw -PgenerateMetadata -DskipNativeTests -e clean test native:metadata-copy | ||
./mvnw -PgenerateMetadata -DskipNativeTests -e -T 1C clean test native:metadata-copy | ||
``` | ||
|
||
Contributors should avoid using Maven's parallel builds feature when using the Maven Plugin for GraalVM Native Build Tools. | ||
The Maven Plugin for GraalVM Native Build Tools is not thread-safe and is incompatible with https://cwiki.apache.org/confluence/display/MAVEN/Parallel+builds+in+Maven+3 . | ||
Affected by https://github.com/apache/shardingsphere/issues/33206 , | ||
After the contributor executes `./mvnw -PgenerateMetadata -DskipNativeTests -T 1C -e clean test native:metadata-copy`, | ||
`infra/reachability-metadata/src/main/resources/META-INF/native-image/org.apache.shardingsphere/generated-reachability-metadata/resource-config.json` will generate unnecessary JSON entries containing absolute paths, | ||
similar to the following. | ||
|
||
```json | ||
{ | ||
"resources":{ | ||
"includes":[{ | ||
"condition":{"typeReachable":"org.apache.shardingsphere.proxy.backend.config.ProxyConfigurationLoader"}, | ||
"pattern":"\\QcustomPath/shardingsphere/test/native/src/test/resources/test-native/yaml/proxy/databases/postgresql//global.yaml\\E" | ||
}, { | ||
"condition":{"typeReachable":"org.apache.shardingsphere.proxy.backend.config.ProxyConfigurationLoader"}, | ||
"pattern":"\\QcustomPath/shardingsphere/test/native/src/test/resources/test-native/yaml/proxy/databases/postgresql/\\E" | ||
}]}, | ||
"bundles":[] | ||
} | ||
``` | ||
|
||
Contributors should always manually remove these JSON entries containing absolute paths and wait for https://github.com/oracle/graal/issues/8417 to be resolved. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
54 changes: 54 additions & 0 deletions
54
...data/src/main/resources/META-INF/native-image/com.alibaba/druid/1.2.7/reflect-config.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
[ | ||
{ | ||
"condition":{"typeReachable":"com.alibaba.druid.mock.MockDriver"}, | ||
"name":"com.alibaba.druid.mock.MockDriver", | ||
"queryAllPublicConstructors":true | ||
}, | ||
{ | ||
"condition":{"typeReachable":"com.alibaba.druid.mock.MockDriver"}, | ||
"name":"com.alibaba.druid.mock.MockDriverMBean", | ||
"queryAllPublicMethods":true | ||
}, | ||
{ | ||
"condition":{"typeReachable":"com.alibaba.druid.proxy.DruidDriver"}, | ||
"name":"com.alibaba.druid.proxy.DruidDriver", | ||
"queryAllPublicConstructors":true | ||
}, | ||
{ | ||
"condition":{"typeReachable":"com.alibaba.druid.proxy.DruidDriver"}, | ||
"name":"com.alibaba.druid.proxy.DruidDriverMBean", | ||
"queryAllPublicMethods":true | ||
}, | ||
{ | ||
"condition":{"typeReachable":"com.alibaba.druid.support.logging.LogFactory"}, | ||
"name":"com.alibaba.druid.support.logging.JakartaCommonsLoggingImpl", | ||
"methods":[{"name":"<init>","parameterTypes":["java.lang.String"] }] | ||
}, | ||
{ | ||
"condition":{"typeReachable":"com.alibaba.druid.support.logging.Resources"}, | ||
"name":"com.alibaba.druid.support.logging.JakartaCommonsLoggingImpl" | ||
}, | ||
{ | ||
"condition":{"typeReachable":"com.alibaba.druid.support.logging.LogFactory"}, | ||
"name":"com.alibaba.druid.support.logging.Jdk14LoggingImpl", | ||
"methods":[{"name":"<init>","parameterTypes":["java.lang.String"] }] | ||
}, | ||
{ | ||
"condition":{"typeReachable":"com.alibaba.druid.support.logging.Resources"}, | ||
"name":"com.alibaba.druid.support.logging.Jdk14LoggingImpl" | ||
}, | ||
{ | ||
"condition":{"typeReachable":"com.alibaba.druid.support.logging.LogFactory"}, | ||
"name":"com.alibaba.druid.support.logging.NoLoggingImpl", | ||
"methods":[{"name":"<init>","parameterTypes":["java.lang.String"] }] | ||
}, | ||
{ | ||
"condition":{"typeReachable":"com.alibaba.druid.support.logging.LogFactory"}, | ||
"name":"com.alibaba.druid.support.logging.SLF4JImpl", | ||
"methods":[{"name":"<init>","parameterTypes":["java.lang.String"] }] | ||
}, | ||
{ | ||
"condition":{"typeReachable":"com.alibaba.druid.support.logging.Resources"}, | ||
"name":"com.alibaba.druid.support.logging.SLF4JImpl" | ||
} | ||
] |
8 changes: 8 additions & 0 deletions
8
...ata/src/main/resources/META-INF/native-image/com.alibaba/druid/1.2.7/resource-config.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
{ | ||
"resources":{ | ||
"includes":[{ | ||
"condition":{"typeReachable":"com.alibaba.druid.util.JdbcUtils"}, | ||
"pattern":"\\QMETA-INF/druid-driver.properties\\E" | ||
}]}, | ||
"bundles":[] | ||
} |
7 changes: 7 additions & 0 deletions
7
.../main/resources/META-INF/native-image/com.atomikos/transactions/6.0.0/reflect-config.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
[ | ||
{ | ||
"condition":{"typeReachable":"com.atomikos.logging.LoggerFactory"}, | ||
"name":"com.atomikos.logging.Slf4JLoggerFactoryDelegate", | ||
"methods":[{"name":"<init>","parameterTypes":[] }] | ||
} | ||
] |
8 changes: 0 additions & 8 deletions
8
...main/resources/META-INF/native-image/com.atomikos/transactions/6.0.0/resource-config.json
This file was deleted.
Oops, something went wrong.
8 changes: 8 additions & 0 deletions
8
...resources/META-INF/native-image/com.clickhouse/clickhouse-jdbc/0.6.3/resource-config.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
{ | ||
"resources":{ | ||
"includes":[{ | ||
"condition":{"typeReachable":"com.clickhouse.logging.LoggerFactory"}, | ||
"pattern":"\\QMETA-INF/services/com.clickhouse.logging.LoggerFactory\\E" | ||
}]}, | ||
"bundles":[] | ||
} |
7 changes: 0 additions & 7 deletions
7
...es/META-INF/native-image/com.github.docker-java/docker-java-api/3.3.6/reflect-config.json
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.