Skip to content

support ojdbc6 blob type#37791

Open
daiqiang wants to merge 15 commits intoapache:masterfrom
daiqiang:issue_37504
Open

support ojdbc6 blob type#37791
daiqiang wants to merge 15 commits intoapache:masterfrom
daiqiang:issue_37504

Conversation

@daiqiang
Copy link
Copy Markdown

Fixes #37504

Changes proposed in this pull request:


Before committing this PR, I'm sure that I have checked the following options:

  • [ √] My code follows the code of conduct of this project.
  • [ √] I have self-reviewed the commit code.
  • [ √] I have (or in comment I request) added corresponding labels for the pull request.
  • [ √] I have passed maven check locally : ./mvnw clean install -B -T1C -Dmaven.javadoc.skip -Dmaven.jacoco.skip -e.
  • I have made corresponding changes to the documentation.
  • I have added corresponding unit tests for my changes.
  • I have updated the Release Notes of the current development version. For more details, see Update Release Note

Fix "Invalid column type" error when inserting BLOB type via ojdbc6; use SPI to add Oracle-specific handling for BLOB and other related parameter types

Copy link
Copy Markdown
Member

@linghengqian linghengqian left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I glanced at your commit history. Out of curiosity, is your development equipment unable to use bash or PowerShell 7?

./mvnw spotless:apply -Pcheck -T1C
./mvnw checkstyle:check -Pcheck -T1C

@daiqiang
Copy link
Copy Markdown
Author

HI, @linghengqian

Thank you for providing the Spotless and CheckStyle commands earlier. I had been running such commands with mvn and kept encountering failures, but after switching to mvnw, it succeeded.
Currently, all format checks (CheckStyle/Spotless) have passed. The currently failing CI jobs (MySQL/PostgreSQL compilation/E2E tests) appear to be caused by ongoing refactoring in the main branch and are unrelated to the changes in this PR (which only touch Oracle dialect and JDBC SPI logic).
Could you please help rerun the CI jobs, verify the code locally, or advise on how to proceed? Thank you!

Copy link
Copy Markdown
Member

@linghengqian linghengqian left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Based on https://github.com/apache/shardingsphere/actions/workflows/ci.yml , the CI for the master branch is functioning normally. If the CI fails, it is either due to changes you introduced or because you did not rebase or merge the latest changes from the master branch. Refer to https://github.com/apache/shardingsphere/actions/runs/21193761740/job/60967190368?pr=37791#step:7:16641 for further details.

