You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user-java@ibatis.apache.org by Brian Parkinson <pa...@avaning.com> on 2008/05/23 21:27:35 UTC

Question about replication and such things

Hello:

Likely this is a little off-topic for this forum, but wondering if there
is anyone with some advice.

I'm using iBATIS with Spring Transations on MySQL 5.0.X and it's
completely great - all working fine.

Aside note - imho one issue that makes iBATIS (and Spring) so lovely to
use is that when errors occur, the stack traces contain the information
to easily pinpoint the issue - a really great unsung feature - kudos.

Anyways, enough gushing - question.

We're set up to run against one database, but wondering about
replication - is this solely an aspect of the database setup, or is it
possible to have iBATIS/Spring configured to talk to 2 databases
simultanously? I'm not a db person, so apologies if this is an extremely
dumb question.

Basically, I want my server to be able to continue if the database
server falls over, and unsure whether this is completely outside the
realm of the database/iBATIS/Spring config, or whether it can be done
within the server.

Many thanks, and apologies if this is not really an iBATIS question...

parki...
 

-----Original Message-----
From: Scott Morgan [mailto:morgandev@gmail.com] 
Sent: Friday, May 23, 2008 3:21 PM
To: user-java@ibatis.apache.org
Subject: problem with registering a custom type handler for primitives -
fix included

I found an annoying quirk where if I was using a custom TypeHandler to
map a Y/N value to a boolean, it would not work in all cases.  I was
using the example from the developer docs and registering the handler in
the sql map config.  But if I was mapping using a primitive boolean
setter it didn't work.  The mapping would work if I specified the
typehandler or used a Boolean setter.

I've filed a new bug and attached the patch to fix it.  Can someone
please review and commit the change?  thanks

http://issues.apache.org/jira/browse/IBATIS-512

Re: Question about replication and such things

Posted by Clinton Begin <cl...@gmail.com>.
It's perfectly possible, but it's not free.  Three scenarios:

* Asynchronous multi-master replication:  This is what MySQL supports.
 You'll have to be careful to use sticky load balancing in your app to
ensure that each user has consistent views of the data. But otherwise,
you can use the same SQL Maps (and config) but pointing two instances
-- each pointing to one of the databases (either on the same machine
or on different machines -- or even different apps).

* Synchronous replication.  Same as above, but you don't need to worry
about sticky load balancing or latency.  But AFAIK, you'll need a 3rd
party product like SolidDB to support Synchronous replication on
MySQL.

* Master-slave sync/async replication:  In this case you'd have one
read/write (master) and one read-only (slave) database.  In this case
you'd have to route requests to the appropriate SqlMapClient instance
to ensure that reads are being directed properly.  A fancy way of
doing this would be to put a routing proxy in front of the
SqlMapClient instance returned by iBATIS/Spring.  This can get tricky,
especially with transactions, so be careful.  Also, if it's
asynchronous, you have the same issues as you see in the first bullet,
and for sync you'll still need the 3rd party solution..

Cheers,
Clinton

On Fri, May 23, 2008 at 1:27 PM, Brian Parkinson <pa...@avaning.com> wrote:
> Hello:
>
> Likely this is a little off-topic for this forum, but wondering if there
> is anyone with some advice.
>
> I'm using iBATIS with Spring Transations on MySQL 5.0.X and it's
> completely great - all working fine.
>
> Aside note - imho one issue that makes iBATIS (and Spring) so lovely to
> use is that when errors occur, the stack traces contain the information
> to easily pinpoint the issue - a really great unsung feature - kudos.
>
> Anyways, enough gushing - question.
>
> We're set up to run against one database, but wondering about
> replication - is this solely an aspect of the database setup, or is it
> possible to have iBATIS/Spring configured to talk to 2 databases
> simultanously? I'm not a db person, so apologies if this is an extremely
> dumb question.
>
> Basically, I want my server to be able to continue if the database
> server falls over, and unsure whether this is completely outside the
> realm of the database/iBATIS/Spring config, or whether it can be done
> within the server.
>
> Many thanks, and apologies if this is not really an iBATIS question...
>
> parki...
>
>
> -----Original Message-----
> From: Scott Morgan [mailto:morgandev@gmail.com]
> Sent: Friday, May 23, 2008 3:21 PM
> To: user-java@ibatis.apache.org
> Subject: problem with registering a custom type handler for primitives -
> fix included
>
> I found an annoying quirk where if I was using a custom TypeHandler to
> map a Y/N value to a boolean, it would not work in all cases.  I was
> using the example from the developer docs and registering the handler in
> the sql map config.  But if I was mapping using a primitive boolean
> setter it didn't work.  The mapping would work if I specified the
> typehandler or used a Boolean setter.
>
> I've filed a new bug and attached the patch to fix it.  Can someone
> please review and commit the change?  thanks
>
> http://issues.apache.org/jira/browse/IBATIS-512
>