Uploaded image for project: 'Red Hat Fuse'
  1. Red Hat Fuse
  2. ENTESB-10902

Camel aggregation fails in a clustered environment with Postgresql as the repository

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • Major
    • fuse-7.5-ER1
    • jboss-fuse-6.3
    • Camel
    • None
    • % %
    • Hide
      • Set up Fuse 6.3 on two (real or virtual) machines
      • Set up Postgresql (10+) and ensure it is enabled for XA transactions
      • On each Fuse, install camel-sql feature and mvn:org.postgresql/postgresql/42.2.2
      • Download blueprint2.xml and datasource2.xml
      • Edit this to reflect the location of your database and message broker. One of the Fuse instances can be used as the broker
      • Copy the two XMLs to deploy/ on each Fuse instance
      • Use any broker client to place three messages one at a time onto the queue __test_destination, with header "foo" set to the same value. I can provide a client to do this if necessary
      • Note that one of the fuse servers will log that an aggregation completed
      • Put a larger number of messages onto the queue – perhaps 30. Note that some of the aggregations will fail with an exception
      Show
      Set up Fuse 6.3 on two (real or virtual) machines Set up Postgresql (10+) and ensure it is enabled for XA transactions On each Fuse, install camel-sql feature and mvn:org.postgresql/postgresql/42.2.2 Download blueprint2.xml and datasource2.xml Edit this to reflect the location of your database and message broker. One of the Fuse instances can be used as the broker Copy the two XMLs to deploy/ on each Fuse instance Use any broker client to place three messages one at a time onto the queue __test_destination, with header "foo" set to the same value. I can provide a client to do this if necessary Note that one of the fuse servers will log that an aggregation completed Put a larger number of messages onto the queue – perhaps 30. Note that some of the aggregations will fail with an exception

    Description

      The Camel JDBC-based aggregator supports an optimistic locking strategy, to allow it to work in a clustered environment, where two or more Fuse instances share the same database tables for the aggregation store.

      However, although it is relatively easy to configure the JDBC aggregation repository to work robustly with an Oracle database, with Postgresql it fails in a number of different ways.

      These failures are only under load, that is, when the pattern of load creates a situation where multiple JDBC operations are likely to take place concurrently.

      I'm assuming that it will be necessary to use an XA-compliant JDBC datasource for the database connection, and to mark the route as transacted. Many potential ways to configure such a datasource may be found, but they all fail, and all in different ways.

      In my test, the Camel route consumes from an ActiveMQ broker, and aggregates the messages into threes, then prints the results. It's about as simple an example of aggregation that I could come up with. The route and datasource definitions are attached.

      With the datasource definition in datasource.xml, the failure is consistently that shown in the attached exception1.txt. With the datasource definition in datasource2.xml, the exception is in exception2.txt. This latter is particularly interesting, since it appears that the aggregator is unable to recognize the exception thrown by the driver as representing a duplicate row insertion, despite the Postgresql documentation stating that it will match the required criteria.

      In fact, I've tried many different ways to define the datasource and the transaction semantics, and all fail on Postgres (in different ways) whilst working on Oracle.

      Attachments

        1. datasource2.xml
          2 kB
        2. datasource.xml
          2 kB
        3. blueprint.xml
          3 kB
        4. exception1.txt
          12 kB
        5. exception2.txt
          15 kB

        Activity

          People

            Unassigned Unassigned
            rhn-support-kboone Kevin Boone
            Tomas Turek Tomas Turek
            Votes:
            0 Vote for this issue
            Watchers:
            7 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: