Narayanan wrote:
Hi,
While working on the failover issue in replication, I have a requirement
that I need to shutdown
the master database when a failover is successful. I use the logic that
throwing an exception
with Database severity should shutdown the database.
For this to happen from going through the EmbedConnection class I
concluded that I need to
parse the exception that is thrown with the handleExceptions method that
is part of this class.
The handleExceptions method basically tests the severity of the
exception thrown and performs
appropriate action.
Can a person who knows about this method better please tell me if I have
concluded correctly and
if what I think the handleExceptions method does is correct?
Narayanan
Hi Narayanan,
To make an exception shut down a database, there are a few requirements:
1) The exception must be database severity (SQLState xxxxx.D)
2) The thread that caused the exception must have the database context.
You get this for free as long as the client connection attempt has
called tr.startTransaction in EmbedConnection#creator
3) The exception must be a StandardException
I had a look at the master side failover code, and you have 1) and 2)
covered. However, the StandardException thrown from MasterController is
wrapped in an SQLException in BasicDatabase. I think DERBY-3428 can be
solved by not wrapping the exception.
--
Jørgen Løland