[INFO] Running org.apache.shardingsphere.mode.metadata.manager.resource.StorageUnitManagerTest
02:05:12.057 [main] ERROR org.apache.shardingsphere.mode.metadata.manager.resource.StorageUnitManager - Alter database: foo_db register storage unit failed.
java.sql.SQLException: register error
	at org.apache.shardingsphere.mode.metadata.manager.resource.StorageUnitManagerTest.lambda$assertRegisterLogsErrorWhenSQLException$1(StorageUnitManagerTest.java:88)
	at org.mockito.internal.stubbing.StubbedInvocationMatcher.answer(StubbedInvocationMatcher.java:42)
	at org.mockito.internal.handler.MockHandlerImpl.handle(MockHandlerImpl.java:103)
	at org.mockito.internal.handler.NullResultGuardian.handle(NullResultGuardian.java:29)
	at org.mockito.internal.handler.InvocationNotifierHandler.handle(InvocationNotifierHandler.java:34)
	at org.mockito.internal.creation.bytebuddy.MockMethodInterceptor.doIntercept(MockMethodInterceptor.java:82)
	at org.mockito.internal.creation.bytebuddy.MockMethodAdvice.handle(MockMethodAdvice.java:134)
	at org.apache.shardingsphere.mode.metadata.manager.resource.ResourceSwitchManager.switchByRegisterStorageUnit(ResourceSwitchManager.java:53)
	at org.apache.shardingsphere.mode.metadata.manager.resource.StorageUnitManager.register(StorageUnitManager.java:65)
	at org.apache.shardingsphere.mode.metadata.manager.resource.StorageUnitManagerTest.lambda$assertRegisterLogsErrorWhenSQLException$2(StorageUnitManagerTest.java:90)
	at org.junit.jupiter.api.AssertDoesNotThrow.assertDoesNotThrow(AssertDoesNotThrow.java:49)
	at org.junit.jupiter.api.AssertDoesNotThrow.assertDoesNotThrow(AssertDoesNotThrow.java:36)
	at org.junit.jupiter.api.Assertions.assertDoesNotThrow(Assertions.java:3199)
	at org.apache.shardingsphere.mode.metadata.manager.resource.StorageUnitManagerTest.assertRegisterLogsErrorWhenSQLException(StorageUnitManagerTest.java:90)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at org.junit.platform.commons.util.ReflectionUtils.invokeMethod(ReflectionUtils.java:786)
	at org.junit.platform.commons.support.ReflectionSupport.invokeMethod(ReflectionSupport.java:514)
	at org.junit.jupiter.engine.execution.MethodInvocation.proceed(MethodInvocation.java:60)
	at org.junit.jupiter.engine.execution.InvocationInterceptorChain$ValidatingInvocation.proceed(InvocationInterceptorChain.java:131)
	at org.junit.jupiter.engine.extension.TimeoutExtension.intercept(TimeoutExtension.java:161)
	at org.junit.jupiter.engine.extension.TimeoutExtension.interceptTestableMethod(TimeoutExtension.java:152)
	at org.junit.jupiter.engine.extension.TimeoutExtension.interceptTestMethod(TimeoutExtension.java:91)
	at org.junit.jupiter.engine.execution.InterceptingExecutableInvoker$ReflectiveInterceptorCall.lambda$ofVoidMethod$0(InterceptingExecutableInvoker.java:112)
	at org.junit.jupiter.engine.execution.InterceptingExecutableInvoker.lambda$invoke$0(InterceptingExecutableInvoker.java:94)
	at org.junit.jupiter.engine.execution.InvocationInterceptorChain$InterceptedInvocation.proceed(InvocationInterceptorChain.java:106)
	at org.junit.jupiter.engine.execution.InvocationInterceptorChain.proceed(InvocationInterceptorChain.java:64)
	at org.junit.jupiter.engine.execution.InvocationInterceptorChain.chainAndInvoke(InvocationInterceptorChain.java:45)
	at org.junit.jupiter.engine.execution.InvocationInterceptorChain.invoke(InvocationInterceptorChain.java:37)
	at org.junit.jupiter.engine.execution.InterceptingExecutableInvoker.invoke(InterceptingExecutableInvoker.java:93)
	at org.junit.jupiter.engine.execution.InterceptingExecutableInvoker.invoke(InterceptingExecutableInvoker.java:87)
	at org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.lambda$invokeTestMethod$4(TestMethodTestDescriptor.java:221)
	at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
	at org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.invokeTestMethod(TestMethodTestDescriptor.java:217)
	at org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.execute(TestMethodTestDescriptor.java:159)
	at org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.execute(TestMethodTestDescriptor.java:70)
	at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$6(NodeTestTask.java:157)
	at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
	at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$8(NodeTestTask.java:147)
	at org.junit.platform.engine.support.hierarchical.Node.around(Node.java:137)
	at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$9(NodeTestTask.java:145)
	at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
	at org.junit.platform.engine.support.hierarchical.NodeTestTask.executeRecursively(NodeTestTask.java:144)
	at org.junit.platform.engine.support.hierarchical.NodeTestTask.execute(NodeTestTask.java:101)
	at java.util.ArrayList.forEach(ArrayList.java:1259)
	at org.junit.platform.engine.support.hierarchical.SameThreadHierarchicalTestExecutorService.invokeAll(SameThreadHierarchicalTestExecutorService.java:41)
	at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$6(NodeTestTask.java:161)
	at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
	at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$8(NodeTestTask.java:147)
	at org.junit.platform.engine.support.hierarchical.Node.around(Node.java:137)
	at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$9(NodeTestTask.java:145)
	at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
	at org.junit.platform.engine.support.hierarchical.NodeTestTask.executeRecursively(NodeTestTask.java:144)
	at org.junit.platform.engine.support.hierarchical.NodeTestTask.execute(NodeTestTask.java:101)
	at java.util.ArrayList.forEach(ArrayList.java:1259)
	at org.junit.platform.engine.support.hierarchical.SameThreadHierarchicalTestExecutorService.invokeAll(SameThreadHierarchicalTestExecutorService.java:41)
	at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$6(NodeTestTask.java:161)
	at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
	at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$8(NodeTestTask.java:147)
	at org.junit.platform.engine.support.hierarchical.Node.around(Node.java:137)
	at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$9(NodeTestTask.java:145)
	at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
	at org.junit.platform.engine.support.hierarchical.NodeTestTask.executeRecursively(NodeTestTask.java:144)
	at org.junit.platform.engine.support.hierarchical.NodeTestTask.execute(NodeTestTask.java:101)
	at org.junit.platform.engine.support.hierarchical.SameThreadHierarchicalTestExecutorService.submit(SameThreadHierarchicalTestExecutorService.java:35)
	at org.junit.platform.engine.support.hierarchical.HierarchicalTestExecutor.execute(HierarchicalTestExecutor.java:57)
	at org.junit.platform.engine.support.hierarchical.HierarchicalTestEngine.execute(HierarchicalTestEngine.java:54)
	at org.junit.platform.launcher.core.EngineExecutionOrchestrator.executeEngine(EngineExecutionOrchestrator.java:230)
	at org.junit.platform.launcher.core.EngineExecutionOrchestrator.failOrExecuteEngine(EngineExecutionOrchestrator.java:204)
	at org.junit.platform.launcher.core.EngineExecutionOrchestrator.execute(EngineExecutionOrchestrator.java:172)
	at org.junit.platform.launcher.core.EngineExecutionOrchestrator.execute(EngineExecutionOrchestrator.java:101)
	at org.junit.platform.launcher.core.EngineExecutionOrchestrator.lambda$execute$0(EngineExecutionOrchestrator.java:64)
	at org.junit.platform.launcher.core.EngineExecutionOrchestrator.withInterceptedStreams(EngineExecutionOrchestrator.java:150)
	at org.junit.platform.launcher.core.EngineExecutionOrchestrator.execute(EngineExecutionOrchestrator.java:63)
	at org.junit.platform.launcher.core.DefaultLauncher.execute(DefaultLauncher.java:109)
	at org.junit.platform.launcher.core.DefaultLauncher.execute(DefaultLauncher.java:91)
	at org.junit.platform.launcher.core.DelegatingLauncher.execute(DelegatingLauncher.java:47)
	at org.junit.platform.launcher.core.InterceptingLauncher.lambda$execute$1(InterceptingLauncher.java:39)
	at org.junit.platform.launcher.core.ClasspathAlignmentCheckingLauncherInterceptor.intercept(ClasspathAlignmentCheckingLauncherInterceptor.java:25)
	at org.junit.platform.launcher.core.InterceptingLauncher.execute(InterceptingLauncher.java:38)
	at org.junit.platform.launcher.core.DelegatingLauncher.execute(DelegatingLauncher.java:47)
	at org.apache.maven.surefire.junitplatform.LazyLauncher.execute(LazyLauncher.java:56)
	at org.apache.maven.surefire.junitplatform.JUnitPlatformProvider.execute(JUnitPlatformProvider.java:184)
	at org.apache.maven.surefire.junitplatform.JUnitPlatformProvider.invokeAllTests(JUnitPlatformProvider.java:148)
	at org.apache.maven.surefire.junitplatform.JUnitPlatformProvider.invoke(JUnitPlatformProvider.java:122)
	at org.apache.maven.surefire.booter.ForkedBooter.runSuitesInProcess(ForkedBooter.java:385)
	at org.apache.maven.surefire.booter.ForkedBooter.execute(ForkedBooter.java:162)
	at org.apache.maven.surefire.booter.ForkedBooter.run(ForkedBooter.java:507)
	at org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:495)

