Skip to content

Many of our API's would benefit if we designed to use JTA transactions API #2063

Closed

Description

@lesv

We should consider this for Spanner, PubSub, and other API's, however, it might need updating the product API's to support this, so it may be a moot ask.

RayT recently wrote wrote:

That's a good start. In short, a hook would at least have begin transaction, commit, and abort/recover semantics.

To be true distributed transactional, it'll need a XA resource adapter.

Otherwise, another pattern would be temporarily writing the pub/sub message into a transactional store (e.g., via JDBC into a database), and have another background process that can guarantee delivery and do all the retries, etc.

That being said, how does Google deal w/ similar cases? Perhaps we recommend people not to do this (that's my guess), but we need to recommend alternatives.

Activity

  1. added
    api: datastoreIssues related to the Datastore API.
    api: pubsubIssues related to the Pub/Sub API.
    api: spannerIssues related to the Spanner API.
    api: dnsIssues related to the Cloud DNS API.
    on May 15, 2017
  2. added
    priority: p2Moderately-important priority. Fix may not be included in next release.
    on May 22, 2017
  3. saturnism commented on May 25, 2017

    @saturnism

    If not XA, start w/ just JTA

  4. lesv commented on May 31, 2017

    @lesv
    ContributorAuthor

    I sent an email about this recommending JTA with some specs.

  5. changed the title [-]Many of our API's would benefit if we designed to use XA transactions API[/-] [+]Many of our API's would benefit if we designed to use JTA transactions API[/+] on May 31, 2017
  6. lesv commented on May 31, 2017

    @lesv
    ContributorAuthor

    I know of two customers who would like this - who asked in the last 30 days.

  7. garrettjonesgoogle commented on Aug 10, 2017

    @garrettjonesgoogle
    Contributor

    This has been added to our feature backlog: https://github.com/GoogleCloudPlatform/google-cloud-java/wiki/Feature-backlog . This issue will be closed but is linked in the backlog and can continue to be used for comment and discussion.

  8. vkedia commented on Aug 22, 2017

    @vkedia

    @saturnism I was looking at the JTA transaction interface. There are methods there which are needed for supporting distributed transactions which Spanner does not support.

    Does it still make sense to implement this interface and just implement the commit and rollback functionality and throw UnsupportedException for other methods? Are there other databases which do this? Without XA support, is implementing this still useful?

  9. lesv commented on Aug 22, 2017

    @lesv
    ContributorAuthor

    Odds are that if we don't do a bunch of other stuff, this isn't helpful by itself. In looking at SpringBoot, it appears to support jta w/ XA in a few cases more

    @meltsufin may have thoughts.

  10. meltsufin commented on Aug 23, 2017

    @meltsufin
    Contributor

    @lesv I'm not sure what you mean by "if we don't do a bunch of other stuff, this isn't helpful by itself". Distributed transactions are very commonly used in the enterprise, especially for things like read a message from a queue (think Pub/Sub) and update a database (think Cloud SQL). I think Cloud SQL is covered with the JDBC driver, but I don't think there is currently a way for Pub/Sub to participate in a distributed transaction. It doesn't even seem to have a concept of a transaction. At least once delivery, is all you get. Providing something on top of Pub/Sub to simulate transactional semantics, would be a lot of work. Maybe that's what you mean by "a bunch of other stuff".

    You can read about Spring support for distributed transactions here: https://spring.io/blog/2011/08/15/configuring-spring-and-jta-without-full-java-ee/

  11. olavloite commented on Dec 17, 2017

    @olavloite
    Contributor

    @lesv I have added support for XADataSource and XAResource to my open source JDBC driver for Google Cloud Spanner, and also made a small sample application by modifying the example from Spring Boot.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

api: datastoreIssues related to the Datastore API.api: dnsIssues related to the Cloud DNS API.api: pubsubIssues related to the Pub/Sub API.api: spannerIssues related to the Spanner API.priority: p2Moderately-important priority. Fix may not be included in next release.type: feature request‘Nice-to-have’ improvement, new feature or different behavior or design.

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions