Thoralf is right, the only way to make the idBroker 
"cluster" safe is to use transactions on any Peer
doInsert/Update methods.  E.g.:

Connection con = null;
try
{
   con = Transaction.begin(dbName);
   MyTablePeer.doInsert( criteria, con);
   Transaction.commit(con);
}
catch(TorqueException e)
{
   Transaction.safeRollback(con);
   throw e;
}

You don't need to do this with the record object
save() method, because this is already wrapped
in a simple transaction.

Please note that I verified this against the latest 
code.  It may not work under V3.0.  I seem to remember
some mods going in to make the keygen stuff use the
same connection instead of a different one so the 
idBroker would be transaction safe... but this could
be a parity error in my memory.

> -----Original Message-----
> From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] 
> On Behalf Of Will Glass-Husain
> Sent: Tuesday, December 05, 2006 10:05 AM
> To: torque-user@db.apache.org
> Subject: duplicate ID exception in cluster
> 
> Hi,
> 
> I just set up a new 2 server cluster with two instances of 
> Tomcat both reading/writing from a single database.  I'm 
> using Torque 3.0, the default ID Broker and MySQL 5. (InnoDB)
> 
> My problem... Under heavy load, I notice that most write 
> requests on one of the servers fails with a duplicate ID 
> error.  Typically, each page request that fails does 10-20 
> insert statements.
> 
> Any tips as to how I might make this cluster work with 
> simultaneous writes?
> 
> WILL
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> 

Duke CE Privacy Statement
Please be advised that this e-mail and any files transmitted with it are 
confidential communication or may otherwise be privileged or confidential and 
are intended solely for the individual or entity to whom they are addressed.  
If you are not the intended recipient you may not rely on the contents of this 
email or any attachments, and we ask that you  please not read, copy or 
retransmit this communication, but reply to the sender and destroy the email, 
its contents, and all copies thereof immediately.  Any unauthorized 
dissemination, distribution or copying of this communication is strictly 
prohibited.



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to