Copy link
Copy Markdown
Member

@linghengqian linghengqian left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

 or advise on how to proceed?

  • You might see a checkbox like this in the description of the current PR.

[ √] I have passed maven check locally : ./mvnw clean install -B -T1C -Dmaven.javadoc.skip -Dmaven.jacoco.skip -e

  • However, if you look at the GitHub Actions logs, you'll see that all the commands there can be run in bash.
  • If you're using Windows 11 , you might be able to use bash by using devcontainers.
  • If you are unable to install WSL2 to use devcontainers, you can also use GitHub Codespace to start a remote development environment. Since E2E testing uses testcontainers, you always need a development environment that can run Linux containers.
  • Please note that I am not discriminating against PowerShell 7. For PowerShell 7, you can install the Docker CLI on Windows and then connect to dockerd in wsl2. This is also what rancher desktop or docker desktop do.

linghengqian
linghengqian previously approved these changes Jan 22, 2026
Copy link
Copy Markdown
Member

@linghengqian linghengqian left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. However, since I am unsure of the details of the original issue, I need another committer to review it.

@daiqiang
Copy link
Copy Markdown
Author

daiqiang commented Jan 22, 2026

thanks

Copy link
Copy Markdown
Member

@terrymanu terrymanu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The SPI-based parameter replayer idea is a good direction, and the new unit tests around the replayer are aligned with the goal of fixing the Oracle BLOB issue—please keep that.

