Uploaded image for project: 'MariaDB Connector/J'
  1. MariaDB Connector/J
  2. CONJ-711

Xid format id is unsigned integer, currently sending as signed value

Details

    • Bug
    • Status: Closed (View Workflow)
    • Critical
    • Resolution: Fixed
    • 2.4.0
    • 2.4.2
    • XA
    • None

    Description

      Quoted from KB:

      The xid can have 3 components, though only the first one is mandatory. gtrid is a quoted string representing a global transaction identifier. bqual is a quoted string representing a local transaction identifier. formatID is an unsigned integer indicating the format used for the first two components bq.

      In XA spec:

      If OSI CCR naming is used, then
      the XID’s formatID element should be set to 0; if some other format is used, then the
      formatID element should be greater than 0.

      JDBC XID format ID is an Integer. (Java Integer is signed 32bit numeric).

      native Xid format is :

      struct xid_t {
      long formatID; /∗ format identifier ∗/
      long gtrid_length; /∗ value 1-64 ∗/
      long bqual_length; /∗ value 1-64 ∗/
      char data[XIDDATASIZE];
      };
      

      websphere for example create formatID according to this format (https://github.com/OpenLiberty/open-liberty/blob/464735a8588770d8ce055a4505f53c9a029b12ab/dev/com.ibm.tx.core/src/com/ibm/tx/jta/impl/XidImpl.java#L155)

      So Xid formatId value has better to be sent in hexa. Integer conversion to byte won't then have any signed / unsigned consideration.

      Attachments

        Activity

          diego dupin Diego Dupin created issue -
          diego dupin Diego Dupin made changes -
          Field Original Value New Value
          Description
          Quoted from [KB|https://mariadb.com/kb/en/library/xa-transactions/#syntax]:
          bq. The xid can have 3 components, though only the first one is mandatory. gtrid is a quoted string representing a global transaction identifier. bqual is a quoted string representing a local transaction identifier. formatID is an unsigned integer indicating the format used for the first two components bq.

          In [XA spec|http://pubs.opengroup.org/onlinepubs/009680699/toc.pdf]:
          {quote}If OSI CCR naming is used, then
          the XID’s formatID element should be set to 0; if some other format is used, then the
          formatID element should be greater than 0.
          {quote}
          JDBC [XID |https://docs.oracle.com/javase/10/docs/api/javax/transaction/xa/Xid.html] format ID is an Integer. (Java Integer is signed 32bit numeric).

          native Xid format is :

          {code:c}
          struct xid_t {
          long formatID; /∗ format identifier ∗/
          long gtrid_length; /∗ value 1-64 ∗/
          long bqual_length; /∗ value 1-64 ∗/
          char data[XIDDATASIZE];
          };
          {code}

          websphere for example create formatID according to this format (https://github.com/OpenLiberty/open-liberty/blob/464735a8588770d8ce055a4505f53c9a029b12ab/dev/com.ibm.tx.core/src/com/ibm/tx/jta/impl/XidImpl.java#L155)

          So in int here mustn't be considered as standard java signed 32bit numeric, but unsigned 32 bit numeric.

          The connector exchanges of Xid need to send formatId to unsigned 4 byte numeric.
          Quoted from [KB|https://mariadb.com/kb/en/library/xa-transactions/#syntax]:
          bq. The xid can have 3 components, though only the first one is mandatory. gtrid is a quoted string representing a global transaction identifier. bqual is a quoted string representing a local transaction identifier. formatID is an unsigned integer indicating the format used for the first two components bq.

          In [XA spec|http://pubs.opengroup.org/onlinepubs/009680699/toc.pdf]:
          {quote}If OSI CCR naming is used, then
          the XID’s formatID element should be set to 0; if some other format is used, then the
          formatID element should be greater than 0.
          {quote}
          JDBC [XID |https://docs.oracle.com/javase/10/docs/api/javax/transaction/xa/Xid.html] format ID is an Integer. (Java Integer is signed 32bit numeric).

          native Xid format is :

          {code:c}
          struct xid_t {
          long formatID; /∗ format identifier ∗/
          long gtrid_length; /∗ value 1-64 ∗/
          long bqual_length; /∗ value 1-64 ∗/
          char data[XIDDATASIZE];
          };
          {code}

          websphere for example create formatID according to this format (https://github.com/OpenLiberty/open-liberty/blob/464735a8588770d8ce055a4505f53c9a029b12ab/dev/com.ibm.tx.core/src/com/ibm/tx/jta/impl/XidImpl.java#L155)

          So Xid formatId integer mustn't be considered as standard java signed 32bit numeric, but unsigned 32 bit numeric.

          The connector exchanges of Xid need to send formatId to unsigned 4 byte numeric.
          valerii Valerii Kravchuk made changes -
          Affects Version/s 2.4.0 [ 23154 ]
          diego dupin Diego Dupin made changes -
          Description Quoted from [KB|https://mariadb.com/kb/en/library/xa-transactions/#syntax]:
          bq. The xid can have 3 components, though only the first one is mandatory. gtrid is a quoted string representing a global transaction identifier. bqual is a quoted string representing a local transaction identifier. formatID is an unsigned integer indicating the format used for the first two components bq.

          In [XA spec|http://pubs.opengroup.org/onlinepubs/009680699/toc.pdf]:
          {quote}If OSI CCR naming is used, then
          the XID’s formatID element should be set to 0; if some other format is used, then the
          formatID element should be greater than 0.
          {quote}
          JDBC [XID |https://docs.oracle.com/javase/10/docs/api/javax/transaction/xa/Xid.html] format ID is an Integer. (Java Integer is signed 32bit numeric).

          native Xid format is :

          {code:c}
          struct xid_t {
          long formatID; /∗ format identifier ∗/
          long gtrid_length; /∗ value 1-64 ∗/
          long bqual_length; /∗ value 1-64 ∗/
          char data[XIDDATASIZE];
          };
          {code}

          websphere for example create formatID according to this format (https://github.com/OpenLiberty/open-liberty/blob/464735a8588770d8ce055a4505f53c9a029b12ab/dev/com.ibm.tx.core/src/com/ibm/tx/jta/impl/XidImpl.java#L155)

          So Xid formatId integer mustn't be considered as standard java signed 32bit numeric, but unsigned 32 bit numeric.

          The connector exchanges of Xid need to send formatId to unsigned 4 byte numeric.
          Quoted from [KB|https://mariadb.com/kb/en/library/xa-transactions/#syntax]:
          bq. The xid can have 3 components, though only the first one is mandatory. gtrid is a quoted string representing a global transaction identifier. bqual is a quoted string representing a local transaction identifier. formatID is an unsigned integer indicating the format used for the first two components bq.

          In [XA spec|http://pubs.opengroup.org/onlinepubs/009680699/toc.pdf]:
          {quote}If OSI CCR naming is used, then
          the XID’s formatID element should be set to 0; if some other format is used, then the
          formatID element should be greater than 0.
          {quote}
          JDBC [XID |https://docs.oracle.com/javase/10/docs/api/javax/transaction/xa/Xid.html] format ID is an Integer. (Java Integer is signed 32bit numeric).

          native Xid format is :

          {code:c}
          struct xid_t {
          long formatID; /∗ format identifier ∗/
          long gtrid_length; /∗ value 1-64 ∗/
          long bqual_length; /∗ value 1-64 ∗/
          char data[XIDDATASIZE];
          };
          {code}

          websphere for example create formatID according to this format (https://github.com/OpenLiberty/open-liberty/blob/464735a8588770d8ce055a4505f53c9a029b12ab/dev/com.ibm.tx.core/src/com/ibm/tx/jta/impl/XidImpl.java#L155)

          So Xid formatId value has better to be send in hexa. This would avoid iinteger mustn't be considered as standard java signed 32bit numeric, but unsigned 32 bit numeric.

          The connector exchanges of Xid need to send formatId to unsigned 4 byte numeric.
          diego dupin Diego Dupin made changes -
          Description Quoted from [KB|https://mariadb.com/kb/en/library/xa-transactions/#syntax]:
          bq. The xid can have 3 components, though only the first one is mandatory. gtrid is a quoted string representing a global transaction identifier. bqual is a quoted string representing a local transaction identifier. formatID is an unsigned integer indicating the format used for the first two components bq.

          In [XA spec|http://pubs.opengroup.org/onlinepubs/009680699/toc.pdf]:
          {quote}If OSI CCR naming is used, then
          the XID’s formatID element should be set to 0; if some other format is used, then the
          formatID element should be greater than 0.
          {quote}
          JDBC [XID |https://docs.oracle.com/javase/10/docs/api/javax/transaction/xa/Xid.html] format ID is an Integer. (Java Integer is signed 32bit numeric).

          native Xid format is :

          {code:c}
          struct xid_t {
          long formatID; /∗ format identifier ∗/
          long gtrid_length; /∗ value 1-64 ∗/
          long bqual_length; /∗ value 1-64 ∗/
          char data[XIDDATASIZE];
          };
          {code}

          websphere for example create formatID according to this format (https://github.com/OpenLiberty/open-liberty/blob/464735a8588770d8ce055a4505f53c9a029b12ab/dev/com.ibm.tx.core/src/com/ibm/tx/jta/impl/XidImpl.java#L155)

          So Xid formatId value has better to be send in hexa. This would avoid iinteger mustn't be considered as standard java signed 32bit numeric, but unsigned 32 bit numeric.

          The connector exchanges of Xid need to send formatId to unsigned 4 byte numeric.
          Quoted from [KB|https://mariadb.com/kb/en/library/xa-transactions/#syntax]:
          bq. The xid can have 3 components, though only the first one is mandatory. gtrid is a quoted string representing a global transaction identifier. bqual is a quoted string representing a local transaction identifier. formatID is an unsigned integer indicating the format used for the first two components bq.

          In [XA spec|http://pubs.opengroup.org/onlinepubs/009680699/toc.pdf]:
          {quote}If OSI CCR naming is used, then
          the XID’s formatID element should be set to 0; if some other format is used, then the
          formatID element should be greater than 0.
          {quote}
          JDBC [XID |https://docs.oracle.com/javase/10/docs/api/javax/transaction/xa/Xid.html] format ID is an Integer. (Java Integer is signed 32bit numeric).

          native Xid format is :

          {code:c}
          struct xid_t {
          long formatID; /∗ format identifier ∗/
          long gtrid_length; /∗ value 1-64 ∗/
          long bqual_length; /∗ value 1-64 ∗/
          char data[XIDDATASIZE];
          };
          {code}

          websphere for example create formatID according to this format (https://github.com/OpenLiberty/open-liberty/blob/464735a8588770d8ce055a4505f53c9a029b12ab/dev/com.ibm.tx.core/src/com/ibm/tx/jta/impl/XidImpl.java#L155)

          So Xid formatId value has better to be sent in hexa. Integer conversion to byte won't then have any signed / unsigned consideration.

          diego dupin Diego Dupin made changes -
          Fix Version/s 2.4.2 [ 23707 ]
          diego dupin Diego Dupin made changes -
          issue.field.resolutiondate 2019-06-12 16:36:00.0 2019-06-12 16:36:00.941
          diego dupin Diego Dupin made changes -
          Component/s XA [ 15116 ]
          Resolution Fixed [ 1 ]
          Status Open [ 1 ] Closed [ 6 ]
          serg Sergei Golubchik made changes -
          Workflow MariaDB v3 [ 97403 ] MariaDB v4 [ 135116 ]

          People

            diego dupin Diego Dupin
            diego dupin Diego Dupin
            Votes:
            1 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Git Integration

                Error rendering 'com.xiplink.jira.git.jira_git_plugin:git-issue-webpanel'. Please contact your Jira administrators.