shardingsphere
shardingsphere copied to clipboard
Scaling mysql with utf8mb4 data occur "Incorrect string value" SQLException
Sql example:
INSERT INTO `t_order_1`(`group_name`) VALUES('👍经管科技👍')
Exception:
[ERROR] 17:20:34.074 [ShardingSphere-ShardingScaling-execute-6] o.a.s.s.c.e.e.i.AbstractJDBCImporter - flush failed: org.apache.shardingsphere.scaling.core.execute.executor.record.DataRecord@1e4791cb
java.sql.SQLException: Incorrect string value: '\xF0\x9F\x91\x8D\xE7\xBB...' for column 'group_name' at row 1
at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:964)
at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3973)
at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3909)
at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:2527)
at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2680)
at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2494)
at com.mysql.jdbc.PreparedStatement.executeInternal(PreparedStatement.java:1858)
at com.mysql.jdbc.PreparedStatement.execute(PreparedStatement.java:1197)
at com.zaxxer.hikari.pool.ProxyPreparedStatement.execute(ProxyPreparedStatement.java:44)
at com.zaxxer.hikari.pool.HikariProxyPreparedStatement.execute(HikariProxyPreparedStatement.java)
at org.apache.shardingsphere.scaling.core.execute.executor.importer.AbstractJDBCImporter.executeInsert(AbstractJDBCImporter.java:149)
at org.apache.shardingsphere.scaling.core.execute.executor.importer.AbstractJDBCImporter.execute(AbstractJDBCImporter.java:127)
at org.apache.shardingsphere.scaling.core.execute.executor.importer.AbstractJDBCImporter.doFlush(AbstractJDBCImporter.java:113)
at org.apache.shardingsphere.scaling.core.execute.executor.importer.AbstractJDBCImporter.tryFlush(AbstractJDBCImporter.java:104)
at org.apache.shardingsphere.scaling.core.execute.executor.importer.AbstractJDBCImporter.flush(AbstractJDBCImporter.java:94)
at org.apache.shardingsphere.scaling.core.execute.executor.importer.AbstractJDBCImporter.write(AbstractJDBCImporter.java:83)
at org.apache.shardingsphere.scaling.core.execute.executor.importer.AbstractJDBCImporter.start(AbstractJDBCImporter.java:75)
at org.apache.shardingsphere.scaling.core.execute.executor.AbstractShardingScalingExecutor.run(AbstractShardingScalingExecutor.java:53)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
at com.google.common.util.concurrent.TrustedListenableFutureTask$TrustedFutureInterruptibleTask.runInterruptibly(TrustedListenableFutureTask.java:125)
at com.google.common.util.concurrent.InterruptibleTask.run(InterruptibleTask.java:69)
at com.google.common.util.concurrent.TrustedListenableFutureTask.run(TrustedListenableFutureTask.java:78)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:748)
We should check this issue. @tuohai666
What is the best solution for current production
It still doesn't work on version 5.1.0, commit: 01ac931e7e799b66cedcffa718893d81424c824b
[INFO ] 2021-12-30 20:52:08.786 [ShardingSphere-Command-1] ShardingSphere-SQL - Actual SQL: ds_1 ::: insert into t_order_1 (order_id, user_id, status) values (11, 1, '👍经管科技👍')
[ERROR] 2021-12-30 20:52:08.797 [ShardingSphere-Command-1] o.a.s.p.f.c.CommandExecutorTask - Exception occur:
java.sql.SQLException: Incorrect string value: '\xF0\x9F\x91\x8D\xE7\xBB...' for column 'status' at row 1
at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:965)
at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3978)
at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3914)
at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:2530)
at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2683)
at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2491)
at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2449)
at com.mysql.jdbc.StatementImpl.executeInternal(StatementImpl.java:845)
at com.mysql.jdbc.StatementImpl.execute(StatementImpl.java:939)
at com.zaxxer.hikari.pool.ProxyStatement.execute(ProxyStatement.java:103)
at com.zaxxer.hikari.pool.HikariProxyStatement.execute(HikariProxyStatement.java)
at org.apache.shardingsphere.proxy.backend.communication.jdbc.executor.callback.impl.ProxyStatementExecutorCallback.execute(ProxyStatementExecutorCallback.java:40)
at org.apache.shardingsphere.proxy.backend.communication.jdbc.executor.callback.ProxyJDBCExecutorCallback.executeSQL(ProxyJDBCExecutorCallback.java:73)
at org.apache.shardingsphere.proxy.backend.communication.jdbc.executor.callback.ProxyJDBCExecutorCallback.executeSQL(ProxyJDBCExecutorCallback.java:66)
at org.apache.shardingsphere.proxy.backend.communication.jdbc.executor.callback.ProxyJDBCExecutorCallback.executeSQL(ProxyJDBCExecutorCallback.java:44)
at org.apache.shardingsphere.infra.executor.sql.execute.engine.driver.jdbc.JDBCExecutorCallback.execute(JDBCExecutorCallback.java:85)
at org.apache.shardingsphere.infra.executor.sql.execute.engine.driver.jdbc.JDBCExecutorCallback.execute(JDBCExecutorCallback.java:64)
at org.apache.shardingsphere.infra.executor.kernel.ExecutorEngine.syncExecute(ExecutorEngine.java:101)
at org.apache.shardingsphere.infra.executor.kernel.ExecutorEngine.parallelExecute(ExecutorEngine.java:97)
at org.apache.shardingsphere.infra.executor.kernel.ExecutorEngine.execute(ExecutorEngine.java:82)
at org.apache.shardingsphere.infra.executor.sql.execute.engine.driver.jdbc.JDBCExecutor.execute(JDBCExecutor.java:65)
at org.apache.shardingsphere.proxy.backend.communication.jdbc.executor.ProxyJDBCExecutor.execute(ProxyJDBCExecutor.java:71)
at org.apache.shardingsphere.proxy.backend.communication.ProxySQLExecutor.useDriverToExecute(ProxySQLExecutor.java:153)
at org.apache.shardingsphere.proxy.backend.communication.ProxySQLExecutor.execute(ProxySQLExecutor.java:124)
at org.apache.shardingsphere.proxy.backend.communication.ProxySQLExecutor.execute(ProxySQLExecutor.java:116)
at org.apache.shardingsphere.proxy.backend.communication.DatabaseCommunicationEngine.doExecute(DatabaseCommunicationEngine.java:197)
at org.apache.shardingsphere.proxy.backend.communication.DatabaseCommunicationEngine.execute(DatabaseCommunicationEngine.java:162)
at org.apache.shardingsphere.proxy.backend.text.data.impl.SchemaAssignedDatabaseBackendHandler.execute(SchemaAssignedDatabaseBackendHandler.java:60)
at org.apache.shardingsphere.proxy.frontend.mysql.command.query.text.query.MySQLComQueryPacketExecutor.execute(MySQLComQueryPacketExecutor.java:62)
at org.apache.shardingsphere.proxy.frontend.command.CommandExecutorTask.executeCommand(CommandExecutorTask.java:96)
at org.apache.shardingsphere.proxy.frontend.command.CommandExecutorTask.run(CommandExecutorTask.java:69)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:748)
Hello , this issue has not received a reply for several days. This issue is supposed to be closed.
There hasn't been any activity on this issue recently, and in order to prioritize active issues, it will be marked as stale.