Change requests:

  • Batch execution still falls back to setObject. ShardingSpherePreparedStatement.addBatch clears parameterRecords (jdbc/src/main/java/org/apache/shardingsphere/driver/jdbc/core/statement/ShardingSpherePreparedStatement.java:320), so during batch replay the code only has raw values and uses the default replayer. Oracle BLOB/InputStream inserts in batch will still fail with “invalid column type.” Please persist the per-batch setter metadata (e.g., store PreparedStatementParameter per batch) and use it when replaying batches.

Please address these points before merging.

@daiqiang
Copy link
Copy Markdown
Author

HI,@linghengqian
I encountered an error when running the command ./mvnw clean install -B -T1C -Dmaven.javadoc.skip -Dmaven.jacoco.skip -e locally, but the CI passed after I submitted the PR. I don't understand why this happened. Do I need to perform any additional steps locally?

@linghengqian
Copy link
Copy Markdown
Member

   I encountered an error when running the command ./mvnw clean install -B -T1C -Dmaven.javadoc.skip -Dmaven.jacoco.skip -e locally, but the CI passed after I submitted the PR. I don't understand why this happened. Do I need to perform any additional steps locally?

Out of curiosity, what error log did you see? I don't think there are any known issues with CI.

@daiqiang
Copy link
Copy Markdown
Author

   I encountered an error when running the command ./mvnw clean install -B -T1C -Dmaven.javadoc.skip -Dmaven.jacoco.skip -e locally, but the CI passed after I submitted the PR. I don't understand why this happened. Do I need to perform any additional steps locally?

Out of curiosity, what error log did you see? I don't think there are any known issues with CI.

