shardingsphere icon indicating copy to clipboard operation
shardingsphere copied to clipboard

Sharding-JDBC 4.0.0-RC1 Compatibility?

Open Anricx opened this issue 7 years ago • 14 comments

I'm trying to upgrade from legacy version 2.0.3 -> Sharding-JDBC 4.0.0-RC1, here I have many compatibility issue, such as:

  • FORCE INDEX will cause BAD SQL.
  • LIMIT NOT WORKING with sum etc.

so I am wondering how much SQL test case is included in this project?

Anricx avatar May 13 '19 03:05 Anricx

We never released the version 2.0.6

terrymanu avatar May 13 '19 03:05 terrymanu

And all test cases are passed. If some SQL cannot pass, could you provide the SQL to let us add to test case?

terrymanu avatar May 13 '19 04:05 terrymanu

    INSERT INTO `mobile`
        (`mobile`,
         `id`,
         `lock`
        )
        values (#{mobile, jdbcType=VARCHAR}, #{id, jdbcType=BIGINT}, 1)
        on duplicate key update
            `lock` = IF(`lock` = 0, 1, 0)

please check this one, works in 3.1.0, but failed in 4.0.0-RC1, reporting com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException

also tried

INSERT INTO `mobile`
        (`mobile`,
         `id`,
         `lock`
        )
        values (#{mobile, jdbcType=VARCHAR}, #{id, jdbcType=BIGINT}, 1)
        on duplicate key update
            `lock` = IF(`lock` != VALUES(`lock`), `lock`, VALUES(`lock`))

not working in 4.0.0-RC either

jakara avatar May 14 '19 06:05 jakara

We never released the version 2.0.6

sorry, it's 2.0.3 :)

Anricx avatar May 14 '19 08:05 Anricx

Version: 4.0.0-RC1 ISSUE: FORCE INDEX

Logic SQL:

SELECT
            pp.merchant,
            pp.plate,
            pp.park_uuid,
            pp.pay_serial
FROM `_parking_payment_plus` pp FORCE INDEX (`IDX-RESULT_TIME`)
WHERE pp.result = 1 
ORDER BY pp.`id` DESC         

Actual SQL: parking_default :::

SELECT
            pp.merchant,
            pp.plate,
            pp.park_uuid,
            pp.pay_serial,
            pp.id AS ORDER_BY_DERIVED_0                   
FROM `_parking_payment` pp FORCE INDEX (`IDX-RESULT_TIME`__parking_payment)
WHERE pp.result = 1 
ORDER BY pp.`id` DESC

Error:

### Cause: java.sql.SQLSyntaxErrorException: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '__parking_payment)
         
         WHERE pp.result = 1 
         
         
 ' at line 44
; bad SQL grammar []; nested exception is java.sql.SQLSyntaxErrorException: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '__parking_payment)
         
         WHERE pp.result = 1 
         
         
 ' at line 44

Anricx avatar May 14 '19 09:05 Anricx

@jakara duplicated #2319

codefairy08 avatar May 15 '19 07:05 codefairy08

@Anricx FORCE INDEX will cause BAD SQL. this issue was fixed dev branch

codefairy08 avatar May 15 '19 07:05 codefairy08

@Anricx LIMIT NOT WORKING with sum etc:Please give a detailed description

codefairy08 avatar May 15 '19 07:05 codefairy08

@Anricx LIMIT NOT WORKING with sum etc:Please give a detailed description

It was Fixed in 4.0.0-RC1

Anricx avatar May 15 '19 08:05 Anricx

@Anricx Then can you close this issue?

terrymanu avatar May 15 '19 08:05 terrymanu

I'm using sharding-jdbc since 2016, last month I'm upgrading from 2.0.3(the legacy) to 3.1.0, some sql not working, so this month I try 4.0.0-RC1, some are still not working. All the sql are working nicely with 2.0.3,

Now i'm fallback to 2.0.3, due to it may having some unexpected issue.

So, I want to know when is the best time for upgrading to 4.x?

And thx for your guys working!

Anricx avatar May 15 '19 08:05 Anricx

4.0.0-RC1 is a release candidate for 4.0.0, we plan release 3 or 4 release candidate version on this

terrymanu avatar May 15 '19 08:05 terrymanu

Thank you for use sharding-jdbc so earlier, but I just say, 2.0.3 is past 2 years, some SQL supported which is not correct for sometime. 3.x and 4.x is more accurate than 2.x because we change a new parse engine. If some SQL still not support, can you provide the details of the SQL?

terrymanu avatar May 15 '19 08:05 terrymanu

I will waiting for the future version and try, thx for feeding back :)

Anricx avatar May 16 '19 01:05 Anricx