Return-Path: Delivered-To: apmail-db-derby-user-archive@www.apache.org Received: (qmail 42014 invoked from network); 17 Sep 2008 07:29:32 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 17 Sep 2008 07:29:32 -0000 Received: (qmail 77403 invoked by uid 500); 17 Sep 2008 07:29:28 -0000 Delivered-To: apmail-db-derby-user-archive@db.apache.org Received: (qmail 77381 invoked by uid 500); 17 Sep 2008 07:29:28 -0000 Mailing-List: contact derby-user-help@db.apache.org; run by ezmlm Precedence: bulk list-help: list-unsubscribe: List-Post: List-Id: Reply-To: "Derby Discussion" Delivered-To: mailing list derby-user@db.apache.org Received: (qmail 77370 invoked by uid 99); 17 Sep 2008 07:29:28 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 17 Sep 2008 00:29:28 -0700 X-ASF-Spam-Status: No, hits=1.2 required=10.0 tests=FS_REPLICA,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: local policy) Received: from [66.192.107.220] (HELO bonito.coloflorida.com) (66.192.107.220) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 17 Sep 2008 07:28:28 +0000 Received: from marlin.coloflorida.com (66.192.107.234) by bonito.coloflorida.com (66.192.107.220) with Microsoft SMTP Server (TLS) id 8.1.291.1; Wed, 17 Sep 2008 03:30:20 -0400 Received: from EVS-RED.coloflorida.com ([66.192.107.214]) by marlin.coloflorida.com ([66.192.107.234]) with mapi; Wed, 17 Sep 2008 03:30:20 -0400 From: Andrew Lawrenson To: Derby Discussion Date: Wed, 17 Sep 2008 03:28:57 -0400 Subject: RE: Stopping & (Re)Starting Slave within replication Thread-Topic: Stopping & (Re)Starting Slave within replication Thread-Index: AckX86fdsmHUNjDnTmezOOZQdVF5JgAo1D6Q Message-ID: <882C3355DFF9D3468379DD1E8C115FC7148B5839E4@EVS-RED.coloflorida.com> References: <882C3355DFF9D3468379DD1E8C115FC7148B4FB46A@EVS-RED.coloflorida.com> <48CF9FBF.5050308@sun.com> In-Reply-To: <48CF9FBF.5050308@sun.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: acceptlanguage: en-US Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-Virus-Checked: Checked by ClamAV on apache.org Many thanks for confirming this. Andrew Lawrenson. -----Original Message----- From: Jorgen.Loland@Sun.COM [mailto:Jorgen.Loland@Sun.COM] Sent: 16 September 2008 13:00 To: Derby Discussion Subject: Re: Stopping & (Re)Starting Slave within replication Hi Andrew, Replication should not fail like this; it is definitely a bug. I filed a ne= w jira issue for it: https://issues.apache.org/jira/browse/DERBY-3878 I think you'll have to shutdown the slave Derby instance before restarting = replication until this bug has been fixed. Thanks for providing the necessary details. -- J=F8rgen L=F8land Andrew Lawrenson wrote: > dHi, > > I'm using Derby replication successfully (with v 10.4.1.3, on Solaris= x86, Java 1.5, 32 bit), but what I'm now trying to do is to automate synch= ronisation between two servers (both of which are running embedded with app= lications). > > One scenario I'm trying to cope with is where the master database has= been restarted, to stop & re-synchronize the slave database. > > After the master has stopped, I'm successfully stopping the replicati= on on the slave by passing the stopSlave=3Dtrue attribute, and getting back= a XRE42 SQL State to indicate this success. > > However, after this has stopped, it would appear that derby is still = listening on the slave port (verified using netstat), so if after re-copyin= g the database from the master, I try & restart the slave (using startSlave= =3Dtrue), I'm getting an exception due to the port already being in use: > > > 2008-09-15 16:54:56,842 ERROR MYAPP.DB - Cannot start slave synchronizati= on on 'MYDB' > java.sql.SQLException: Failed to start database 'MYDB', see the next exce= ption for details. > at org.apache.derby.impl.jdbc.SQLExceptionFactory.getSQLException= (Unknown Source) > at org.apache.derby.impl.jdbc.Util.newEmbedSQLException(Unknown S= ource) > at org.apache.derby.impl.jdbc.Util.seeNextException(Unknown Sourc= e) > at org.apache.derby.impl.jdbc.EmbedConnection.bootDatabase(Unknow= n Source) > at org.apache.derby.impl.jdbc.EmbedConnection.(Unknown Sour= ce) > at org.apache.derby.impl.jdbc.EmbedConnection30.(Unknown So= urce) > at org.apache.derby.jdbc.Driver30.getNewEmbedConnection(Unknown S= ource) > at org.apache.derby.jdbc.InternalDriver.connect(Unknown Source) > at org.apache.derby.jdbc.AutoloadedDriver.connect(Unknown Source) > at java.sql.DriverManager.getConnection(DriverManager.java:525) > at java.sql.DriverManager.getConnection(DriverManager.java:171) > at com.coppereye.myapp.derby.DerbyServer.getEmbeddedConnection(De= rbyServer.java:912) > at com.coppereye.myapp.derby.DerbyServer.access$400(DerbyServer.j= ava:55) > at > com.coppereye.myapp.derby.DerbyServer$2.run(DerbyServer.java:1327) > Caused by: java.sql.SQLException: Could not establish a connection to the= peer of the replicated database 'MYDB' on address 'testbox:6959'. > at org.apache.derby.impl.jdbc.SQLExceptionFactory.getSQLException= (Unknown Source) > at org.apache.derby.impl.jdbc.Util.generateCsSQLException(Unknown= Source) > ... 11 more > Caused by: ERROR XRE04: Could not establish a connection to the peer of t= he replicated database 'MYDB' on address 'testbox:6959'. > at org.apache.derby.iapi.error.StandardException.newException(Unk= nown Source) > at org.apache.derby.impl.store.replication.slave.SlaveController.= setupConnection(Unknown Source) > at org.apache.derby.impl.store.replication.slave.SlaveController.= startSlave(Unknown Source) > at org.apache.derby.impl.store.raw.RawStore.boot(Unknown Source) > at org.apache.derby.impl.services.monitor.BaseMonitor.boot(Unknow= n Source) > at org.apache.derby.impl.services.monitor.TopService.bootModule(U= nknown Source) > at org.apache.derby.impl.services.monitor.BaseMonitor.startModule= (Unknown Source) > at org.apache.derby.iapi.services.monitor.Monitor.bootServiceModu= le(Unknown Source) > at org.apache.derby.impl.store.access.RAMAccessManager.boot(Unkno= wn Source) > at org.apache.derby.impl.services.monitor.BaseMonitor.boot(Unknow= n Source) > at org.apache.derby.impl.services.monitor.TopService.bootModule(U= nknown Source) > at org.apache.derby.impl.services.monitor.BaseMonitor.startModule= (Unknown Source) > at org.apache.derby.iapi.services.monitor.Monitor.bootServiceModu= le(Unknown Source) > at org.apache.derby.impl.db.BasicDatabase.bootStore(Unknown Sourc= e) > at org.apache.derby.impl.db.BasicDatabase.boot(Unknown Source) > at org.apache.derby.impl.db.SlaveDatabase.bootBasicDatabase(Unkno= wn Source) > at org.apache.derby.impl.db.SlaveDatabase.access$000(Unknown Sour= ce) > at org.apache.derby.impl.db.SlaveDatabase$SlaveDatabaseBootThread= .run(Unknown Source) > at java.lang.Thread.run(Thread.java:595) > Caused by: java.security.PrivilegedActionException: java.net.BindExceptio= n: Address already in use > at java.security.AccessController.doPrivileged(Native Method) > at org.apache.derby.impl.store.replication.net.ReplicationMessage= Receive.createServerSocket(Unknown Source) > at org.apache.derby.impl.store.replication.net.ReplicationMessage= Receive.initConnection(Unknown Source) > ... 18 more > Caused by: java.net.BindException: Address already in use > at java.net.PlainSocketImpl.socketBind(Native Method) > at java.net.PlainSocketImpl.bind(PlainSocketImpl.java:359) > at java.net.ServerSocket.bind(ServerSocket.java:319) > at java.net.ServerSocket.(ServerSocket.java:185) > at javax.net.DefaultServerSocketFactory.createServerSocket(Server= SocketFactory.java:169) > at org.apache.derby.impl.store.replication.net.ReplicationMessage= Receive$2.run(Unknown Source) > ... 21 more > > > Is this something that ought to work? - or in this scenario would I need = to restart derby completely? > > > many thanks in advance for any advice. > > Andrew Lawrenson > >