The CI is correct
the local is error
The local error is as follows:
`[INFO] shardingsphere-agent ............................... SUCCESS [ 0.209 s]
[INFO] shardingsphere-agent-api ........................... SUCCESS [ 4.637 s]
[INFO] shardingsphere-agent-core .......................... FAILURE [ 15.487 s]
[INFO] shardingsphere-agent-plugins ....................... SKIPPED
[INFO] shardingsphere-agent-plugin-core ................... SKIPPED
[INFO] shardingsphere-agent-plugin-metrics ................ SKIPPED
[INFO] shardingsphere-agent-metrics-core .................. SKIPPED
[INFO] shardingsphere-agent-metrics-type .................. SKIPPED
[INFO] shardingsphere-agent-metrics-prometheus ............ SKIPPED
[INFO] shardingsphere-agent-plugin-tracing ................ SKIPPED
[INFO] shardingsphere-agent-tracing-core .................. SKIPPED
[INFO] shardingsphere-agent-tracing-type .................. SKIPPED
[INFO] shardingsphere-agent-tracing-opentelemetry ......... SKIPPED
[INFO] shardingsphere-agent-plugin-logging ................ SKIPPED
[INFO] shardingsphere-agent-logging-type .................. SKIPPED
[INFO] shardingsphere-agent-logging-file .................. SKIPPED
[INFO] shardingsphere-test-it-spi ......................... SKIPPED
[INFO] shardingsphere-test-it-parser ...................... SKIPPED
[INFO] shardingsphere-test-it-optimizer ................... SKIPPED
[INFO] shardingsphere-test-it-rewriter .................... SKIPPED
[INFO] shardingsphere-test-it-pipeline .................... SKIPPED
[INFO] shardingsphere-test-it-binder ...................... SKIPPED
[INFO] shardingsphere-test-e2e ............................ SKIPPED
[INFO] shardingsphere-test-e2e-fixture .................... SKIPPED
[INFO] shardingsphere-test-e2e-env ........................ SKIPPED
[INFO] shardingsphere-test-e2e-sql ........................ SKIPPED
[INFO] shardingsphere-test-e2e-driver ..................... SKIPPED
[INFO] shardingsphere-test-e2e-agent ...................... SKIPPED
[INFO] shardingsphere-test-e2e-agent-fixture .............. SKIPPED
[INFO] shardingsphere-test-e2e-agent-proxy-fixture ........ SKIPPED
[INFO] shardingsphere-test-e2e-agent-engine ............... SKIPPED
[INFO] shardingsphere-test-e2e-agent-plugins .............. SKIPPED
[INFO] shardingsphere-test-e2e-agent-plugins-metrics ...... SKIPPED
[INFO] shardingsphere-test-e2e-agent-plugins-metrics-prometheus SKIPPED
[INFO] shardingsphere-test-e2e-agent-plugins-tracing ...... SKIPPED
[INFO] shardingsphere-test-e2e-agent-plugins-jaeger ....... SKIPPED
[INFO] shardingsphere-test-e2e-agent-plugins-zipkin ....... SKIPPED
[INFO] shardingsphere-test-e2e-agent-plugins-logging ...... SKIPPED
[INFO] shardingsphere-test-e2e-agent-plugins-logging-file . SKIPPED
[INFO] shardingsphere-test-e2e-agent-jdbc-fixture ......... SKIPPED
[INFO] shardingsphere-test-e2e-operation .................. SKIPPED
[INFO] shardingsphere-test-e2e-pipeline ................... SKIPPED
[INFO] shardingsphere-test-e2e-transaction ................ SKIPPED
[INFO] shardingsphere-test-e2e-showprocesslist ............ SKIPPED
[INFO] shardingsphere-test-native ......................... SKIPPED
[INFO] shardingsphere-distribution ........................ SUCCESS [ 0.187 s]
[INFO] shardingsphere-src-distribution .................... SUCCESS [ 0.277 s]
[INFO] shardingsphere-bom ................................. SUCCESS [ 0.194 s]
[INFO] shardingsphere-agent-distribution .................. SKIPPED
[INFO] shardingsphere-jdbc-distribution ................... SKIPPED
[INFO] shardingsphere-proxy-distribution .................. SKIPPED
[INFO] shardingsphere-proxy-native-distribution ........... SKIPPED
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 29.605 s (Wall Clock)
[INFO] Finished at: 2026-01-26T16:03:21+08:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:3.5.1:test (default-test) on project shardingsphere-agent-core: There are test failures.
[ERROR]
[ERROR] Please refer to C:\Users\daiq\IdeaProjects\shardingsphere\agent\core\target\surefire-reports for the individual test results.
[ERROR] Please refer to dump files (if any exist) [date].dump, [date]-jvmRun[N].dump and [date].dumpstream.
[ERROR] -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:3.5.1:test (default-test) on project shardingsphere-agent-core: There are test failures.

Please refer to C:\Users\daiq\IdeaProjects\shardingsphere\agent\core\target\surefire-reports for the individual test results.
Please refer to dump files (if any exist) [date].dump, [date]-jvmRun[N].dump and [date].dumpstream.
at org.apache.maven.lifecycle.internal.MojoExecutor.doExecute2 (MojoExecutor.java:333)
at org.apache.maven.lifecycle.internal.MojoExecutor.doExecute (MojoExecutor.java:316)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:212)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:174)
at org.apache.maven.lifecycle.internal.MojoExecutor.access$000 (MojoExecutor.java:75)
at org.apache.maven.lifecycle.internal.MojoExecutor$1.run (MojoExecutor.java:162)
at org.apache.maven.plugin.DefaultMojosExecutionStrategy.execute (DefaultMojosExecutionStrategy.java:39)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:159)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:105)
at org.apache.maven.lifecycle.internal.builder.multithreaded.MultiThreadedBuilder$1.call (MultiThreadedBuilder.java:193)
at org.apache.maven.lifecycle.internal.builder.multithreaded.MultiThreadedBuilder$1.call (MultiThreadedBuilder.java:180)
at java.util.concurrent.FutureTask.run (FutureTask.java:317)
at java.util.concurrent.Executors$RunnableAdapter.call (Executors.java:572)
at java.util.concurrent.FutureTask.run (FutureTask.java:317)
at java.util.concurrent.ThreadPoolExecutor.runWorker (ThreadPoolExecutor.java:1144)
at java.util.concurrent.ThreadPoolExecutor$Worker.run (ThreadPoolExecutor.java:642)
at java.lang.Thread.run (Thread.java:1583)
Caused by: org.apache.maven.plugin.MojoFailureException: There are test failures.

Please refer to C:\Users\daiq\IdeaProjects\shardingsphere\agent\core\target\surefire-reports for the individual test results.
Please refer to dump files (if any exist) [date].dump, [date]-jvmRun[N].dump and [date].dumpstream.
at org.apache.maven.plugin.surefire.SurefireHelper.throwException (SurefireHelper.java:247)
at org.apache.maven.plugin.surefire.SurefireHelper.reportExecution (SurefireHelper.java:159)
at org.apache.maven.plugin.surefire.SurefireMojo.handleSummary (SurefireMojo.java:547)
at org.apache.maven.plugin.surefire.AbstractSurefireMojo.executeAfterPreconditionsChecked (AbstractSurefireMojo.java:1146)
at org.apache.maven.plugin.surefire.AbstractSurefireMojo.execute (AbstractSurefireMojo.java:968)
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo (DefaultBuildPluginManager.java:126)
at org.apache.maven.lifecycle.internal.MojoExecutor.doExecute2 (MojoExecutor.java:328)
at org.apache.maven.lifecycle.internal.MojoExecutor.doExecute (MojoExecutor.java:316)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:212)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:174)
at org.apache.maven.lifecycle.internal.MojoExecutor.access$000 (MojoExecutor.java:75)
at org.apache.maven.lifecycle.internal.MojoExecutor$1.run (MojoExecutor.java:162)
at org.apache.maven.plugin.DefaultMojosExecutionStrategy.execute (DefaultMojosExecutionStrategy.java:39)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:159)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:105)
at org.apache.maven.lifecycle.internal.builder.multithreaded.MultiThreadedBuilder$1.call (MultiThreadedBuilder.java:193)
at org.apache.maven.lifecycle.internal.builder.multithreaded.MultiThreadedBuilder$1.call (MultiThreadedBuilder.java:180)
at java.util.concurrent.FutureTask.run (FutureTask.java:317)
at java.util.concurrent.Executors$RunnableAdapter.call (Executors.java:572)
at java.util.concurrent.FutureTask.run (FutureTask.java:317)
at java.util.concurrent.ThreadPoolExecutor.runWorker (ThreadPoolExecutor.java:1144)
at java.util.concurrent.ThreadPoolExecutor$Worker.run (ThreadPoolExecutor.java:642)
at java.lang.Thread.run (Thread.java:1583)
[ERROR]
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException
[ERROR]
[ERROR] After correcting the problems, you can resume the build with the command
[ERROR] mvn -rf :shardingsphere-agent-core

C:\Users\daiq\IdeaProjects\shardingsphere> `

