Uploaded image for project: 'Apache ServiceComb'
  1. Apache ServiceComb
  2. SCB-741

Caused by: com.mysql.jdbc.MysqlDataTruncation: Data truncation: Data too long for column 'payloads' at row 1

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • None
    • pack-0.3.0, saga-0.2.1
    • Saga
    • None
    • Mac,Intellij Idea

    Description

      I encounter an Exception at Alpha Server

      Caused by: com.mysql.jdbc.MysqlDataTruncation: Data truncation: Data too long for column 'payloads' at row 1
      	at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3974) ~[mysql-connector-java-5.1.46.jar:5.1.46]
      	at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3912) ~[mysql-connector-java-5.1.46.jar:5.1.46]
      	at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:2530) ~[mysql-connector-java-5.1.46.jar:5.1.46]
      	at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2683) ~[mysql-connector-java-5.1.46.jar:5.1.46]
      	at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2486) ~[mysql-connector-java-5.1.46.jar:5.1.46]
      	at com.mysql.jdbc.PreparedStatement.executeInternal(PreparedStatement.java:1858) ~[mysql-connector-java-5.1.46.jar:5.1.46]
      	at com.mysql.jdbc.PreparedStatement.executeUpdateInternal(PreparedStatement.java:2079) ~[mysql-connector-java-5.1.46.jar:5.1.46]
      	at com.mysql.jdbc.PreparedStatement.executeUpdateInternal(PreparedStatement.java:2013) ~[mysql-connector-java-5.1.46.jar:5.1.46]
      	at com.mysql.jdbc.PreparedStatement.executeLargeUpdate(PreparedStatement.java:5104) ~[mysql-connector-java-5.1.46.jar:5.1.46]
      	at com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java:1998) ~[mysql-connector-java-5.1.46.jar:5.1.46]
      	at sun.reflect.GeneratedMethodAccessor68.invoke(Unknown Source) ~[na:na]
      	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.8.0_102]
      	at java.lang.reflect.Method.invoke(Method.java:498) ~[na:1.8.0_102]
      	at org.apache.tomcat.jdbc.pool.StatementFacade$StatementProxy.invoke(StatementFacade.java:114) ~[tomcat-jdbc-8.5.31.jar:na]
      	at com.sun.proxy.$Proxy106.executeUpdate(Unknown Source) ~[na:na]
      	at org.eclipse.persistence.internal.databaseaccess.DatabaseAccessor.executeDirectNoSelect(DatabaseAccessor.java:895) ~[org.eclipse.persistence.core-2.7.1.jar:na]
      	... 60 common frames omitted
      

      I find it's because payload bytes is more than 10240

      public class TxAbortedEvent extends TxEvent {
        public TxAbortedEvent(String globalTxId, String localTxId, String parentTxId, String compensationMethod, Throwable throwable) {
          super(EventType.TxAbortedEvent, globalTxId, localTxId, parentTxId, compensationMethod, 0, "", 0,
              stackTrace(throwable));
        }
      
        private static String stackTrace(Throwable e) {
          StringWriter writer = new StringWriter();
          e.printStackTrace(new PrintWriter(writer));
          return writer.toString();
        }
      }
      

       

      Attachments

        Issue Links

          Activity

            githubbot ASF GitHub Bot added a comment -

            SingleX opened a new pull request #226: SCB-741 change payloads database type from varbinary(10240) to blob
            URL: https://github.com/apache/incubator-servicecomb-saga/pull/226

            Follow this checklist to help us incorporate your contribution quickly and easily:

            • [X] Make sure there is a [JIRA issue](https://issues.apache.org/jira/browse/SCB) filed for the change (usually before you start working on it). Trivial changes like typos do not require a JIRA issue. Your pull request should address just this issue, without pulling in other changes.
            • [X] Each commit in the pull request should have a meaningful subject line and body.
            • [X] Format the pull request title like `[SCB-XXX] Fixes bug in ApproximateQuantiles`, where you replace `SCB-XXX` with the appropriate JIRA issue.
            • [X] Write a pull request description that is detailed enough to understand what the pull request does, how, and why.
            • [X] Run `mvn clean install` to make sure basic checks pass. A more thorough check will be performed on your pull request automatically.
            • [ ] If this contribution is large, please file an Apache [Individual Contributor License Agreement](https://www.apache.org/licenses/icla.pdf).

            —

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

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

            githubbot ASF GitHub Bot added a comment - SingleX opened a new pull request #226: SCB-741 change payloads database type from varbinary(10240) to blob URL: https://github.com/apache/incubator-servicecomb-saga/pull/226 Follow this checklist to help us incorporate your contribution quickly and easily: [X] Make sure there is a [JIRA issue] ( https://issues.apache.org/jira/browse/SCB ) filed for the change (usually before you start working on it). Trivial changes like typos do not require a JIRA issue. Your pull request should address just this issue, without pulling in other changes. [X] Each commit in the pull request should have a meaningful subject line and body. [X] Format the pull request title like ` [SCB-XXX] Fixes bug in ApproximateQuantiles`, where you replace `SCB-XXX` with the appropriate JIRA issue. [X] Write a pull request description that is detailed enough to understand what the pull request does, how, and why. [X] Run `mvn clean install` to make sure basic checks pass. A more thorough check will be performed on your pull request automatically. [ ] If this contribution is large, please file an Apache [Individual Contributor License Agreement] ( https://www.apache.org/licenses/icla.pdf ). — ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: users@infra.apache.org
            githubbot ASF GitHub Bot added a comment -

            coveralls commented on issue #226: SCB-741 change payloads database type from varbinary(10240) to blob
            URL: https://github.com/apache/incubator-servicecomb-saga/pull/226#issuecomment-405794531

            [![Coverage Status](https://coveralls.io/builds/18036631/badge)](https://coveralls.io/builds/18036631)

            Coverage decreased (-0.09%) to 93.184% when pulling *2da3f5bd8bc1e7e3990610474eefca5d2584a92e on SingleX:SCB-741* into *2c1f574f16cc492d35cb3d66079ba589a899d7be on apache:master*.

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

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

            githubbot ASF GitHub Bot added a comment - coveralls commented on issue #226: SCB-741 change payloads database type from varbinary(10240) to blob URL: https://github.com/apache/incubator-servicecomb-saga/pull/226#issuecomment-405794531 [! [Coverage Status] ( https://coveralls.io/builds/18036631/badge)](https://coveralls.io/builds/18036631 ) Coverage decreased (-0.09%) to 93.184% when pulling * 2da3f5bd8bc1e7e3990610474eefca5d2584a92e on SingleX: SCB-741 * into * 2c1f574f16cc492d35cb3d66079ba589a899d7be on apache:master *. ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: users@infra.apache.org
            githubbot ASF GitHub Bot added a comment -

            WillemJiang commented on issue #226: SCB-741 change payloads database type from varbinary(10240) to blob
            URL: https://github.com/apache/incubator-servicecomb-saga/pull/226#issuecomment-406098697

            @SingleX
            Thanks for the PR, We need to keep the stack trace size below 10240 at the same time.

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

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

            githubbot ASF GitHub Bot added a comment - WillemJiang commented on issue #226: SCB-741 change payloads database type from varbinary(10240) to blob URL: https://github.com/apache/incubator-servicecomb-saga/pull/226#issuecomment-406098697 @SingleX Thanks for the PR, We need to keep the stack trace size below 10240 at the same time. ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: users@infra.apache.org
            githubbot ASF GitHub Bot added a comment -

            SingleX commented on issue #226: SCB-741 change payloads database type from varbinary(10240) to blob
            URL: https://github.com/apache/incubator-servicecomb-saga/pull/226#issuecomment-406480029

            @WillemJiang PR has been updated, please help to review it again, thanks

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

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

            githubbot ASF GitHub Bot added a comment - SingleX commented on issue #226: SCB-741 change payloads database type from varbinary(10240) to blob URL: https://github.com/apache/incubator-servicecomb-saga/pull/226#issuecomment-406480029 @WillemJiang PR has been updated, please help to review it again, thanks ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: users@infra.apache.org
            githubbot ASF GitHub Bot added a comment -

            coveralls edited a comment on issue #226: SCB-741 change payloads database type from varbinary(10240) to blob
            URL: https://github.com/apache/incubator-servicecomb-saga/pull/226#issuecomment-405794531

            [![Coverage Status](https://coveralls.io/builds/18077891/badge)](https://coveralls.io/builds/18077891)

            Coverage decreased (-0.3%) to 93.023% when pulling *aa893a2052425513dc1edd49b935dd9315f9d338 on SingleX:SCB-741* into *2c1f574f16cc492d35cb3d66079ba589a899d7be on apache:master*.

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

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

            githubbot ASF GitHub Bot added a comment - coveralls edited a comment on issue #226: SCB-741 change payloads database type from varbinary(10240) to blob URL: https://github.com/apache/incubator-servicecomb-saga/pull/226#issuecomment-405794531 [! [Coverage Status] ( https://coveralls.io/builds/18077891/badge)](https://coveralls.io/builds/18077891 ) Coverage decreased (-0.3%) to 93.023% when pulling * aa893a2052425513dc1edd49b935dd9315f9d338 on SingleX: SCB-741 * into * 2c1f574f16cc492d35cb3d66079ba589a899d7be on apache:master *. ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: users@infra.apache.org
            githubbot ASF GitHub Bot added a comment -

            WillemJiang closed pull request #226: SCB-741 change payloads database type from varbinary(10240) to blob
            URL: https://github.com/apache/incubator-servicecomb-saga/pull/226

            This is a PR merged from a forked repository.
            As GitHub hides the original diff on merge, it is displayed below for
            the sake of provenance:

            As this is a foreign pull request (from a fork), the diff is supplied
            below (as it won't show otherwise due to GitHub magic):

            diff --git a/alpha/alpha-server/src/main/resources/schema-mysql.sql b/alpha/alpha-server/src/main/resources/schema-mysql.sql
            index ecb934e3..b1598573 100644
            — a/alpha/alpha-server/src/main/resources/schema-mysql.sql
            +++ b/alpha/alpha-server/src/main/resources/schema-mysql.sql
            @@ -26,7 +26,7 @@ CREATE TABLE IF NOT EXISTS TxEvent (
            type varchar(50) NOT NULL,
            compensationMethod varchar(256) NOT NULL,
            expiryTime datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,

            • payloads varbinary(10240),
              + payloads blob,
              retries int(11) NOT NULL DEFAULT '0',
              retryMethod varchar(256) DEFAULT NULL,
              PRIMARY KEY (surrogateId),
              @@ -42,7 +42,7 @@ CREATE TABLE IF NOT EXISTS Command (
              localTxId varchar(36) NOT NULL,
              parentTxId varchar(36) DEFAULT NULL,
              compensationMethod varchar(256) NOT NULL,
            • payloads varbinary(10240),
              + payloads blob,
              status varchar(12),
              lastModified datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
              version bigint NOT NULL,
              diff --git a/alpha/alpha-server/src/test/resources/schema.sql b/alpha/alpha-server/src/test/resources/schema.sql
              index 8d708990..0da26860 100644
                • a/alpha/alpha-server/src/test/resources/schema.sql
                  +++ b/alpha/alpha-server/src/test/resources/schema.sql
                  @@ -28,7 +28,7 @@ CREATE TABLE IF NOT EXISTS TxEvent (
                  expiryTime TIMESTAMP NOT NULL,
                  retryMethod varchar(256) NOT NULL,
                  retries int DEFAULT 0 NOT NULL,
            • payloads varbinary(10240)
              + payloads blob
              );

            CREATE TABLE IF NOT EXISTS Command (
            @@ -40,7 +40,7 @@ CREATE TABLE IF NOT EXISTS Command (
            localTxId varchar(36) NOT NULL,
            parentTxId varchar(36) DEFAULT NULL,
            compensationMethod varchar(256) NOT NULL,

            • payloads varbinary(10240),
              + payloads blob,
              status varchar(12),
              lastModified TIMESTAMP DEFAULT CURRENT_TIMESTAMP NOT NULL,
              version bigint NOT NULL
              diff --git a/omega/omega-transaction/src/main/java/org/apache/servicecomb/saga/omega/transaction/TxAbortedEvent.java b/omega/omega-transaction/src/main/java/org/apache/servicecomb/saga/omega/transaction/TxAbortedEvent.java
              index f0bac541..0a4146af 100644
                • a/omega/omega-transaction/src/main/java/org/apache/servicecomb/saga/omega/transaction/TxAbortedEvent.java
                  +++ b/omega/omega-transaction/src/main/java/org/apache/servicecomb/saga/omega/transaction/TxAbortedEvent.java
                  @@ -23,6 +23,9 @@
                  import org.apache.servicecomb.saga.common.EventType;

            public class TxAbortedEvent extends TxEvent {
            +
            + private static final int PAYLOADS_MAX_LENGTH = 10240;
            +
            public TxAbortedEvent(String globalTxId, String localTxId, String parentTxId, String compensationMethod, Throwable throwable) {
            super(EventType.TxAbortedEvent, globalTxId, localTxId, parentTxId, compensationMethod, 0, "", 0,
            stackTrace(throwable));
            @@ -31,6 +34,10 @@ public TxAbortedEvent(String globalTxId, String localTxId, String parentTxId, St
            private static String stackTrace(Throwable e) {
            StringWriter writer = new StringWriter();
            e.printStackTrace(new PrintWriter(writer));

            • return writer.toString();
              + String stackTrace = writer.toString();
              + if (stackTrace.length() > PAYLOADS_MAX_LENGTH) { + stackTrace = stackTrace.substring(0, PAYLOADS_MAX_LENGTH); + }

              + return stackTrace;
              }
              }

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

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

            githubbot ASF GitHub Bot added a comment - WillemJiang closed pull request #226: SCB-741 change payloads database type from varbinary(10240) to blob URL: https://github.com/apache/incubator-servicecomb-saga/pull/226 This is a PR merged from a forked repository. As GitHub hides the original diff on merge, it is displayed below for the sake of provenance: As this is a foreign pull request (from a fork), the diff is supplied below (as it won't show otherwise due to GitHub magic): diff --git a/alpha/alpha-server/src/main/resources/schema-mysql.sql b/alpha/alpha-server/src/main/resources/schema-mysql.sql index ecb934e3..b1598573 100644 — a/alpha/alpha-server/src/main/resources/schema-mysql.sql +++ b/alpha/alpha-server/src/main/resources/schema-mysql.sql @@ -26,7 +26,7 @@ CREATE TABLE IF NOT EXISTS TxEvent ( type varchar(50) NOT NULL, compensationMethod varchar(256) NOT NULL, expiryTime datetime NOT NULL DEFAULT CURRENT_TIMESTAMP, payloads varbinary(10240), + payloads blob, retries int(11) NOT NULL DEFAULT '0', retryMethod varchar(256) DEFAULT NULL, PRIMARY KEY (surrogateId), @@ -42,7 +42,7 @@ CREATE TABLE IF NOT EXISTS Command ( localTxId varchar(36) NOT NULL, parentTxId varchar(36) DEFAULT NULL, compensationMethod varchar(256) NOT NULL, payloads varbinary(10240), + payloads blob, status varchar(12), lastModified datetime NOT NULL DEFAULT CURRENT_TIMESTAMP, version bigint NOT NULL, diff --git a/alpha/alpha-server/src/test/resources/schema.sql b/alpha/alpha-server/src/test/resources/schema.sql index 8d708990..0da26860 100644 a/alpha/alpha-server/src/test/resources/schema.sql +++ b/alpha/alpha-server/src/test/resources/schema.sql @@ -28,7 +28,7 @@ CREATE TABLE IF NOT EXISTS TxEvent ( expiryTime TIMESTAMP NOT NULL, retryMethod varchar(256) NOT NULL, retries int DEFAULT 0 NOT NULL, payloads varbinary(10240) + payloads blob ); CREATE TABLE IF NOT EXISTS Command ( @@ -40,7 +40,7 @@ CREATE TABLE IF NOT EXISTS Command ( localTxId varchar(36) NOT NULL, parentTxId varchar(36) DEFAULT NULL, compensationMethod varchar(256) NOT NULL, payloads varbinary(10240), + payloads blob, status varchar(12), lastModified TIMESTAMP DEFAULT CURRENT_TIMESTAMP NOT NULL, version bigint NOT NULL diff --git a/omega/omega-transaction/src/main/java/org/apache/servicecomb/saga/omega/transaction/TxAbortedEvent.java b/omega/omega-transaction/src/main/java/org/apache/servicecomb/saga/omega/transaction/TxAbortedEvent.java index f0bac541..0a4146af 100644 a/omega/omega-transaction/src/main/java/org/apache/servicecomb/saga/omega/transaction/TxAbortedEvent.java +++ b/omega/omega-transaction/src/main/java/org/apache/servicecomb/saga/omega/transaction/TxAbortedEvent.java @@ -23,6 +23,9 @@ import org.apache.servicecomb.saga.common.EventType; public class TxAbortedEvent extends TxEvent { + + private static final int PAYLOADS_MAX_LENGTH = 10240; + public TxAbortedEvent(String globalTxId, String localTxId, String parentTxId, String compensationMethod, Throwable throwable) { super(EventType.TxAbortedEvent, globalTxId, localTxId, parentTxId, compensationMethod, 0, "", 0, stackTrace(throwable)); @@ -31,6 +34,10 @@ public TxAbortedEvent(String globalTxId, String localTxId, String parentTxId, St private static String stackTrace(Throwable e) { StringWriter writer = new StringWriter(); e.printStackTrace(new PrintWriter(writer)); return writer.toString(); + String stackTrace = writer.toString(); + if (stackTrace.length() > PAYLOADS_MAX_LENGTH) { + stackTrace = stackTrace.substring(0, PAYLOADS_MAX_LENGTH); + } + return stackTrace; } } ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: users@infra.apache.org
            njiang Willem Jiang added a comment -

            The patch was merged into master branch.

            njiang Willem Jiang added a comment - The patch was merged into master branch.
            njiang Willem Jiang added a comment -

            Merged the patch into 0.2.x branch.

            njiang Willem Jiang added a comment - Merged the patch into 0.2.x branch.

            People

              njiang Willem Jiang
              justdebugit justdebugit
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: