This is an automated email from the ASF dual-hosted git repository.
zhangliang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/shardingsphere.git
The following commit(s) were added to refs/heads/master by this push:
new bb2dd94e3fe Update the version of GraalVM CE used by ShardingSphere
Proxy Native to 23.0.1 (#27487)
bb2dd94e3fe is described below
commit bb2dd94e3fec2c0aea6b8301851f8a9dd53fcd74
Author: Ling Hengqian <[email protected]>
AuthorDate: Sat Aug 12 22:32:15 2023 +0800
Update the version of GraalVM CE used by ShardingSphere Proxy Native to
23.0.1 (#27487)
* Update the version of GraalVM used by ShardingSphere Proxy Native to
23.0.0
* Add the `shardingsphere-infra-expr-purelist` module to replace the
`shardingsphere-infra-expr-espresso` module
---
.github/workflows/nightly-build.yml | 6 +-
distribution/proxy-native/Dockerfile | 7 -
distribution/proxy-native/access-filter.json | 3 +-
distribution/proxy-native/pom.xml | 6 -
.../proxy-native/src/main/release-docs/LICENSE | 9 --
.../release-docs/licenses/LICENSE-truffle-api.txt | 35 -----
distribution/proxy/src/main/release-docs/LICENSE | 10 --
.../release-docs/licenses/LICENSE-truffle-api.txt | 35 -----
.../startup/graalvm-native-image.cn.md | 45 +++---
.../startup/graalvm-native-image.en.md | 62 ++++-----
infra/expr/core/pom.xml | 2 +-
.../expr/core/InlineExpressionParserFactory.java | 4 +-
infra/expr/espresso/pom.xml | 36 +----
.../espresso/EspressoInlineExpressionParser.java | 153 +++++++++++++++++----
.../EspressoInlineExpressionParserTest.java | 4 +-
infra/expr/pom.xml | 1 +
infra/expr/{ => purelist}/pom.xml | 23 ++--
.../purelist/PureListInlineExpressionParser.java | 72 ++++++++++
...ingsphere.infra.expr.spi.InlineExpressionParser | 23 +---
.../PureListInlineExpressionParserTest.java | 60 ++++++++
pom.xml | 4 +-
21 files changed, 334 insertions(+), 266 deletions(-)
diff --git a/.github/workflows/nightly-build.yml
b/.github/workflows/nightly-build.yml
index bb8bf40ac1e..bc4cd9b0f71 100644
--- a/.github/workflows/nightly-build.yml
+++ b/.github/workflows/nightly-build.yml
@@ -108,7 +108,7 @@ jobs:
build-proxy-native-image:
if: github.repository == 'apache/shardingsphere'
name: Build GraalVM Native Image
- timeout-minutes: 90
+ timeout-minutes: 60
permissions:
contents: read
packages: write
@@ -119,8 +119,8 @@ jobs:
ref: ${{ inputs.commit-id }}
- uses: graalvm/setup-graalvm@v1
with:
- version: '22.3.1'
- java-version: '17'
+ java-version: '17.0.8'
+ distribution: 'graalvm-community'
components: 'espresso,native-image'
github-token: ${{ secrets.GITHUB_TOKEN }}
cache: 'maven'
diff --git a/distribution/proxy-native/Dockerfile
b/distribution/proxy-native/Dockerfile
index 4578fd982d1..a65a1b219d3 100644
--- a/distribution/proxy-native/Dockerfile
+++ b/distribution/proxy-native/Dockerfile
@@ -27,13 +27,6 @@ MAINTAINER ShardingSphere "[email protected]"
ARG NATIVE_IMAGE_NAME
ENV LOCAL_PATH /opt/shardingsphere-proxy-native
-ENV JAVA_HOME "/opt/graalvm-ce-java17-22.3.1"
-ENV PATH "$JAVA_HOME/bin:$PATH"
-
-RUN microdnf install gzip -y && \
- bash <(curl -sL https://get.graalvm.org/jdk) --to "/opt" -c espresso
graalvm-ce-java17-22.3.1 && \
- $JAVA_HOME/bin/gu remove native-image && \
- microdnf clean all
COPY --from=prepare ${LOCAL_PATH} ${LOCAL_PATH}
ENTRYPOINT ${LOCAL_PATH}/${NATIVE_IMAGE_NAME} 3307 ${LOCAL_PATH}/conf
"0.0.0.0" false
diff --git a/distribution/proxy-native/access-filter.json
b/distribution/proxy-native/access-filter.json
index 64bb113557f..6b41a36a4ae 100644
--- a/distribution/proxy-native/access-filter.json
+++ b/distribution/proxy-native/access-filter.json
@@ -5,8 +5,7 @@
{"excludeClasses": "org.mariadb.jdbc.**"},
{"excludeClasses": "com.mysql.jdbc.**"},
{"excludeClasses": "org.apache.commons.dbcp2.**"},
- {"excludeClasses": "org.apache.shardingsphere.test.fixture.jdbc.**"},
- {"excludeClasses":
"org.apache.shardingsphere.data.pipeline.core.sqlbuilder.H2PipelineSQLBuilder"}
+ {"excludeClasses": "org.apache.shardingsphere.test.fixture.jdbc.**"}
],
"regexRules": [
{"excludeClasses": ".*Fixture*.*"}
diff --git a/distribution/proxy-native/pom.xml
b/distribution/proxy-native/pom.xml
index 9ef6fa01c7f..be4fa65314f 100644
--- a/distribution/proxy-native/pom.xml
+++ b/distribution/proxy-native/pom.xml
@@ -68,7 +68,6 @@
<profile>
<id>release.native</id>
<properties>
- <truffle-api.version>22.3.1</truffle-api.version>
<jacoco.skip>true</jacoco.skip>
<maven.javadoc.skip>true</maven.javadoc.skip>
<checkstyle.skip>true</checkstyle.skip>
@@ -85,7 +84,6 @@
<configuration>
<source>17</source>
<target>17</target>
-
<compilerArgument>--enable-preview</compilerArgument>
</configuration>
</plugin>
<plugin>
@@ -97,12 +95,8 @@
<fallback>false</fallback>
<verbose>true</verbose>
<buildArgs>
- <arg>--language:java</arg>
<arg>--report-unsupported-elements-at-runtime</arg>
</buildArgs>
- <jvmArgs>
- <arg>--enable-preview</arg>
- </jvmArgs>
<metadataRepository>
<enabled>true</enabled>
</metadataRepository>
diff --git a/distribution/proxy-native/src/main/release-docs/LICENSE
b/distribution/proxy-native/src/main/release-docs/LICENSE
index 42c4b5ada83..80a331318e3 100644
--- a/distribution/proxy-native/src/main/release-docs/LICENSE
+++ b/distribution/proxy-native/src/main/release-docs/LICENSE
@@ -360,12 +360,3 @@ The text of each license is also included at
licenses/LICENSE-[project].txt.
jul-to-slf4j 1.7.36: https://www.slf4j.org, MIT
slf4j-api 1.7.36: https://www.slf4j.org, MIT
jnanoid 2.0.0: https://github.com/aventrix/jnanoid, MIT
-
-========================================================================
-UPL licenses
-========================================================================
-
-The following components are provided under the UPL License. See project link
for details.
-The text of each license is also included at licenses/LICENSE-[project].txt.
-
- truffle-api 22.3.1: http://www.graalvm.org/, UPL
diff --git
a/distribution/proxy-native/src/main/release-docs/licenses/LICENSE-truffle-api.txt
b/distribution/proxy-native/src/main/release-docs/licenses/LICENSE-truffle-api.txt
deleted file mode 100644
index d656a31cb15..00000000000
---
a/distribution/proxy-native/src/main/release-docs/licenses/LICENSE-truffle-api.txt
+++ /dev/null
@@ -1,35 +0,0 @@
-The Universal Permissive License (UPL), Version 1.0
-
-Subject to the condition set forth below, permission is hereby granted to any
-person obtaining a copy of this software, associated documentation and/or
-data (collectively the "Software"), free of charge and under any and all
-copyright rights in the Software, and any and all patent rights owned or
-freely licensable by each licensor hereunder covering either (i) the
-unmodified Software as contributed to or provided by such licensor, or (ii)
-the Larger Works (as defined below), to deal in both
-
-(a) the Software, and
-
-(b) any piece of software and/or hardware listed in the lrgrwrks.txt file if
-one is included with the Software each a "Larger Work" to which the Software
-is contributed by such licensors),
-
-without restriction, including without limitation the rights to copy, create
-derivative works of, display, perform, and distribute the Software and make,
-use, sell, offer for sale, import, export, have made, and have sold the
-Software and the Larger Work(s), and to sublicense the foregoing rights on
-either these or other terms.
-
-This license is subject to the following condition:
-
-The above copyright notice and either this complete permission notice or at a
-minimum a reference to the UPL must be included in all copies or substantial
-portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
-SOFTWARE.
diff --git a/distribution/proxy/src/main/release-docs/LICENSE
b/distribution/proxy/src/main/release-docs/LICENSE
index 5a979f8383e..00b8283675c 100644
--- a/distribution/proxy/src/main/release-docs/LICENSE
+++ b/distribution/proxy/src/main/release-docs/LICENSE
@@ -372,13 +372,3 @@ The text of each license is also included at
licenses/LICENSE-[project].txt.
jul-to-slf4j 1.7.36: https://www.slf4j.org, MIT
slf4j-api 1.7.36: https://www.slf4j.org, MIT
jnanoid 2.0.0: https://github.com/aventrix/jnanoid, MIT
-
-========================================================================
-UPL licenses
-========================================================================
-
-The following components are provided under the UPL License. See project link
for details.
-The text of each license is also included at licenses/LICENSE-[project].txt.
-
- graal-sdk 21.2.0: https://github.com/oracle/graal/tree/master/sdk, UPL 1.0
- truffle-api 21.2.0: https://github.com/oracle/graal/tree/master/truffle,
UPL 1.0
diff --git
a/distribution/proxy/src/main/release-docs/licenses/LICENSE-truffle-api.txt
b/distribution/proxy/src/main/release-docs/licenses/LICENSE-truffle-api.txt
deleted file mode 100644
index d656a31cb15..00000000000
--- a/distribution/proxy/src/main/release-docs/licenses/LICENSE-truffle-api.txt
+++ /dev/null
@@ -1,35 +0,0 @@
-The Universal Permissive License (UPL), Version 1.0
-
-Subject to the condition set forth below, permission is hereby granted to any
-person obtaining a copy of this software, associated documentation and/or
-data (collectively the "Software"), free of charge and under any and all
-copyright rights in the Software, and any and all patent rights owned or
-freely licensable by each licensor hereunder covering either (i) the
-unmodified Software as contributed to or provided by such licensor, or (ii)
-the Larger Works (as defined below), to deal in both
-
-(a) the Software, and
-
-(b) any piece of software and/or hardware listed in the lrgrwrks.txt file if
-one is included with the Software each a "Larger Work" to which the Software
-is contributed by such licensors),
-
-without restriction, including without limitation the rights to copy, create
-derivative works of, display, perform, and distribute the Software and make,
-use, sell, offer for sale, import, export, have made, and have sold the
-Software and the Larger Work(s), and to sublicense the foregoing rights on
-either these or other terms.
-
-This license is subject to the following condition:
-
-The above copyright notice and either this complete permission notice or at a
-minimum a reference to the UPL must be included in all copies or substantial
-portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
-SOFTWARE.
diff --git
a/docs/document/content/user-manual/shardingsphere-proxy/startup/graalvm-native-image.cn.md
b/docs/document/content/user-manual/shardingsphere-proxy/startup/graalvm-native-image.cn.md
index c0e5f29ef3e..ef8d3a0ec70 100644
---
a/docs/document/content/user-manual/shardingsphere-proxy/startup/graalvm-native-image.cn.md
+++
b/docs/document/content/user-manual/shardingsphere-proxy/startup/graalvm-native-image.cn.md
@@ -5,13 +5,12 @@ weight = 2
## 背景信息
-本节主要介绍如何通过 `GraalVM` 的 `native-image` 组件构建 ShardingSphere-Proxy 的 `Native
Image` 和对应的 `Docker Image`
-。
+本节主要介绍如何通过 `GraalVM` 的 `native-image` 组件构建 ShardingSphere-Proxy 的 `Native
Image` 和对应的 `Docker Image`。
## 注意事项
- ShardingSphere Proxy 尚未准备好与 GraalVM Native Image 集成。
- 其在
https://github.com/apache/shardingsphere/pkgs/container/shardingsphere-proxy-native
存在每夜构建。
+ Proxy 的 Native Image 产物在
https://github.com/apache/shardingsphere/pkgs/container/shardingsphere-proxy-native
存在每夜构建。
假设存在包含`server.yaml` 的 `conf` 文件夹为 `./custom/conf`,你可通过如下的
`docker-compose.yml` 文件进行测试。
```yaml
@@ -30,37 +29,34 @@ services:
应当在 https://github.com/oracle/graalvm-reachability-metadata 打开新的 issue ,
并提交包含 ShardingSphere 自身或依赖的第三方库缺失的 GraalVM Reachability Metadata 的 PR。
-- ShardingSphere 的 master 分支尚未准备好处理 Native Image 中的单元测试,
- 需要等待 Junit 5 Platform 的集成,你总是需要在构建 GraalVM Native Image 的过程中,
+- ShardingSphere 的 master 分支尚未准备好处理 Native Image 中的单元测试 , 你总是需要在构建 GraalVM
Native Image 的过程中,
加上特定于 `GraalVM Native Build Tools` 的 `-DskipNativeTests` 或 `-DskipTests`
参数跳过 Native Image 中的单元测试。
-- 如下 3 个算法类由于涉及到 GraalVM Truffle Espresso 不方便在 host JVM 和 guest JVM 之间交互的
`groovy.lang.Closure`
- 类,暂未可在 GraalVM Native Image 下使用。
+- 如下的算法类由于涉及到 https://github.com/oracle/graal/issues/5522 , 暂未可在 GraalVM
Native Image 下使用。
-
`org.apache.shardingsphere.sharding.algorithm.sharding.inline.InlineShardingAlgorithm`
-
`org.apache.shardingsphere.sharding.algorithm.sharding.inline.ComplexInlineShardingAlgorithm`
-
`org.apache.shardingsphere.sharding.algorithm.sharding.hint.HintInlineShardingAlgorithm`
-- 当前阶段,GraalVM Native Image 形态的 ShardingSphere Proxy 处于混合 AOT ( GraalVM Native
Image ) 和 JIT ( GraalVM
- Truffle Espresso ) 运行的阶段。由于 https://github.com/oracle/graal/issues/4555
尚未关闭,GraalVM Truffle Espresso
- 运行需要的 `.so` 文件并不会进入 GraalVM Native Image 内。因此如果你需要在 Docker Image 外运行
ShardingSphere Proxy
- Native 的二进制文件,你需要确保系统环境变量 `JAVA_HOME` 指向 GraalVM 的 `bin` 目录,并且此 GraalVM
- 实例已经通过 `GraalVM Updater` 安装了 `espresso` 组件。
+- 当前阶段,GraalVM Native Image 形态的 ShardingSphere Proxy 不支持使用带 Groovy
+ 语法的 `行表达式`, 这首先导致 `数据分片` 功能的`actualDataNodes`属性只能使用纯列表来配置, 例如
`ds_0.t_order_0, ds_0.t_order_1`
+ 或 `ds_0.t_user_0, ds_15.t_user_1023`。此问题在
https://github.com/oracle/graal/issues/5522 追踪。
- 本节假定处于 Linux(amd64,aarch64), MacOS(amd64)或 Windows(amd64)环境。
如果你位于 MacOS(aarch64/M1) 环境,你需要关注尚未关闭的
https://github.com/oracle/graal/issues/2666 。
## 前提条件
-1. 根据 https://www.graalvm.org/downloads/ 要求安装和配置 JDK 17 对应的 `GraalVM CE` 或
`GraalVM EE`。
- 同时可以通过 `SDKMAN!` 安装 JDK 17 对应的 `GraalVM CE`。
+1. 根据 https://www.graalvm.org/downloads/ 要求安装和配置 JDK 17 对应的 `GraalVM Community
Edition` 或 `Oracle GraalVM`。或者使用 `SDKMAN!`。
-2. 通过 `GraalVM Updater` 工具安装 `native-image` 和 `espresso` 组件。
+```shell
+sdk install java 17.0.8-graalce
+```
-3. 根据
https://www.graalvm.org/22.3/reference-manual/native-image/#prerequisites
的要求安装本地工具链。
+2. 根据
https://www.graalvm.org/latest/reference-manual/native-image/#prerequisites
的要求安装本地工具链。
-4. 如果需要构建 Docker Image, 确保 `docker-ce` 已安装。
+3. 如果需要构建 Docker Image, 确保 `docker-ce` 已安装。
-5. 首先需要在项目的根目录下,执行如下命令以为所有子模块采集 Standard 形态的 GraalVM 可达性元数据。
+4. 首先需要在项目的根目录下,执行如下命令以为所有子模块采集 Standard 形态的 GraalVM 可达性元数据。
```shell
./mvnw -PgenerateStandardMetadata -DskipNativeTests -B -T1C clean test
@@ -94,12 +90,12 @@ services:
<dependency>
<groupId>com.mysql</groupId>
<artifactId>mysql-connector-j</artifactId>
- <version>8.0.32</version>
+ <version>8.1.0</version>
</dependency>
<dependency>
<groupId>org.apache.shardingsphere</groupId>
<artifactId>shardingsphere-sql-translator-jooq-provider</artifactId>
- <version>5.3.1</version>
+ <version>5.4.0</version>
</dependency>
</dependencies>
```
@@ -142,11 +138,10 @@ services:
- 如果你不对 Git Source 做任何更改, 上文提及的命令将使用 `oraclelinux:9-slim` 作为 Base Docker Image。
但如果你希望使用 `busybox:glic`,`gcr.io/distroless/base` 或 `scratch` 等更小体积的 Docker
Image 作为 Base Docker
- Image,你需要根据
https://www.graalvm.org/22.3/reference-manual/native-image/guides/build-static-executables/
的要求,
+ Image,你需要根据
https://www.graalvm.org/latest/reference-manual/native-image/guides/build-static-executables/
的要求,
做为 `pom.xml`的 `native profile` 添加 `-H:+StaticExecutableWithDynamicLibC` 的
`jvmArgs` 等操作。
另请注意,某些第三方依赖将需要在 `Dockerfile` 安装更多系统库,例如 `libdl`。
- 因此请确保根据你的使用情况调整 `distribution/proxy-native`
- 下的 `pom.xml` 和 `Dockerfile` 的内容。
+ 因此请确保根据你的使用情况调整 `distribution/proxy-native` 下的 `pom.xml` 和 `Dockerfile` 的内容。
# 可观察性
@@ -154,7 +149,7 @@ services:
Proxy,其提供的可观察性的能力与
https://shardingsphere.apache.org/document/current/cn/user-manual/shardingsphere-proxy/observability/
并不一致。
-- 你可以使用 https://www.graalvm.org/22.3/tools/ 提供的一系列命令行工具或可视化工具观察 GraalVM Native
Image
+- 你可以使用 https://www.graalvm.org/latest/tools/ 提供的一系列命令行工具或可视化工具观察 GraalVM
Native Image
的内部行为,并根据其要求使用 VSCode 完成调试工作。
如果你正在使用 IntelliJ IDEA 并且希望调试生成的 GraalVM Native
Image,你可以关注
https://blog.jetbrains.com/idea/2022/06/intellij-idea-2022-2-eap-5/#Experimental_GraalVM_Native_Debugger_for_Java
@@ -166,7 +161,7 @@ services:
- 以下部分采用 `Apache SkyWalking Java Agent` 作为示例,可用于跟踪 GraalVM 社区的对应 issue。
-1. 下载
https://archive.apache.org/dist/skywalking/java-agent/8.12.0/apache-skywalking-java-agent-8.12.0.tgz
,
+1. 下载
https://dlcdn.apache.org/skywalking/java-agent/8.16.0/apache-skywalking-java-agent-8.16.0.tgz
,
并解压到 ShardingSphere Git Source 的 `distribution/proxy-native`。
2. 修改 `distribution/proxy-native/pom.xml` 的 `native profile`,
diff --git
a/docs/document/content/user-manual/shardingsphere-proxy/startup/graalvm-native-image.en.md
b/docs/document/content/user-manual/shardingsphere-proxy/startup/graalvm-native-image.en.md
index 5d37f04ac1f..53ca4c40d4f 100644
---
a/docs/document/content/user-manual/shardingsphere-proxy/startup/graalvm-native-image.en.md
+++
b/docs/document/content/user-manual/shardingsphere-proxy/startup/graalvm-native-image.en.md
@@ -11,8 +11,7 @@ corresponding `Docker Image` through the `native-image`
component of `GraalVM`.
## Notice
- ShardingSphere Proxy is not yet ready to integrate with GraalVM Native Image.
- Fixes documentation for building GraalVM Native Image It exists nightly
builds
- at
https://github.com/apache/shardingsphere/pkgs/container/shardingsphere-proxy-native.
+ Proxy's Native Image artifacts are built nightly at
https://github.com/apache/shardingsphere/pkgs/container/shardingsphere-proxy-native
.
Assuming there is a `conf` folder containing `server.yaml` as
`./custom/conf`, you can test it with the
following `docker-compose.yml` file.
@@ -29,28 +28,23 @@ services:
````
- If you find that the build process has missing GraalVM Reachability Metadata,
- A new issue should be opened at
https://github.com/oracle/graalvm-reachability-metadata,
- And submit a PR containing GraalVM Reachability Metadata missing from
ShardingSphere itself or dependent third-party
- libraries.
+ a new issue should be opened at
https://github.com/oracle/graalvm-reachability-metadata,
+ and submit a PR containing GraalVM Reachability Metadata missing from
ShardingSphere itself or dependent third-party libraries.
- The master branch of ShardingSphere is not yet ready to handle unit tests in
Native Image,
- Need to wait for the integration of Junit 5 Platform, you always need to
build GraalVM Native Image in the process,
+ you always need to build GraalVM Native Image in the process,
Plus `-DskipNativeTests` or `-DskipTests` parameter specific to `GraalVM
Native Build Tools` to skip unit tests in
Native Image.
-- The following three algorithm classes are not available under GraalVM Native
Image because they involve
- the `groovy.lang.Closure` class that is inconvenient for GraalVM Truffle
Espresso to interact between the host JVM and
- the guest JVM.
+- The following algorithm classes are not available under GraalVM Native Image
due to https://github.com/oracle/graal/issues/5522 involved.
-
`org.apache.shardingsphere.sharding.algorithm.sharding.inline.InlineShardingAlgorithm`
-
`org.apache.shardingsphere.sharding.algorithm.sharding.inline.ComplexInlineShardingAlgorithm`
-
`org.apache.shardingsphere.sharding.algorithm.sharding.hint.HintInlineShardingAlgorithm`
-- At the current stage, ShardingSphere Proxy in GraalVM Native Image is in the
stage of mixed AOT ( GraalVM
- Native Image ) and JIT ( GraalVM Truffle Espresso ) operation. Since
https://github.com/oracle/graal/issues/4555 has
- not been closed, the `.so` file required for GraalVM Truffle Espresso to run
does not enter the GraalVM Native Image.
- So if you need to run ShardingSphere Proxy Native binary files outside the
Docker Image, you need to ensure
- that the system environment variable `JAVA_HOME` points to the `bin`
directory of GraalVM, and this
- GraalVM instance already has the `espresso` component installed via the
`GraalVM Updater`.
+- At this stage, ShardingSphere Proxy in the form of GraalVM Native Image does
not support the use of `Row Value Expressions`
+ with Groovy syntax, which first results in the `actualDataNodes` property of
the `Sharding` feature being only
+ configurable using a pure list, such as `ds_0.t_order_0, ds_0.t_order_1` or
`ds_0.t_user_0, ds_15.t_user_1023`. This
+ issue is tracked in https://github.com/oracle/graal/issues/5522 .
- This section assumes a Linux (amd64, aarch64), MacOS (amd64) or Windows
(amd64) environment.
If you are on MacOS (aarch64/M1) environment, you need to follow
https://github.com/oracle/graal/issues/2666 which is
@@ -58,16 +52,17 @@ services:
## Premise
-1. Install and configure `GraalVM CE` or `GraalVM EE` for JDK 17 according to
https://www.graalvm.org/downloads/.
- `GraalVM CE` for JDK 17 can also be installed via `SDKMAN!`.
+1. Install and configure `GraalVM Community Edition` or `Oracle GraalVM` for
JDK 17 according to https://www.graalvm.org/downloads/. Or use `SDKMAN!`.
-2. Install the `native-image` and `espresso` component via the `GraalVM
Updater` tool.
+```shell
+sdk install java 17.0.8-graalce
+```
-3. Install the local toolchain as required by
https://www.graalvm.org/22.3/reference-manual/native-image/#prerequisites.
+2. Install the local toolchain as required by
https://www.graalvm.org/latest/reference-manual/native-image/#prerequisites.
-4. If you need to build a Docker Image, make sure `docker-ce` is installed.
+3. If you need to build a Docker Image, make sure `docker-ce` is installed.
-5. First, you need to execute the following command in the root directory of
the project to collect the GraalVM
+4. First, you need to execute the following command in the root directory of
the project to collect the GraalVM
Reachability Metadata of the Standard form for all submodules.
```shell
@@ -104,12 +99,12 @@ services:
<dependency>
<groupId>com.mysql</groupId>
<artifactId>mysql-connector-j</artifactId>
- <version>8.0.32</version>
+ <version>8.1.0</version>
</dependency>
<dependency>
<groupId>org.apache.shardingsphere</groupId>
<artifactId>shardingsphere-sql-translator-jooq-provider</artifactId>
- <version>5.3.1</version>
+ <version>5.4.0</version>
</dependency>
</dependencies>
```
@@ -153,25 +148,22 @@ services:
- "3307:3307"
```
-- If you don't make any changes to the Git Source, the commands mentioned
above will use `oraclelinux:9-slim` as the
- Base Docker Image.
- But if you want to use a smaller Docker Image like `busybox:glic`,
`gcr.io/distroless/base` or `scratch` as the Base
- Docker Image, you need according
- to
https://www.graalvm.org/22.3/reference-manual/native-image/guides/build-static-executables/,
- Add operations such as `-H:+StaticExecutableWithDynamicLibC` to `jvmArgs` as
the `native profile` of `pom.xml`.
- Also note that some 3rd party dependencies will require more system
libraries such as `libdl` to be installed in
+- If you don't make any changes to the Git Source, the commands mentioned
above will use `oraclelinux:9-slim` as the Base Docker Image.
+ But if you want to use a smaller Docker Image like `busybox:glic`,
`gcr.io/distroless/base` or `scratch` as the Base Docker Image, you need
according
+ to
https://www.graalvm.org/latest/reference-manual/native-image/guides/build-static-executables/,
+ add operations such as `-H:+StaticExecutableWithDynamicLibC` to `jvmArgs` as
the `native profile` of `pom.xml`.
+ Also note that some 3rd-party dependencies will require more system
libraries such as `libdl` to be installed in
the `Dockerfile`.
- So make sure to tune `distribution/proxy-native` according to your usage
- `pom.xml` and `Dockerfile` below.
+ So make sure to tune `distribution/proxy-native` according to your usage
`pom.xml` and `Dockerfile` below.
# Observability
- ShardingSphere for GraalVM Native Image form Proxy, which provides
observability capabilities
with
https://shardingsphere.apache.org/document/current/cn/user-manual/shardingsphere-proxy/observability/
- Not consistent.
+ not consistent.
- You can observe GraalVM Native Image using a series of command line tools or
visualization tools available
- at https://www.graalvm.org/22.3/tools/, and use VSCode to debug it according
to its requirements.
+ at https://www.graalvm.org/latest/tools/, and use VSCode to debug it
according to its requirements.
If you are using IntelliJ IDEA and want to debug the generated GraalVM
Native Image, You can
follow
https://blog.jetbrains.com/idea/2022/06/intellij-idea-2022-2-eap-5/#Experimental_GraalVM_Native_Debugger_for_Java
and its successors. If you are not using Linux, you cannot debug GraalVM
Native Image, please pay attention
@@ -184,7 +176,7 @@ services:
- The following sections use the `Apache SkyWalking Java Agent` as an example,
which can be used to track corresponding
issues from the GraalVM community.
-1. Download
https://archive.apache.org/dist/skywalking/java-agent/8.12.0/apache-skywalking-java-agent-8.12.0.tgz
and `untar` it
+1. Download
https://dlcdn.apache.org/skywalking/java-agent/8.16.0/apache-skywalking-java-agent-8.16.0.tgz
and `untar` it
to `distribution/proxy-native` in ShardingSphere Git Source.
2. Modify the `native profile` of `distribution/proxy-native/pom.xml`,
diff --git a/infra/expr/core/pom.xml b/infra/expr/core/pom.xml
index fdc41cd673c..84f274b57cf 100644
--- a/infra/expr/core/pom.xml
+++ b/infra/expr/core/pom.xml
@@ -39,7 +39,7 @@
</dependency>
<dependency>
<groupId>org.apache.shardingsphere</groupId>
- <artifactId>shardingsphere-infra-expr-espresso</artifactId>
+ <artifactId>shardingsphere-infra-expr-purelist</artifactId>
<version>${project.version}</version>
</dependency>
diff --git
a/infra/expr/core/src/main/java/org/apache/shardingsphere/infra/expr/core/InlineExpressionParserFactory.java
b/infra/expr/core/src/main/java/org/apache/shardingsphere/infra/expr/core/InlineExpressionParserFactory.java
index 3cde01672e1..11a03cd4948 100644
---
a/infra/expr/core/src/main/java/org/apache/shardingsphere/infra/expr/core/InlineExpressionParserFactory.java
+++
b/infra/expr/core/src/main/java/org/apache/shardingsphere/infra/expr/core/InlineExpressionParserFactory.java
@@ -28,7 +28,7 @@ import
org.apache.shardingsphere.infra.spi.type.typed.TypedSPILoader;
@NoArgsConstructor(access = AccessLevel.PRIVATE)
public final class InlineExpressionParserFactory {
- // workaround for
https://junit.org/junit5/docs/current/api/org.junit.jupiter.api/org/junit/jupiter/api/condition/EnabledInNativeImage.html
+ // workaround for
https://junit.org/junit5/docs/5.10.0/api/org.junit.jupiter.api/org/junit/jupiter/api/condition/EnabledInNativeImage.html
private static final boolean IS_SUBSTRATE_VM =
"runtime".equals(System.getProperty("org.graalvm.nativeimage.imagecode"));
/**
@@ -37,6 +37,6 @@ public final class InlineExpressionParserFactory {
* @return created instance
*/
public static InlineExpressionParser newInstance() {
- return TypedSPILoader.getService(InlineExpressionParser.class,
IS_SUBSTRATE_VM ? "ESPRESSO" : "HOTSPOT");
+ return TypedSPILoader.getService(InlineExpressionParser.class,
IS_SUBSTRATE_VM ? "PURELIST" : "HOTSPOT");
}
}
diff --git a/infra/expr/espresso/pom.xml b/infra/expr/espresso/pom.xml
index fead9afddea..653fe6e1653 100644
--- a/infra/expr/espresso/pom.xml
+++ b/infra/expr/espresso/pom.xml
@@ -42,12 +42,6 @@
<artifactId>shardingsphere-infra-util</artifactId>
<version>${project.version}</version>
</dependency>
- <!--Explicitly importing this dependency is only for changing the
packaging order-->
- <dependency>
- <groupId>org.apache.shardingsphere</groupId>
- <artifactId>shardingsphere-infra-expr-hotsopt</artifactId>
- <version>${project.version}</version>
- </dependency>
<dependency>
<groupId>org.graalvm.truffle</groupId>
@@ -67,30 +61,9 @@
<goals>
<goal>copy</goal>
</goals>
- <phase>prepare-package</phase>
+ <phase>process-test-classes</phase>
<configuration>
<artifactItems>
- <artifactItem>
-
<groupId>org.apache.shardingsphere</groupId>
-
<artifactId>shardingsphere-infra-expr-spi</artifactId>
- <version>${project.version}</version>
- <type>jar</type>
- <overWrite>true</overWrite>
- </artifactItem>
- <artifactItem>
-
<groupId>org.apache.shardingsphere</groupId>
-
<artifactId>shardingsphere-infra-util</artifactId>
- <version>${project.version}</version>
- <type>jar</type>
- <overWrite>true</overWrite>
- </artifactItem>
- <artifactItem>
-
<groupId>org.apache.shardingsphere</groupId>
-
<artifactId>shardingsphere-infra-expr-hotsopt</artifactId>
- <version>${project.version}</version>
- <type>jar</type>
- <overWrite>true</overWrite>
- </artifactItem>
<artifactItem>
<groupId>org.apache.groovy</groupId>
<artifactId>groovy</artifactId>
@@ -98,13 +71,6 @@
<type>jar</type>
<overWrite>true</overWrite>
</artifactItem>
- <artifactItem>
- <groupId>com.google.guava</groupId>
- <artifactId>guava</artifactId>
- <version>${guava.version}</version>
- <type>jar</type>
- <overWrite>true</overWrite>
- </artifactItem>
</artifactItems>
<stripVersion>true</stripVersion>
<outputDirectory>${project.build.outputDirectory}/espresso-need-libs</outputDirectory>
diff --git
a/infra/expr/espresso/src/main/java/org/apache/shardingsphere/infra/expr/espresso/EspressoInlineExpressionParser.java
b/infra/expr/espresso/src/main/java/org/apache/shardingsphere/infra/expr/espresso/EspressoInlineExpressionParser.java
index 32e95cb916a..d9f2f77c2d4 100644
---
a/infra/expr/espresso/src/main/java/org/apache/shardingsphere/infra/expr/espresso/EspressoInlineExpressionParser.java
+++
b/infra/expr/espresso/src/main/java/org/apache/shardingsphere/infra/expr/espresso/EspressoInlineExpressionParser.java
@@ -17,20 +17,23 @@
package org.apache.shardingsphere.infra.expr.espresso;
+import com.google.common.base.Strings;
+import com.google.common.collect.Sets;
import groovy.lang.Closure;
-import
org.apache.shardingsphere.infra.exception.core.ShardingSpherePreconditions;
-import
org.apache.shardingsphere.infra.expr.hotsopt.HotspotInlineExpressionParser;
+import groovy.lang.GroovyShell;
import org.apache.shardingsphere.infra.expr.spi.InlineExpressionParser;
import org.graalvm.polyglot.Context;
-import org.graalvm.polyglot.TypeLiteral;
import org.graalvm.polyglot.Value;
import java.io.File;
import java.net.URL;
import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.LinkedHashSet;
import java.util.List;
+import java.util.Set;
import java.util.stream.Collectors;
-import java.util.stream.Stream;
/**
* Espresso inline expression parser.
@@ -39,56 +42,154 @@ public final class EspressoInlineExpressionParser
implements InlineExpressionPar
private static final String JAVA_CLASSPATH;
- private static final String JAVA_HOME;
+ private static final char SPLITTER = ',';
static {
- JAVA_HOME = System.getenv("JAVA_HOME");
URL resource =
Thread.currentThread().getContextClassLoader().getResource("espresso-need-libs");
String dir = null != resource ? resource.getPath() : null;
- JAVA_CLASSPATH = Stream.of("groovy.jar", "guava.jar",
"shardingsphere-infra-expr-hotsopt.jar", "shardingsphere-infra-expr-spi.jar",
"shardingsphere-infra-util.jar")
- .map(each -> dir + File.separator +
each).collect(Collectors.joining(":"));
+ JAVA_CLASSPATH = dir + File.separator + "groovy.jar";
}
@Override
public String handlePlaceHolder(final String inlineExpression) {
- try (Context context = createContext()) {
- return
createInlineExpressionParser(context).invokeMember("handlePlaceHolder",
inlineExpression).asString();
- }
+ return inlineExpression.contains("$->{") ?
inlineExpression.replaceAll("\\$->\\{", "\\$\\{") : inlineExpression;
}
@Override
public List<String> splitAndEvaluate(final String inlineExpression) {
try (Context context = createContext()) {
- List<String> listProjection =
createInlineExpressionParser(context).invokeMember("splitAndEvaluate",
inlineExpression)
- .as(new TypeLiteral<List<String>>() {
- });
- // org.graalvm.polyglot.Value#as only creates projections for
classes in Truffle Context
- return new ArrayList<>(listProjection);
+ return Strings.isNullOrEmpty(inlineExpression) ?
Collections.emptyList() : flatten(evaluate(split(inlineExpression), context));
}
}
@Override
public Closure<?> evaluateClosure(final String inlineExpression) {
- try (Context context = createContext()) {
- return
createInlineExpressionParser(context).invokeMember("evaluateClosure",
inlineExpression).as(Closure.class);
- }
- }
-
- private Value createInlineExpressionParser(final Context context) {
- return
context.getBindings("java").getMember(HotspotInlineExpressionParser.class.getName()).newInstance();
+ throw new RuntimeException("GraalVM Truffle's Espresso implementation
cannot return an instance of `groovy.lang.Closure` to the Host JVM.");
}
private Context createContext() {
// TODO https://github.com/oracle/graal/issues/4555 not yet closed
- ShardingSpherePreconditions.checkNotNull(JAVA_HOME, () -> new
RuntimeException("Failed to determine the system's environment variable
JAVA_HOME!"));
return Context.newBuilder()
.allowAllAccess(true)
- .option("java.Properties.org.graalvm.home", JAVA_HOME)
- .option("java.MultiThreaded", Boolean.TRUE.toString())
+ .option("java.Properties.org.graalvm.home",
System.getenv("JAVA_HOME"))
.option("java.Classpath", JAVA_CLASSPATH)
.build();
}
+ private List<String> split(final String inlineExpression) {
+ List<String> result = new ArrayList<>();
+ StringBuilder segment = new StringBuilder();
+ int bracketsDepth = 0;
+ for (int i = 0; i < inlineExpression.length(); i++) {
+ char each = inlineExpression.charAt(i);
+ switch (each) {
+ case SPLITTER:
+ if (bracketsDepth > 0) {
+ segment.append(each);
+ } else {
+ result.add(segment.toString().trim());
+ segment.setLength(0);
+ }
+ break;
+ case '$':
+ if ('{' == inlineExpression.charAt(i + 1)) {
+ bracketsDepth++;
+ }
+ if ("->{".equals(inlineExpression.substring(i + 1, i +
4))) {
+ bracketsDepth++;
+ }
+ segment.append(each);
+ break;
+ case '}':
+ if (bracketsDepth > 0) {
+ bracketsDepth--;
+ }
+ segment.append(each);
+ break;
+ default:
+ segment.append(each);
+ break;
+ }
+ }
+ if (segment.length() > 0) {
+ result.add(segment.toString().trim());
+ }
+ return result;
+ }
+
+ private List<Value> evaluate(final List<String> inlineExpressions, final
Context context) {
+ List<Value> result = new ArrayList<>(inlineExpressions.size());
+ for (String each : inlineExpressions) {
+ StringBuilder expression = new
StringBuilder(handlePlaceHolder(each));
+ if (!each.startsWith("\"")) {
+ expression.insert(0, '"');
+ }
+ if (!each.endsWith("\"")) {
+ expression.append('"');
+ }
+ result.add(evaluate(expression.toString(), context));
+ }
+ return result;
+ }
+
+ private Value evaluate(final String expression, final Context context) {
+ return context.getBindings("java")
+ .getMember(GroovyShell.class.getName())
+ .newInstance()
+ .invokeMember("parse", expression)
+ .invokeMember("run");
+ }
+
+ private List<String> flatten(final List<Value> segments) {
+ List<String> result = new ArrayList<>();
+ for (Value each : segments) {
+ if (!each.isString()) {
+ result.addAll(assemblyCartesianSegments(each));
+ } else {
+ result.add(each.toString());
+ }
+ }
+ return result;
+ }
+
+ private List<String> assemblyCartesianSegments(final Value segment) {
+ Set<List<String>> cartesianValues = getCartesianValues(segment);
+ List<String> result = new ArrayList<>(cartesianValues.size());
+ for (List<String> each : cartesianValues) {
+ result.add(assemblySegment(each, segment));
+ }
+ return result;
+ }
+
+ @SuppressWarnings("unchecked")
+ private Set<List<String>> getCartesianValues(final Value segment) {
+ Object[] temp = segment.invokeMember("getValues").as(Object[].class);
+ List<Set<String>> result = new ArrayList<>(temp.length);
+ for (Object each : temp) {
+ if (null == each) {
+ continue;
+ }
+ if (each instanceof Collection) {
+ result.add(((Collection<Object>)
each).stream().map(Object::toString).collect(Collectors.toCollection(LinkedHashSet::new)));
+ } else {
+ result.add(Sets.newHashSet(each.toString()));
+ }
+ }
+ return Sets.cartesianProduct(result);
+ }
+
+ private String assemblySegment(final List<String> cartesianValue, final
Value segment) {
+ String[] temp = segment.invokeMember("getStrings").as(String[].class);
+ StringBuilder result = new StringBuilder();
+ for (int i = 0; i < temp.length; i++) {
+ result.append(temp[i]);
+ if (i < cartesianValue.size()) {
+ result.append(cartesianValue.get(i));
+ }
+ }
+ return result.toString();
+ }
+
@Override
public String getType() {
return "ESPRESSO";
diff --git
a/infra/expr/espresso/src/test/java/org/apache/shardingsphere/infra/expr/espresso/EspressoInlineExpressionParserTest.java
b/infra/expr/espresso/src/test/java/org/apache/shardingsphere/infra/expr/espresso/EspressoInlineExpressionParserTest.java
index b389c5a2f2d..3f7999f5e4c 100644
---
a/infra/expr/espresso/src/test/java/org/apache/shardingsphere/infra/expr/espresso/EspressoInlineExpressionParserTest.java
+++
b/infra/expr/espresso/src/test/java/org/apache/shardingsphere/infra/expr/espresso/EspressoInlineExpressionParserTest.java
@@ -119,8 +119,8 @@ class EspressoInlineExpressionParserTest {
}
/*
- * TODO This method needs to avoid returning a groovy.lang.Closure class
instance, and instead return the result of `Closure#call`. Because
`org.graalvm.polyglot.Value#as` does not allow this type
- * to be returned from the guest JVM.
+ * TODO This method needs to avoid returning a `groovy.lang.Closure` class
instance, and instead return the result of `groovy.lang.Closure#call`. Because
`org.graalvm.polyglot.Value#as` does not
+ * allow this type to be returned from the guest JVM.
*/
@Test
@Disabled("See java doc")
diff --git a/infra/expr/pom.xml b/infra/expr/pom.xml
index ee51962feb4..14aa380d873 100644
--- a/infra/expr/pom.xml
+++ b/infra/expr/pom.xml
@@ -32,5 +32,6 @@
<module>core</module>
<module>hotsopt</module>
<module>espresso</module>
+ <module>purelist</module>
</modules>
</project>
diff --git a/infra/expr/pom.xml b/infra/expr/purelist/pom.xml
similarity index 70%
copy from infra/expr/pom.xml
copy to infra/expr/purelist/pom.xml
index ee51962feb4..b45ff489b37 100644
--- a/infra/expr/pom.xml
+++ b/infra/expr/purelist/pom.xml
@@ -20,17 +20,22 @@
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.apache.shardingsphere</groupId>
- <artifactId>shardingsphere-infra</artifactId>
+ <artifactId>shardingsphere-infra-expr</artifactId>
<version>5.4.1-SNAPSHOT</version>
</parent>
- <artifactId>shardingsphere-infra-expr</artifactId>
- <packaging>pom</packaging>
+ <artifactId>shardingsphere-infra-expr-purelist</artifactId>
<name>${project.artifactId}</name>
- <modules>
- <module>spi</module>
- <module>core</module>
- <module>hotsopt</module>
- <module>espresso</module>
- </modules>
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.shardingsphere</groupId>
+ <artifactId>shardingsphere-infra-expr-spi</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.groovy</groupId>
+ <artifactId>groovy</artifactId>
+ </dependency>
+ </dependencies>
</project>
diff --git
a/infra/expr/purelist/src/main/java/org/apache/shardingsphere/infra/expr/purelist/PureListInlineExpressionParser.java
b/infra/expr/purelist/src/main/java/org/apache/shardingsphere/infra/expr/purelist/PureListInlineExpressionParser.java
new file mode 100644
index 00000000000..e6ea43f053d
--- /dev/null
+++
b/infra/expr/purelist/src/main/java/org/apache/shardingsphere/infra/expr/purelist/PureListInlineExpressionParser.java
@@ -0,0 +1,72 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.shardingsphere.infra.expr.purelist;
+
+import com.google.common.base.Strings;
+import groovy.lang.Closure;
+import org.apache.shardingsphere.infra.expr.spi.InlineExpressionParser;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+
+/**
+ * Pure List inline expression parser.
+ */
+public final class PureListInlineExpressionParser implements
InlineExpressionParser {
+
+ private static final char SPLITTER = ',';
+
+ @Override
+ public String handlePlaceHolder(final String inlineExpression) {
+ return inlineExpression.contains("$->{") ?
inlineExpression.replaceAll("\\$->\\{", "\\$\\{") : inlineExpression;
+ }
+
+ @Override
+ public List<String> splitAndEvaluate(final String inlineExpression) {
+ return Strings.isNullOrEmpty(inlineExpression) ?
Collections.emptyList() : split(inlineExpression);
+ }
+
+ @Override
+ public Closure<?> evaluateClosure(final String inlineExpression) {
+ throw new RuntimeException("Groovy classes cannot be used directly
within GraalVM Native Image.");
+ }
+
+ private List<String> split(final String inlineExpression) {
+ List<String> result = new ArrayList<>();
+ StringBuilder segment = new StringBuilder();
+ for (int i = 0; i < inlineExpression.length(); i++) {
+ char each = inlineExpression.charAt(i);
+ if (each == SPLITTER) {
+ result.add(segment.toString().trim());
+ segment.setLength(0);
+ } else {
+ segment.append(each);
+ }
+ }
+ if (segment.length() > 0) {
+ result.add(segment.toString().trim());
+ }
+ return result;
+ }
+
+ @Override
+ public String getType() {
+ return "PURELIST";
+ }
+}
diff --git a/distribution/proxy-native/Dockerfile
b/infra/expr/purelist/src/main/resources/META-INF/services/org.apache.shardingsphere.infra.expr.spi.InlineExpressionParser
similarity index 51%
copy from distribution/proxy-native/Dockerfile
copy to
infra/expr/purelist/src/main/resources/META-INF/services/org.apache.shardingsphere.infra.expr.spi.InlineExpressionParser
index 4578fd982d1..9f038f1b9fb 100644
--- a/distribution/proxy-native/Dockerfile
+++
b/infra/expr/purelist/src/main/resources/META-INF/services/org.apache.shardingsphere.infra.expr.spi.InlineExpressionParser
@@ -14,26 +14,5 @@
# See the License for the specific language governing permissions and
# limitations under the License.
#
-FROM alpine AS prepare
-ARG APP_NAME
-ENV LOCAL_PATH /opt/shardingsphere-proxy-native
-
-ADD target/${APP_NAME}.tar.gz /opt
-RUN mv /opt/${APP_NAME} ${LOCAL_PATH}
-
-FROM oraclelinux:9-slim
-MAINTAINER ShardingSphere "[email protected]"
-
-ARG NATIVE_IMAGE_NAME
-ENV LOCAL_PATH /opt/shardingsphere-proxy-native
-ENV JAVA_HOME "/opt/graalvm-ce-java17-22.3.1"
-ENV PATH "$JAVA_HOME/bin:$PATH"
-
-RUN microdnf install gzip -y && \
- bash <(curl -sL https://get.graalvm.org/jdk) --to "/opt" -c espresso
graalvm-ce-java17-22.3.1 && \
- $JAVA_HOME/bin/gu remove native-image && \
- microdnf clean all
-
-COPY --from=prepare ${LOCAL_PATH} ${LOCAL_PATH}
-ENTRYPOINT ${LOCAL_PATH}/${NATIVE_IMAGE_NAME} 3307 ${LOCAL_PATH}/conf
"0.0.0.0" false
+org.apache.shardingsphere.infra.expr.purelist.PureListInlineExpressionParser
diff --git
a/infra/expr/purelist/src/test/java/org/apache/shardingsphere/infra/expr/purelist/PureListInlineExpressionParserTest.java
b/infra/expr/purelist/src/test/java/org/apache/shardingsphere/infra/expr/purelist/PureListInlineExpressionParserTest.java
new file mode 100644
index 00000000000..bb8ebbf8855
--- /dev/null
+++
b/infra/expr/purelist/src/test/java/org/apache/shardingsphere/infra/expr/purelist/PureListInlineExpressionParserTest.java
@@ -0,0 +1,60 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.shardingsphere.infra.expr.purelist;
+
+import org.junit.jupiter.api.Test;
+
+import java.util.Collections;
+import java.util.List;
+
+import static org.hamcrest.CoreMatchers.hasItems;
+import static org.hamcrest.CoreMatchers.is;
+import static org.hamcrest.MatcherAssert.assertThat;
+
+class PureListInlineExpressionParserTest {
+
+ @Test
+ void assertEvaluateForExpressionIsNull() {
+ List<String> expected = new
PureListInlineExpressionParser().splitAndEvaluate(null);
+ assertThat(expected, is(Collections.<String>emptyList()));
+ }
+
+ @Test
+ void assertEvaluateForSimpleString() {
+ List<String> expected = new
PureListInlineExpressionParser().splitAndEvaluate(" t_order_0, t_order_1 ");
+ assertThat(expected.size(), is(2));
+ assertThat(expected, hasItems("t_order_0", "t_order_1"));
+ }
+
+ @Test
+ void assertEvaluateForLong() {
+ StringBuilder expression = new StringBuilder();
+ for (int i = 0; i < 1024; i++) {
+ expression.append("ds_");
+ expression.append(i / 64);
+ expression.append(".t_user_");
+ expression.append(i);
+ if (i != 1023) {
+ expression.append(",");
+ }
+ }
+ List<String> expected = new
PureListInlineExpressionParser().splitAndEvaluate(expression.toString());
+ assertThat(expected.size(), is(1024));
+ assertThat(expected, hasItems("ds_0.t_user_0", "ds_15.t_user_1023"));
+ }
+}
diff --git a/pom.xml b/pom.xml
index 88edbae2a85..0436c7f4f76 100644
--- a/pom.xml
+++ b/pom.xml
@@ -128,7 +128,7 @@
<dockerfile-maven.version>1.4.13</dockerfile-maven.version>
<docker-compose-maven-plugin.version>4.0.0</docker-compose-maven-plugin.version>
<os-maven-plugin.version>1.6.2</os-maven-plugin.version>
- <native-maven-plugin.version>0.9.22</native-maven-plugin.version>
+ <native-maven-plugin.version>0.9.24</native-maven-plugin.version>
<!-- Compile plugin versions -->
<maven-enforcer-plugin.version>3.2.1</maven-enforcer-plugin.version>
@@ -1206,7 +1206,7 @@
<profile>
<id>generateStandardMetadata</id>
<properties>
- <truffle-api.version>22.3.1</truffle-api.version>
+ <truffle-api.version>23.0.1</truffle-api.version>
<jacoco.skip>true</jacoco.skip>
<maven.javadoc.skip>true</maven.javadoc.skip>
<checkstyle.skip>true</checkstyle.skip>