linghengqian commented on issue #28704:
URL: 
https://github.com/apache/shardingsphere/issues/28704#issuecomment-1758801913

   @StarHuzy 
   ## 1st
   - Your Example has become a highly complicated step. Most of the classes 
have nothing to do with the issues mentioned in the issue, which makes it 
difficult to read.
   - I deleted the `Controller` layer and `Service` layer, and deleted the 
parameters of the `DTO` layer and Mybatis `Mapper` layer to directly expose the 
core logic in the unit test.
   - I deleted the configuration of `Atomikos` distributed transactions. What 
happens in `Atomikos` should be discussed separately, because it will even 
overlap with the transaction log automatically opened by `Mybatis Plus`, 
complicating error reporting.
   - I used `testcontainers` instead of MySQL to expose problems earlier. If 
you really need `MySQL`, you should use `testcontainers` to create a `MySQL` 
container. I have previously added `testcontainer url` support in the 
`ShardingSphere 5.3.1` milestone.
   - Without `Maven Wrapper`, I have no way of knowing which version of Maven 
you are using. Initialize `Wrapper` on the spot.
   - I didn't see the `README.md` explaining this project and I simply removed 
all JSON handling.
   - Your `app_test.sql` makes no sense at all. It is just a SQL file for some 
logical table. It does not involve SQL for real database tables, and unit tests 
cannot be written.
   ## 2nd
   - I simplified yours logic at 
https://github.com/linghengqian/sharging-jdbc-star-huzy-test/tree/fix-by-lingh 
by 
https://github.com/linghengqian/sharging-jdbc-star-huzy-test/commit/c3b3db6d6456c7051c566a874ac06a9f4f984860
 .
   - Let's start discussing the problem in your example.
   - Your 3 classes `DataShardingMapper`, `ShardingAlgorithmTool` and 
`SpringUtils` make no sense. These classes do not involve ShardingSphere's 
metadata changes at all, and naturally the metadata is not refreshed.
   - All IMHO, your core logic only involves 
`org.example.ShardingJdbcTest#testIssues28704`.
   - You must manually take out the `ContextManager` and complete a series of 
real metadata changes, which requires simulating the behavior of DistSQL. Just 
like the article I mentioned in the previous part of the issue.
   - I did not include a simulated operation of DistSQL in the example, because 
if you don't understand how DistSQL is written, what you will see is **a lot of 
magic code**. I first need to know what you think in the context of example.


-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to