You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shardingsphere.apache.org by GitBox <gi...@apache.org> on 2022/10/12 03:27:15 UTC

[GitHub] [shardingsphere] jitawangzi opened a new issue, #21518: process blob data error

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

   ShardingSphere-Proxy 5.2.0
   
   It is a same issue with #18627  #3024
   
   I test it in version 5.2.0, this problem is still not resolved.
   
   The blob data stored is not the same as read from mysql.
   


-- 
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


[GitHub] [shardingsphere] jitawangzi commented on issue #21518: process blob data error

Posted by GitBox <gi...@apache.org>.
jitawangzi commented on issue #21518:
URL: https://github.com/apache/shardingsphere/issues/21518#issuecomment-1298357439

   https://github.com/apache/shardingsphere/issues/3024#issuecomment-545339666  
   this is the basic reason,when blob data  contains numbers less than 0 ,the result is incorrect .
   i add ```useServerPrepStmts=true``` and ```cachePrepStmts=true``` to jdbc url,it works for me . But I still feel that this should not be the way to solve this problem.


-- 
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


[GitHub] [shardingsphere] jitawangzi commented on issue #21518: process blob data error

Posted by GitBox <gi...@apache.org>.
jitawangzi commented on issue #21518:
URL: https://github.com/apache/shardingsphere/issues/21518#issuecomment-1291417412

   @TeslaCN  Check out this bug again? I have added relevant information


-- 
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


[GitHub] [shardingsphere] TeslaCN commented on issue #21518: process blob data error

Posted by GitBox <gi...@apache.org>.
TeslaCN commented on issue #21518:
URL: https://github.com/apache/shardingsphere/issues/21518#issuecomment-1275595178

   Could you provide more information about this issue? Such as configurations, DDL, DML...


-- 
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


[GitHub] [shardingsphere] jitawangzi commented on issue #21518: process blob data error

Posted by GitBox <gi...@apache.org>.
jitawangzi commented on issue #21518:
URL: https://github.com/apache/shardingsphere/issues/21518#issuecomment-1275629006

   > #3024
   
   Let me talk about the general process, i use ShardingSphere-Proxy 5.2.0, configure 5 data sources for sharding, then  create a table (without configuring sharding rules) including blob fields, insert  a record  into this table, specify the content of the blob field, and then query this data from the database, and find that the value of the blob of the queried data is different from the value when i inserted it.
   
   More specific description and configuration 、test code, etc, can be found in the reply of @xriqyu in #3024. I hava  the same problem . 


-- 
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


[GitHub] [shardingsphere] jitawangzi commented on issue #21518: process blob data error

Posted by GitBox <gi...@apache.org>.
jitawangzi commented on issue #21518:
URL: https://github.com/apache/shardingsphere/issues/21518#issuecomment-1277076166

   I reproduced the complete test code and running environment, test project address:
   https://github.com/jitawangzi/ShardingSphereProxyBlobTest.git
   
   Just run Main directly, and you can see data errors in the output:
   
   ```binary data equals result : false```
   
   The test project also contains all the configuration of ShardingSphere,sql of create table,
   
   I have modified the configuration  "config-sharding.yaml"
   
   
   ``` 
   schemaName: test_sharding
   
   dataSources:
     ds_0:
       url: jdbc:mysql://127.0.0.1:51234/test?serverTimezone=UTC&useSSL=false
       username: sharding
       password: sharding
       connectionTimeoutMilliseconds: 30000
       idleTimeoutMilliseconds: 60000
       maxLifetimeMilliseconds: 1800000
       maxPoolSize: 50
       minPoolSize: 1
   ```
   
   and "server.yaml"
   
   ``` 
   
   rules:
     - !AUTHORITY
        users:
         - sharding@:sharding
        provider:
         type: ALL_PRIVILEGES_PERMITTED
     - !TRANSACTION
        defaultType: LOCAL
     - !SQL_PARSER
        sqlCommentParseEnabled: true
        sqlStatementCache:
         initialCapacity: 2000
         maximumSize: 65535
        parseTreeCache:
         initialCapacity: 128
         maximumSize: 1024
   
   props:
     max-connections-size-per-query: 3
     kernel-executor-size: 16
     proxy-frontend-flush-threshold: 128
     proxy-opentracing-enabled: false
     proxy-hint-enabled: false
     sql-show: true
     check-table-metadata-enabled: false
     show-process-list-enabled: false
     proxy-backend-query-fetch-size: -1
     check-duplicate-table-enabled: false
     proxy-frontend-executor-size: 0
     proxy-backend-executor-suitable: OLAP
     proxy-frontend-max-connections: 0 
     proxy-mysql-default-version: 8.0.26
   
     ```
   
   
     main test code : 
   
     ``` 
   		SpringContextLoader.start("applicationContext.xml");
   
   		DataRecord record = new DataRecord();
   		byte[] oriArray = new byte[] { 1, 0, 99, 111, 109, 46, 108, 115, 46, 114, 112, 99, 46, 115, 101, 114, 118, 101, 114, 46, 82,
   				112, 99, 82, 101, 113, 117, 101, 115, -12, 49, 48, 46, 48, 46, 52, 46, 49, -75, 75, 74, 65, 104, 115, 100, 97, 107, 100,
   				104, 97, 115, 107, -28, 115, 101, 116, 68, 97, 116, -31, 1, 1, 91, 76, 106, 97, 118, 97, 46, 108, 97, 110, 103, 46, 79,
   				98, 106, 101, 99, 116, -69, 6, 9, -64, -39, -86, 20, 3, 115, 100, 104, 98, 115, 97, 104, 100, 98, 115, -31, 1, 2, 99,
   				111, 109, 46, 108, 115, 46, 114, 112, 99, 46, 115, 101, 114, 118, 101, 114, 46, 82, 112, 99, 82, 101, 115, 112, 111,
   				110, 115, -27, 0, 0, 0, 3, 115, 107, 104, 100, 98, 115, 107, 100, 117, 104, 97, 108, 100, 115, 106, 102, 100, 107, 106,
   				97, 102, 110, 97, 100, 102, -22, 10, 66, 61, -8, -5, 108, 25, 0, 0, 3, 2, 0, 3, 0, 0 };
   		record.setBytedata(oriArray);
   		record.setUuid(UUID.randomUUID().toString());
   		record.setType(3);
   
   		DataRecordMapper mapper = SpringContextLoader.getContext().getBean(DataRecordMapper.class);
   		mapper.insert(record);
   		DataRecord recordSelect = mapper.selectByPrimaryKey(record.getUuid());
   		System.out.println();
   		System.out.println("binary data equals result : " + Arrays.equals(record.getBytedata(), recordSelect.getBytedata()));
   		System.out.println();
   		System.out.println("int data equals result : " + record.getType().equals(recordSelect.getType()));
     ```
   
     watch output : 
   
   **binary data equals result : false**
   
   int data equals result : true
   
   you can also modify jdbc.properties and connect to mysql directly , 
   ``` #  connect to mysql directly
   #dburl=jdbc:mysql://39.106.203.93:51234/test?autoReconnect=true&zeroDateTimeBehavior=convertToNull&characterEncoding=UTF-8&serverTimezone=UTC
   ```
   output:
   
   
   **binary data equals result : true**
   
   int data equals result : true


-- 
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