@linghengqian
Copy link
Copy Markdown
Member

I can't see which unit tests the shardingsphere-agent-core: There are test failures. refers to, but you might not have merged or rebaseed to the latest commit on the master branch locally. I also can't reproduce it locally. If you can reproduce this bug on the master branch, please open a new issue and provide the JDK version and shell type you are using.

I think you're not using bash, so some unit tests might not be handling non-Linux systems.

Copy link
Copy Markdown
Member

@terrymanu terrymanu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What’s good:

  • Splitting parameter replay into an SPI with an Oracle-specific implementation is the right direction, and the new tests cover the Oracle setter branches.

Issues to address:

  • jdbc/src/main/java/org/apache/shardingsphere/driver/jdbc/adapter/AbstractPreparedStatementAdapter.java: batch parameter recording only keeps the first batch’s setterMethodType and length. Subsequent batches reuse those when findParameterRecord runs, so if later batches call different setters (e.g., setNull, setBytes) or lengths, replay uses the wrong setter/length, risking “Invalid column type” or incorrect writes. Please persist per-batch parameter records (including setter/length) or carry that info alongside parameterSets so each batch replays with its own metadata.
  • Oracle SPI may not load in the JDBC artifact: jdbc/pom.xml does not pull in shardingsphere-database-connector-oracle, so the default replayer is likely used and still calls setObject. Please add the dependency or otherwise ensure the Oracle SPI is on the JDBC classpath; without it, #37504 is unresolved.
  • getDatabaseType now calls preparedStatement.getConnection().getMetaData().getURL() on every replay and passes it to DatabaseTypeFactory.get. If the driver returns null/non-standard URLs, this can throw and is a new failure mode. Add guarding or cache a known database type.

