Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [eclipselink-users] Updates two database servers in one take

Thanks, Phillip.
My current setup is optimized to run under Apache Tomcat.
Unfortunately, adding XA support to Tomcat, besides possible, it is a huge task.
I'll let you know the results of my testings.

I really appreciate all your investigation, and I do believe all of this would go to some wiki for future references.
Despite I can't use this right now does not reduce the value of your insights.

Thanks,

Edson Richter


> Date: Sun, 31 May 2015 22:16:48 -0400
> From: phillip.w.g.ross@xxxxxxxxx
> To: eclipselink-users@xxxxxxxxxxx
> Subject: Re: [eclipselink-users] Updates two database servers in one take
>
> Hi Edson... I was using glassfish embedded container with persistence
> unit configured for JTA transactions. In this case, I found that I
> HAD to use XA when using partitioning. With my initial testing, I
> was trying to use non-XA datasources and received an error stating
> that only 1 non-XA resource was able to be enlisted in the
> transaction. Also I should mention that I configured the connection
> pools via jtaDataSource properties in the persistence unit, not
> nonJtaDataSource properties.
>
> If you're saying that you desire the XA scenario... that's actually
> what my environment was using. I'm also using postgresql, but I'm not
> using native sequences, but rather String based primary keys with
> values generated via eclipselink's UUID value generator.
>
> - Phillip
>
> On Sun, May 31, 2015 at 10:00 PM, Edson Richter
> <edsonrichter@xxxxxxxxxxx> wrote:
> > Thanks for the follow up.
> >
> > After few hours working on it, I've figured out the same solution (to add
> > the annotation in any of the beans).
> > The results were not satisfactory - I did expect in such situation,
> > EclipseLink would use two phase commit with my databases - which is not
> > true.
> > Perhaps, I've caused a crash failure in my test system simply by having
> > unsync between sequences.
> >
> > No matter the solution I'll take (current alternatives are - in order of
> > preference - EclipseLink, PostgreSQL sync repl, and C-JDBC), I'll have to
> > abandon sequences at all because PostgreSQL doesn't update sequences as part
> > of any transaction.
> >
> > So, it will not be simples - but I'll keep researching until I find a really
> > fine solution for my needs.
> >
> > In a perfect world, I would have two PostgreSQL servers completely in sync
> > and also EclipseLink caches in sync - so, no matter which App server my
> > users is running on (local or remote), data will always be in sync.
> >
> > C-JDBC has one "plus": if one database fails, appliation will still run, and
> > it is possible to put the faulty database back by applying diferential
> > changes - sorry, no more details so far. I need to investigate more and make
> > my own set of tests.
> >
> > Regards,
> >
> > Edson
> >
> >> Date: Sun, 31 May 2015 16:36:08 -0400
> >> From: phillip.w.g.ross@xxxxxxxxx
> >> To: eclipselink-users@xxxxxxxxxxx
> >> Subject: Re: [eclipselink-users] Updates two database servers in one take
> >>
> >> Hi Edson, I'm not sure if you're still playing with this
> >> functionality, but here is a little more info for you. You have
> >> defined a property in your persistence unit via persistence.xml:
> >> <property name="eclipselink.partitioning"
> >> value="ReplicationPartitioning"/>
> >>
> >> This refers to a named "partition policy" but you also need to setup a
> >> partition policy with this name. It can probably be done with a
> >> session customizer, but the examples I've seen define the policy via
> >> an annotation on a jpa entity class... like this:
> >>
> >> @ReplicationPartitioning(name = "replicate", connectionPools =
> >> {"default", "node2"})
> >>
> >> This assumes you want to replicate to connection pools named "default"
> >> and "node2"
> >>
> >> I've also read that you can define this policy in an orm.xml file
> >> instead of using annotations, but I've not looked too closely at it.
> >>
> >> I'm still evaluating the best scheme for applying replication to all
> >> entities within a persistence unit, and I'll post more info after I
> >> play some more.
> >>
> >> Hope that helps!
> >> - Phillip
> >>
> >> On Tue, Apr 14, 2015 at 4:21 PM, Edson Richter <edsonrichter@xxxxxxxxxxx>
> >> wrote:
> >> > Yes, I've read both of them. Most of available examples show
> >> > partitioning
> >> > using annotations, but I just want to enable ReplicationPartitioning -
> >> > which
> >> > seems to not require nothign special, but three properties in
> >> > persistence
> >> > unit XML.
> >> >
> >> > Remains the question: when enabling "ReplicationPartitioning" in
> >> > persistence
> >> > unit, why EntityManagerFactory creation throws error "Missing
> >> > partitioning
> >> > policy for name". How can I fix it?
> >> >
> >> > This is my latest persistence unit:
> >> >
> >> > <persistence version="2.0"
> >> > xmlns="http://java.sun.com/xml/ns/persistence"
> >> > xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> >> > xsi:schemaLocation="http://java.sun.com/xml/ns/persistence
> >> > http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd">
> >> > <persistence-unit name="TestePU" transaction-type="RESOURCE_LOCAL">
> >> > <provider>org.eclipse.persistence.jpa.PersistenceProvider</provider>
> >> > <non-jta-data-source>java:comp/env/jdbc/teste</non-jta-data-source>
> >> > <exclude-unlisted-classes>false</exclude-unlisted-classes>
> >> > <shared-cache-mode>ALL</shared-cache-mode>
> >> > <validation-mode>NONE</validation-mode>
> >> > <properties>
> >> > <property name="eclipselink.partitioning"
> >> > value="ReplicationPartitioning"/>
> >> > <property name="eclipselink.connection-pool.default.nonJtaDataSource"
> >> > value="java:comp/env/jdbc/teste"/>
> >> > <property name="eclipselink.connection-pool.node2.nonJtaDataSource"
> >> > value="java:comp/env/jdbc/teste2"/>
> >> > </properties>
> >> > </persistence-unit>
> >> >
> >> > Atenciosamente,
> >> >
> >> > Edson Carlos Ericksson Richter
> >> >
> >> > On 14-04-2015 16:55, Lukas Jungmann wrote:
> >> >>
> >> >> On 4/14/15 9:11 PM, Edson Richter wrote:
> >> >>>
> >> >>> I can't find correct documentation for this feature.
> >> >>> I think this cannot be used, since the only available example doesn't
> >> >>> work at all, and the "Example page" in documentation is a broken link
> >> >>> with
> >> >>> error 404 (page not found).
> >> >>
> >> >>
> >> >> some pointers, not sure how useful they will be:
> >> >> https://wiki.eclipse.org/EclipseLink/Examples/JPA/Partitioning
> >> >>
> >> >>
> >> >> http://java-persistence-performance.blogspot.cz/2011/05/data-partitioning-scaling-database.html
> >> >>
> >> >> HTH,
> >> >> --lukas
> >> >>>
> >> >>>
> >> >>> Atenciosamente,
> >> >>>
> >> >>> Edson Carlos Ericksson Richter
> >> >>>
> >> >>> On 13-04-2015 17:02, Edson Richter wrote:
> >> >>>>
> >> >>>> Please, could someone point out how to configure Replication policy
> >> >>>> in
> >> >>>> the persistence unit?
> >> >>>>
> >> >>>> Atenciosamente,
> >> >>>>
> >> >>>> Edson Carlos Ericksson Richter
> >> >>>>
> >> >>>> On 12-04-2015 14:57, Phillip Ross wrote:
> >> >>>>>
> >> >>>>> Edson, I'm not sure if this is what you're looking for, but
> >> >>>>> Eclipselink supports "partitioning" which I believe also has
> >> >>>>> replication functionality:
> >> >>>>>
> >> >>>>>
> >> >>>>> http://www.eclipse.org/eclipselink/documentation/2.5/solutions/scaling002.htm#BABHHAEJ
> >> >>>>>
> >> >>>>> hope that helps!
> >> >>>>> - Phillip
> >> >>>>>
> >> >>>>>
> >> >>>>> On Sun, Apr 12, 2015 at 10:55 AM, Edson Carlos Ericksson Richter
> >> >>>>> <edsonrichter@xxxxxxxxxxx> wrote:
> >> >>>>>>
> >> >>>>>> It is possible to configure eclipselink in the following way:
> >> >>>>>>
> >> >>>>>> 1) Every query is send to one "master" server;
> >> >>>>>> 2) Every transaction causes insert/update/delete/procedure call to
> >> >>>>>> be
> >> >>>>>> send
> >> >>>>>> in two-phase commit mode to 2~4 servers?
> >> >>>>>>
> >> >>>>>> - I don't have problems with volatile functions (like "now()")
> >> >>>>>> because
> >> >>>>>> I do
> >> >>>>>> all of this at Java app level. All my functions are predictable
> >> >>>>>> stable.
> >> >>>>>> - I want to use this a alternative to applying HA-jdbc or C-jdbc
> >> >>>>>> proxy
> >> >>>>>> libraries.
> >> >>>>>>
> >> >>>>>>
> >> >>>>>> Thanks,
> >> >>>>>>
> >> >>>>>> Edson
> >> >>>>>>
> >> >>>>>> _______________________________________________
> >> >>>>>> eclipselink-users mailing list
> >> >>>>>> eclipselink-users@xxxxxxxxxxx
> >> >>>>>> To change your delivery options, retrieve your password, or
> >> >>>>>> unsubscribe from
> >> >>>>>> this list, visit
> >> >>>>>> https://dev.eclipse.org/mailman/listinfo/eclipselink-users
> >> >>>>>
> >> >>>>> _______________________________________________
> >> >>>>> eclipselink-users mailing list
> >> >>>>> eclipselink-users@xxxxxxxxxxx
> >> >>>>> To change your delivery options, retrieve your password, or
> >> >>>>> unsubscribe
> >> >>>>> from this list, visit
> >> >>>>> https://dev.eclipse.org/mailman/listinfo/eclipselink-users
> >> >>>>
> >> >>>>
> >> >>>> _______________________________________________
> >> >>>> eclipselink-users mailing list
> >> >>>> eclipselink-users@xxxxxxxxxxx
> >> >>>> To change your delivery options, retrieve your password, or
> >> >>>> unsubscribe
> >> >>>> from this list, visit
> >> >>>> https://dev.eclipse.org/mailman/listinfo/eclipselink-users
> >> >>>
> >> >>>
> >> >>> _______________________________________________
> >> >>> eclipselink-users mailing list
> >> >>> eclipselink-users@xxxxxxxxxxx
> >> >>> To change your delivery options, retrieve your password, or
> >> >>> unsubscribe
> >> >>> from this list, visit
> >> >>> https://dev.eclipse.org/mailman/listinfo/eclipselink-users
> >> >>
> >> >>
> >> >> _______________________________________________
> >> >> eclipselink-users mailing list
> >> >> eclipselink-users@xxxxxxxxxxx
> >> >> To change your delivery options, retrieve your password, or unsubscribe
> >> >> from this list, visit
> >> >> https://dev.eclipse.org/mailman/listinfo/eclipselink-users
> >> >
> >> >
> >> > _______________________________________________
> >> > eclipselink-users mailing list
> >> > eclipselink-users@xxxxxxxxxxx
> >> > To change your delivery options, retrieve your password, or unsubscribe
> >> > from
> >> > this list, visit
> >> > https://dev.eclipse.org/mailman/listinfo/eclipselink-users
> >> _______________________________________________
> >> eclipselink-users mailing list
> >> eclipselink-users@xxxxxxxxxxx
> >> To change your delivery options, retrieve your password, or unsubscribe
> >> from this list, visit
> >> https://dev.eclipse.org/mailman/listinfo/eclipselink-users
> >
> > _______________________________________________
> > eclipselink-users mailing list
> > eclipselink-users@xxxxxxxxxxx
> > To change your delivery options, retrieve your password, or unsubscribe from
> > this list, visit
> > https://dev.eclipse.org/mailman/listinfo/eclipselink-users
> _______________________________________________
> eclipselink-users mailing list
> eclipselink-users@xxxxxxxxxxx
> To change your delivery options, retrieve your password, or unsubscribe from this list, visit
> https://dev.eclipse.org/mailman/listinfo/eclipselink-users

Back to the top