Return-Path: Delivered-To: apmail-db-derby-dev-archive@www.apache.org Received: (qmail 19348 invoked from network); 18 Feb 2008 10:14:08 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 18 Feb 2008 10:14:08 -0000 Received: (qmail 77982 invoked by uid 500); 18 Feb 2008 10:14:01 -0000 Delivered-To: apmail-db-derby-dev-archive@db.apache.org Received: (qmail 77939 invoked by uid 500); 18 Feb 2008 10:14:01 -0000 Mailing-List: contact derby-dev-help@db.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: Delivered-To: mailing list derby-dev@db.apache.org Received: (qmail 77894 invoked by uid 99); 18 Feb 2008 10:14:01 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 18 Feb 2008 02:14:01 -0800 X-ASF-Spam-Status: No, hits=-1.0 required=10.0 tests=RCVD_IN_DNSWL_LOW,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: local policy) Received: from [192.18.6.24] (HELO gmp-eb-mail-2.sun.com) (192.18.6.24) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 18 Feb 2008 10:13:14 +0000 Received: from fe-emea-09.sun.com (gmp-eb-lb-2-fe3.eu.sun.com [192.18.6.12]) by gmp-eb-mail-2.sun.com (8.13.7+Sun/8.12.9) with ESMTP id m1IADUUM016200 for ; Mon, 18 Feb 2008 10:13:34 GMT Received: from conversion-daemon.fe-emea-09.sun.com by fe-emea-09.sun.com (Sun Java System Messaging Server 6.2-8.04 (built Feb 28 2007)) id <0JWF00K01IJKTP00@fe-emea-09.sun.com> (original mail from Jorgen.Loland@Sun.COM) for derby-dev@db.apache.org; Mon, 18 Feb 2008 10:13:30 +0000 (GMT) Received: from [129.159.112.194] by fe-emea-09.sun.com (Sun Java System Messaging Server 6.2-8.04 (built Feb 28 2007)) with ESMTPSA id <0JWF003HFJ2GOY20@fe-emea-09.sun.com> for derby-dev@db.apache.org; Mon, 18 Feb 2008 10:13:28 +0000 (GMT) Date: Mon, 18 Feb 2008 11:13:27 +0100 From: =?ISO-8859-1?Q?J=F8rgen_L=F8land?= Subject: Re: using the EmbedConnection#handleExceptions method in failover In-reply-to: <47B927B4.1040307@sun.com> Sender: Jorgen.Loland@Sun.COM To: derby-dev@db.apache.org Message-id: <47B95A47.5020501@sun.com> MIME-version: 1.0 Content-type: text/plain; format=flowed; charset=ISO-8859-1 Content-transfer-encoding: 8BIT References: <47B927B4.1040307@sun.com> User-Agent: Thunderbird 2.0.0.9 (X11/20071119) X-Virus-Checked: Checked by ClamAV on apache.org 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