Missing coverage:

  • Add a batch scenario test with at least two batches using different setters/lengths to verify replay uses the correct setter and length per batch.

Please fix the above and we can re-review.

@daiqiang
Copy link
Copy Markdown
Author

thanks your review. The changes are becoming more and more extensive and complex. I'm curious how you all are testing these changes. I integrated version 5.5.3-SNAPSHOT into my test project, but it failed to connect to Oracle properly. Only version 5.5.1 works correctly. If I have to submit a PR online every time I make a change and wait for your review, wouldn't that be very cumbersome?

Copy link
Copy Markdown
Member

@linghengqian linghengqian left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If I have to submit a PR online every time I make a change and wait for your review, wouldn't that be very cumbersome?

It's really up to you. Every CI file has an on.workflow_dispatch tag, so you can manually start CI in your forked repository.

Image

Your downstream test projects can also be configured for CI, whether it's GitHub Actions, GitLab Runner, or Gitea Runner. It's entirely up to you; you just need to pull code from your forked repository on GitHub and cache it in the /root/.m2 directory through a specific linux runner for your downstream projects. Some people call this process Git Ops.

If you feel that GitHub Actions' reliance on github.com makes it too easy for Microsoft to leak your privacy, and you are worried that Microsoft will use your privacy to make money, you can also use https://github.com/nektos/act to run the GitHub Actions runner locally. Whether or not you do this depends entirely on how much you hate Microsoft.

@terrymanu
Copy link
Copy Markdown
Member

thanks your review. The changes are becoming more and more extensive and complex. I'm curious how you all are testing these changes. I integrated version 5.5.3-SNAPSHOT into my test project, but it failed to connect to Oracle properly. Only version 5.5.1 works correctly.

Before submitting a PR, you need to perform tests, which include connecting to Oracle databases.
If you are unable to establish a proper connection to the Oracle database, please explain the reasons.

If I have to submit a PR online every time I make a change and wait for your review, wouldn't that be very cumbersome?

