[ 
https://issues.apache.org/jira/browse/DERBY-3358?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

V.Narayanan updated DERBY-3358:
-------------------------------

    Attachment: Derby3358.stat
                Derby3358.diff

Please find below a file by file explanation of the changes for this patch

M      
java/engine/org/apache/derby/impl/services/replication/master/MasterController.java

* Added a variable boolean that indicates whether the master controller is 
currently running or has
  been stopped. I thought I could manage with the earlier boolean variable 
stopMasterController but
  decided against it because it seemed more tied with the stopMaster operation.

* moved start up parameter initialization from boot to startMaster method. This 
makes the canSupport
  method also a place holder that returns true always.

* changed the startMaster, stopMaster and the startFailover methods to take 
into account the boolean
  active.

* replaced the earlier uses of stopMasterController with active.
  
M      java/engine/org/apache/derby/impl/store/raw/RawStore.java

* The replication properties that are part of the bootServiceModule call no 
longer contain the
  startup parameters. These have instead been moved to the startMaster method.

* The replicationProps are empty and not null because a null passed to a 
bootServiceModule call
  results in a NullPointerException.

M      
java/engine/org/apache/derby/iapi/services/replication/master/MasterFactory.java

* Changed the startMaster declaration to now accept the startup parameters as 
the method arguments.

M      java/engine/org/apache/derby/loc/messages.xml
M      java/shared/org/apache/derby/shared/common/reference/SQLState.java

* Added two new messages for the cases when the master has already been booted 
and when the given
  replication mode is not supported.

--------------------------------------------------------------------------------------------------

I tried running a repro where I connected multiple times with the wrong port 
number to the slave and finally attempted
a right connection. It works OK for me.

ij> connect 'jdbc:derby://localhost:1527/replicationdb';
ij> connect 
'jdbc:derby://localhost:1527/replicationdb;startMaster=true;slaveHost=localhost;slavePort=8002';
ERROR XJ001: DERBY SQL error: SQLCODE: -1, SQLSTATE: XJ001, SQLERRMC: 
java.lang.NullPointerExceptionXJ001.U
ij> connect 
'jdbc:derby://localhost:1527/replicationdb;startMaster=true;slaveHost=localhost;slavePort=8003';
ERROR XJ001: DERBY SQL error: SQLCODE: -1, SQLSTATE: XJ001, SQLERRMC: 
java.lang.NullPointerExceptionXJ001.U
ij> connect 
'jdbc:derby://localhost:1527/replicationdb;startMaster=true;slaveHost=localhost;slavePort=8004';
ERROR XJ001: DERBY SQL error: SQLCODE: -1, SQLSTATE: XJ001, SQLERRMC: 
java.lang.NullPointerExceptionXJ001.U
ij>  connect 
'jdbc:derby://localhost:1527/replicationdb;startMaster=true;slaveHost=localhost;slavePort=8001';
ij(CONNECTION1)> select * from employee;
EMPNO      |NAME                          
------------------------------------------
1          |narayanan                     
2          |satya                         
3          |sanjay                        
4          |Anurag                        

4 rows selected
ij(CONNECTION1)> drop table employee;
0 rows inserted/updated/deleted
ij(CONNECTION1)> create table test(i int primary key, name varchar(40));
0 rows inserted/updated/deleted
ij(CONNECTION1)> insert into test values(1,'N');
1 row inserted/updated/deleted
ij(CONNECTION1)> insert into test values(2,'A');
1 row inserted/updated/deleted
ij(CONNECTION1)> insert into test values(3,'R');
1 row inserted/updated/deleted
ij(CONNECTION1)> select * from test;
I          |NAME                                    
----------------------------------------------------
1          |N                                       
2          |A                                       
3          |R                                       

3 rows selected
ij(CONNECTION1)> connect 
'jdbc:derby://localhost:1527/replicationdb;failover=true';
ERROR XRE20: DERBY SQL error: SQLCODE: -1, SQLSTATE: XRE20, SQLERRMC: Failover 
performed successfully for database 'replicationdb', the database has been 
shutdown.

> After an incorrect(unsuccesfull) startMaster comand, further correct 
> startMaster attempts also fail.
> ----------------------------------------------------------------------------------------------------
>
>                 Key: DERBY-3358
>                 URL: https://issues.apache.org/jira/browse/DERBY-3358
>             Project: Derby
>          Issue Type: Bug
>          Components: Replication
>    Affects Versions: 10.4.0.0
>         Environment: Trunk (615841) + patch DERBY-3205/stopSlave_v1b
>            Reporter: Ole Solberg
>            Assignee: V.Narayanan
>         Attachments: Derby3358.diff, Derby3358.stat
>
>
> Slave and master servers started.
> startSlave:
> CONNECT 
> 'jdbc:derby://atum11:9999/test;startSlave=true;slaveHost=atum11;slavePort=8989';
> ERROR XRE08: DERBY SQL error: SQLCODE: -1, SQLSTATE: XRE08, SQLERRMC: 
> Replication slave mode started successfully for database 'test'. Connection 
> refused because the database is in replication slave mode. 
> startMaster without specifying slavePort - will use default?
> CONNECT 'jdbc:derby://atum11:8888/test;startMaster=true;slaveHost=atum11';
> ERROR XRE04: DERBY SQL error: SQLCODE: -1, SQLSTATE: XRE04, SQLERRMC: 
> nullXRE04
> master derby.log:
> 2008-01-29 10:02:53.097 GMT:
>  Booting Derby version The Apache Software Foundation - Apache Derby - 
> 10.4.0.0 alpha - (615841M): instance c013800d-0117-c4fb-9156-000003bf6570
> on database directory 
> /export/home/tmp/os136789/Replication_common_Trunk/master/test  
> Database Class Loader started - derby.database.classpath=''
> 2008-01-29 10:02:53.256 GMT Thread[DRDAConnThread_2,5,main] (XID = 419), 
> (SESSIONID = 0), (DATABASE = test), (DRDAID = {1}), Cleanup action starting
> java.sql.SQLException: Could not establish a connection to the peer of the 
> replicated database 'null'.
> .
> .
> Cleanup action completed
> 2008-01-29 10:02:53.260 GMT Thread[DRDAConnThread_2,5,main] (DATABASE = 
> test), (DRDAID = {1}), Could not establish a connection to the peer of the 
> replicated database 'null'.
> startMaster specyfying slavePort:
> CONNECT 
> 'jdbc:derby://atum11:8888/test;startMaster=true;slaveHost=atum11;slavePort=8989';
> ERROR XRE04: DERBY SQL error: SQLCODE: -1, SQLSTATE: XRE04, SQLERRMC: 
> nullXRE04
> master derby.log:
> 2008-01-29 10:03:38.201 GMT Thread[DRDAConnThread_2,5,main] (XID = 420), 
> (SESSIONID = 1), (DATABASE = test), (DRDAID = {2}), Cleanup action starting
> java.sql.SQLException: Could not establish a connection to the peer of the 
> replicated database 'null'.
> .
> .
> Cleanup action completed
> 2008-01-29 10:03:38.205 GMT Thread[DRDAConnThread_2,5,main] (DATABASE = 
> test), (DRDAID = {2}), Could not establish a connection to the peer of the 
> replicated database 'null'.
> Additional observation/comment:
> ----------------------------------------
> It would be helpful for debugging if slaveHost and slavePort were written in 
> error messages and into derby.log.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to