You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shardingsphere.apache.org by "liangleiA (via GitHub)" <gi...@apache.org> on 2025/04/27 03:08:06 UTC

[I] In a SQL Server environment, when Spring Batch uses a sharding data source, the auto-increment table of the batch framework encounters an execution error. [shardingsphere]

liangleiA opened a new issue, #35268:
URL: https://github.com/apache/shardingsphere/issues/35268

   The tables for Spring Batch are managed by the framework itself. In the SQL Server environment, only the business tables are sharded, while the framework's BATCH_* tables are not configured with any sharding rules. However, the sharding parser modifies the default execution statements.
   
   The table creation statement is as follows, with an auto-incrementing primary key:
   
   Original SQL (executes successfully):
   ```
   CREATE TABLE BATCH_JOB_SEQ (ID BIGINT IDENTITY);
   ```
   
   Transformed SQL (execution fails):
   ```
   INSERT INTO BATCH_JOB_SEQ(ID, id) DEFAULT VALUES;
   ```
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@shardingsphere.apache.org.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] In a SQL Server environment, when Spring Batch uses a sharding data source, the auto-increment table of the batch framework encounters an execution error. [shardingsphere]

Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on issue #35268:
URL: https://github.com/apache/shardingsphere/issues/35268#issuecomment-3544217084

   There hasn't been any activity on this issue recently, and in order to prioritize active issues, it will be marked as stale.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@shardingsphere.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] In a SQL Server environment, when Spring Batch uses a sharding data source, the auto-increment table of the batch framework encounters an execution error. [shardingsphere]

Posted by "terrymanu (via GitHub)" <gi...@apache.org>.
terrymanu commented on issue #35268:
URL: https://github.com/apache/shardingsphere/issues/35268#issuecomment-3505567457

   Problem Understanding
   
     The issue occurs when ShardingSphere transforms a working SQL Server INSERT statement:
     -- Original SQL (executes successfully)
     INSERT INTO BATCH_JOB_SEQ DEFAULT VALUES;
   
     Into a failing statement:
     -- Transformed SQL (execution fails)
     INSERT INTO BATCH_JOB_SEQ(ID, id) DEFAULT VALUES;
   
     For a table with:
     CREATE TABLE BATCH_JOB_SEQ (ID BIGINT IDENTITY);
   
     Root Cause Analysis
   
     Based on ShardingSphere's SQL processing architecture, this likely stems from:
   
     1. SQL Parser Issue: The AbstractSQLBuilder may be incorrectly identifying column information for tables with IDENTITY columns
     2. Metadata Handling: ShardingSphere might be retrieving incorrect column metadata for SQL Server's IDENTITY columns
     3. SQL Rewrite Logic: The SQL rewriting process may not properly handle SQL Server's DEFAULT VALUES syntax for IDENTITY columns
   
     Additional Information Needed
   
     To properly diagnose and fix this issue, please provide the following details:
   
     1. Environment Configuration
   
     - ShardingSphere version
     - Spring Batch version
     - SQL Server version
     - Complete ShardingSphere configuration file (data source and sharding rules)
   
     2. Error Logs
   
     - Complete exception stack trace
     - ShardingSphere SQL parsing and execution logs
     - Specific error message returned by SQL Server
   
     3. Configuration Details
   
     - Spring Batch datasource configuration
     - Any specific routing rules for BATCH_* tables
     - Database connection parameters
   
     4. Minimal Reproduction Case
   
     - Simplified test code
     - Minimal configuration files
     - Steps to reproduce the issue
   
     Initial Recommendations
   
     1. Verify ShardingSphere Configuration
   
     Ensure BATCH_* tables are not included in sharding rules:
   
     dataSources:
       # Your datasource configuration
   
     rules:
       - !SHARDING
         tables:
           # Only configure business tables for sharding
           business_table:
             # sharding configuration
         # Do not configure BATCH_* tables in sharding rules
   
     2. Alternative Solutions
   
     If you must handle BATCH_* tables through ShardingSphere, consider:
   
     - Broadcast Table Configuration: Configure BATCH_* tables as broadcast tables
     - Hint Routing: Use Hint routing to force queries to specific datasources
     - Separate Datasource: Use a non-sharded datasource for Spring Batch tables
   
     3. Workaround Options
   
     - Configure Spring Batch to use a separate, non-sharded datasource
     - Use different table naming that doesn't conflict with ShardingSphere's processing logic
   
     Next Steps
   
     Once you provide the additional configuration and log information, we can:
   
     1. Determine if this is a configuration issue or a ShardingSphere compatibility bug
     2. If it's a bug, create a targeted fix for SQL Server IDENTITY column handling
     3. If it's a configuration issue, provide proper configuration guidance
   
     The SQL Server DEFAULT VALUES syntax with IDENTITY columns requires special handling, and this appears to be a gap in ShardingSphere's SQL Server dialect support.
   
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@shardingsphere.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] In a SQL Server environment, when Spring Batch uses a sharding data source, the auto-increment table of the batch framework encounters an execution error. [shardingsphere]

Posted by "terrymanu (via GitHub)" <gi...@apache.org>.
terrymanu closed issue #35268: In a SQL Server environment, when Spring Batch uses a sharding data source, the auto-increment table of the batch framework encounters an execution error.
URL: https://github.com/apache/shardingsphere/issues/35268


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@shardingsphere.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org