I sorry for any inconvenience this may cause, but this is the standard collaboration model in the open-source community.
We need to ensure that newly submitted code does not introduce any issues.
For a large-scale project like ShardingSphere, extra caution is particularly necessary.

@daiqiang
Copy link
Copy Markdown
Author

1.I wrote the code based on version 5.5.1, then used a local test project of my own for integration testing. After the test succeeded, I migrated the code from 5.5.1 to 5.5.3-SNAPSHOT. However, I can’t verify the correctness of the code after migration in 5.5.3-SNAPSHOT on my own.

2.Why didn’t I directly use 5.5.3-SNAPSHOT for my local test project? Because 5.5.3-SNAPSHOT always has weird issues that prevent it from working properly. Earlier, when I integrated it into the project, it failed to work with Oracle (I can’t find the screenshot now). Today, it fails to install, as shown in the image below:
aed368041d898d725724ac3dec8b43dc

3.After making modifications on 5.5.1, I tested with the following test case and confirmed that the SQL can be inserted into the database normally. The code is as follows:
`public String batch() {
StringBuilder log = new StringBuilder();
String sql = "INSERT INTO MY_USER (ID, USER_NAME, ADDR) VALUES (?, ?, ?)";

    try (Connection conn = dataSource.getConnection();
         PreparedStatement ps = conn.prepareStatement(sql)) {

        // 批次0:setBinaryStream
        byte[] data1 = "数据1-setBinaryStream".getBytes("UTF-8");
        ps.setString(1, "BLOB_001");
        ps.setString(2, "张三");
        ps.setBinaryStream(3, new ByteArrayInputStream(data1), (long) data1.length);
        ps.addBatch();
        log.append("批次0: setBinaryStream\n");

        // 批次1:setNull
        ps.setString(1, "BLOB_002");
        ps.setString(2, "李四");
        ps.setNull(3, Types.BLOB);
        ps.addBatch();
        log.append("批次1: setNull\n");

        // 批次2:setBlob
        byte[] data3 = "数据3-setBlob".getBytes("UTF-8");
        ps.setString(1, "BLOB_003");
        ps.setString(2, "王五");
        ps.setBlob(3, new ByteArrayInputStream(data3), (long) data3.length);
        ps.addBatch();
        log.append("批次2: setBlob\n");

        // 执行
        int[] results = ps.executeBatch();
        log.append("\n执行成功!影响行数:");
        for (int i = 0; i < results.length; i++) {
            log.append("\n  批次").append(i).append(": ").append(results[i]);
        }

    } catch (Exception e) {
        log.append("\n执行失败:").append(e.getMessage());
        e.printStackTrace();
    }

    return log.toString();
}`

4.Earlier, I said, 【If I have to submit a PR online every time I make a change and wait for your review, wouldn't that be very cumbersome?】 I didn’t mean that I find it troublesome—what I was worried about is that you might find it cumbersome. If you don’t mind the back-and-forth, I’ll continue fixing this bug. If you think it’s taking too long with repeated revisions and it’s delaying your review time, please let me know.

Copy link
Copy Markdown
Member

@linghengqian linghengqian left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Because 5.5.3-SNAPSHOT always has weird issues that prevent it from working properly.

If you don’t mind the back-and-forth, I’ll continue fixing this bug.

  • Personally, I don't care, but it means that CI won't be started at any time, since currently only humans can approve the start of CI.

@daiqiang
Copy link
Copy Markdown
Author

Because 5.5.3-SNAPSHOT always has weird issues that prevent it from working properly.

If you don’t mind the back-and-forth, I’ll continue fixing this bug.

  • Personally, I don't care, but it means that CI won't be started at any time, since currently only humans can approve the start of CI.

I tried integrating 5.5.3-SNAPSHOT into my test project again last night, and this time it successfully ran on Oracle.

@terrymanu
Copy link
Copy Markdown
Member

Any update?

@daiqiang
Copy link
Copy Markdown
Author

I made some revisions and completed the final submission before the Spring Festival.I haven’t touched this matter since returning to work, and I will only continue working on it on Saturdays and Sundays from now on.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Insertion Failure with BLOB Columns

3 participants