You are viewing a plain text version of this content. The canonical link for it is here.
Posted to derby-dev@db.apache.org by "Jørgen Løland (JIRA)" <ji...@apache.org> on 2007/11/15 13:05:43 UTC

[jira] Created: (DERBY-3205) Replication: Add connection url command options for starting and stopping slave

Replication: Add connection url command options for starting and stopping slave
-------------------------------------------------------------------------------

                 Key: DERBY-3205
                 URL: https://issues.apache.org/jira/browse/DERBY-3205
             Project: Derby
          Issue Type: Sub-task
          Components: JDBC
    Affects Versions: 10.4.0.0
            Reporter: Jørgen Løland


Add commands to start and stop the replication slave using properties or connection url. Example:

'jdbc:derby:<host><dbname>;startSlave=true';
'jdbc:derby:<host><dbname>;stopSlave=true';
'jdbc:derby:<host><dbname>;failover=true;

Connection url options that must be recognized:
startSlave=true
stopSlave=true
failover=true
slaveHost=<host> (optional, defaults to localhost) (only for startSlave)
slavePort=<port> (optional, defaults to 8001) (only for startSlave)

See functional specification on Derby-2872 for further details.

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


[jira] Updated: (DERBY-3205) Replication: Add connection url command options for starting, stopping slave and for failover

Posted by "Jørgen Løland (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/DERBY-3205?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Jørgen Løland updated DERBY-3205:
---------------------------------

    Attachment: stopSlave_v1a.stat
                stopSlave_v1a.diff

The attached patch, stopSlave v1a, adds the functionality for stopSlave=true.

connect 'jdbc...;stopSlave=true' gives the following results:

* Unbooted DB or DB booted without startSlave: "ERROR XRE40: Could not stop replication because the database is not in replication slave mode."
* Connection with master is up: "ERROR XRE41: Replication operation 'failover' or 'stopSlave' failed because the connection with the master is working. Issue the 'failover' or 'stopMaster' operation on the master database instead."
* No connection with master: "ERROR 08006: Database 'test' shutdown."

All tests passed. The patch is ready for review.

> Replication: Add connection url command options for starting, stopping slave and for failover
> ---------------------------------------------------------------------------------------------
>
>                 Key: DERBY-3205
>                 URL: https://issues.apache.org/jira/browse/DERBY-3205
>             Project: Derby
>          Issue Type: Sub-task
>          Components: JDBC
>    Affects Versions: 10.4.0.0
>            Reporter: Jørgen Løland
>            Assignee: V.Narayanan
>         Attachments: derby-3205_startslave_dontcommit.diff, derby-3205_startslave_dontcommit.stat, failover_impl_3205_NotForCommit_v1.diff, failover_impl_3205_NotForCommit_v1.stat, failover_impl_3205_v1.diff, failover_impl_3205_v1.stat, startSlave_1a.diff, startSlave_1a.stat, startSlave_1b.diff, startSlave_1b.stat, startSlave_1c.diff, startSlave_1d.diff, StopSlave_impl_3205_NotForCommit_v1.diff, StopSlave_impl_3205_NotForCommit_v1.stat, stopSlave_v1a.diff, stopSlave_v1a.stat
>
>
> Add commands to start and stop the replication slave using properties or connection url. Example:
> 'jdbc:derby:<host><dbname>;startSlave=true';
> 'jdbc:derby:<host><dbname>;stopSlave=true';
> 'jdbc:derby:<host><dbname>;failover=true;
> Connection url options that must be recognized:
> startSlave=true
> stopSlave=true
> failover=true
> slaveHost=<host> (optional, defaults to localhost) (only for startSlave)
> slavePort=<port> (optional, defaults to 8001) (only for startSlave)
> See functional specification on Derby-2872 for further details.

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


[jira] Commented: (DERBY-3205) Replication: Add connection url command options for starting, stopping slave and for failover

Posted by "Øystein Grøvlen (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/DERBY-3205?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12564786#action_12564786 ] 

Øystein Grøvlen commented on DERBY-3205:
----------------------------------------

I am not sure, but maybe a shutdown can be achieved by calling ContextManager#cleanupOnError with a shutdown exception?  If so you should be able to use the ContextManager of the boot thread.

> Replication: Add connection url command options for starting, stopping slave and for failover
> ---------------------------------------------------------------------------------------------
>
>                 Key: DERBY-3205
>                 URL: https://issues.apache.org/jira/browse/DERBY-3205
>             Project: Derby
>          Issue Type: Sub-task
>          Components: JDBC
>    Affects Versions: 10.4.0.0
>            Reporter: Jørgen Løland
>            Assignee: V.Narayanan
>         Attachments: derby-3205_startslave_dontcommit.diff, derby-3205_startslave_dontcommit.stat, failover_impl_3205_NotForCommit_v1.diff, failover_impl_3205_NotForCommit_v1.stat, failover_impl_3205_v1.diff, failover_impl_3205_v1.stat, failover_impl_3205_v2.diff, failover_impl_3205_v2.stat, Socket_Close_Fix_v1.diff, Socket_Close_Fix_v1.stat, startSlave_1a.diff, startSlave_1a.stat, startSlave_1b.diff, startSlave_1b.stat, startSlave_1c.diff, startSlave_1d.diff, StopSlave_impl_3205_NotForCommit_v1.diff, StopSlave_impl_3205_NotForCommit_v1.stat, stopSlave_v1a.diff, stopSlave_v1a.stat, stopSlave_v1b.diff, stopSlave_v1b.stat, stopSlave_v1c.diff, stopSlave_v1c.stat
>
>
> Add commands to start and stop the replication slave using properties or connection url. Example:
> 'jdbc:derby:<host><dbname>;startSlave=true';
> 'jdbc:derby:<host><dbname>;stopSlave=true';
> 'jdbc:derby:<host><dbname>;failover=true;
> Connection url options that must be recognized:
> startSlave=true
> stopSlave=true
> failover=true
> slaveHost=<host> (optional, defaults to localhost) (only for startSlave)
> slavePort=<port> (optional, defaults to 8001) (only for startSlave)
> See functional specification on Derby-2872 for further details.

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


[jira] Commented: (DERBY-3205) Replication: Add connection url command options for starting and stopping slave

Posted by "Jørgen Løland (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/DERBY-3205?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12558976#action_12558976 ] 

Jørgen Løland commented on DERBY-3205:
--------------------------------------

Hi Øystein - thanks for reviewing this patch.

I agree that the first connection should give a more meaningful exception. I will change this to "Connection refused - replication slave mode started successfully for database 'x'"

Connection attempt 2-> will get the  exception from the first conn attempt once patch 3 on DERBY-3184 is in.

> Replication: Add connection url command options for starting and stopping slave
> -------------------------------------------------------------------------------
>
>                 Key: DERBY-3205
>                 URL: https://issues.apache.org/jira/browse/DERBY-3205
>             Project: Derby
>          Issue Type: Sub-task
>          Components: JDBC
>    Affects Versions: 10.4.0.0
>            Reporter: Jørgen Løland
>            Assignee: V.Narayanan
>         Attachments: derby-3205_startslave_dontcommit.diff, derby-3205_startslave_dontcommit.stat, failover_impl_3205_NotForCommit_v1.diff, failover_impl_3205_NotForCommit_v1.stat, startSlave_1a.diff, startSlave_1a.stat, StopSlave_impl_3205_NotForCommit_v1.diff, StopSlave_impl_3205_NotForCommit_v1.stat
>
>
> Add commands to start and stop the replication slave using properties or connection url. Example:
> 'jdbc:derby:<host><dbname>;startSlave=true';
> 'jdbc:derby:<host><dbname>;stopSlave=true';
> 'jdbc:derby:<host><dbname>;failover=true;
> Connection url options that must be recognized:
> startSlave=true
> stopSlave=true
> failover=true
> slaveHost=<host> (optional, defaults to localhost) (only for startSlave)
> slavePort=<port> (optional, defaults to 8001) (only for startSlave)
> See functional specification on Derby-2872 for further details.

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


[jira] Updated: (DERBY-3205) Replication: Add connection url command options for starting, stopping slave and for failover

Posted by "Jørgen Løland (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/DERBY-3205?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Jørgen Løland updated DERBY-3205:
---------------------------------

    Attachment: stopSlave_v1b.diff
                stopSlave_v1b.stat

Thanks for the quick reply, Narayanan. I included your socket close fix in stopSlave v1b, and it fixes the problem. I'm now able to unplug the socket.

Version 1b of stopSlave has the following functionality changes compared to 1a:

* Bugfix: Unplugs ServerSocket when slave is stopped
* stopMaster command shuts down the slave as well (in v1a: stopMaster did not stop slave replication)
* More error messages

To be able to shutdown the slave database when stop is requested from the master, I had to establish a connection in SlaveDatabase. The reason is that some cleanup is needed in TransactionResourceImpl, and this only happens when the thread shutting down the database has the EmbedConnectionContext.

All tests passed. The patch is ready for review.

> Replication: Add connection url command options for starting, stopping slave and for failover
> ---------------------------------------------------------------------------------------------
>
>                 Key: DERBY-3205
>                 URL: https://issues.apache.org/jira/browse/DERBY-3205
>             Project: Derby
>          Issue Type: Sub-task
>          Components: JDBC
>    Affects Versions: 10.4.0.0
>            Reporter: Jørgen Løland
>            Assignee: V.Narayanan
>         Attachments: derby-3205_startslave_dontcommit.diff, derby-3205_startslave_dontcommit.stat, failover_impl_3205_NotForCommit_v1.diff, failover_impl_3205_NotForCommit_v1.stat, failover_impl_3205_v1.diff, failover_impl_3205_v1.stat, Socket_Close_Fix_v1.diff, Socket_Close_Fix_v1.stat, startSlave_1a.diff, startSlave_1a.stat, startSlave_1b.diff, startSlave_1b.stat, startSlave_1c.diff, startSlave_1d.diff, StopSlave_impl_3205_NotForCommit_v1.diff, StopSlave_impl_3205_NotForCommit_v1.stat, stopSlave_v1a.diff, stopSlave_v1a.stat, stopSlave_v1b.diff, stopSlave_v1b.stat
>
>
> Add commands to start and stop the replication slave using properties or connection url. Example:
> 'jdbc:derby:<host><dbname>;startSlave=true';
> 'jdbc:derby:<host><dbname>;stopSlave=true';
> 'jdbc:derby:<host><dbname>;failover=true;
> Connection url options that must be recognized:
> startSlave=true
> stopSlave=true
> failover=true
> slaveHost=<host> (optional, defaults to localhost) (only for startSlave)
> slavePort=<port> (optional, defaults to 8001) (only for startSlave)
> See functional specification on Derby-2872 for further details.

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


[jira] Updated: (DERBY-3205) Replication: Add connection url command options for starting and stopping slave

Posted by "Jørgen Løland (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/DERBY-3205?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Jørgen Løland updated DERBY-3205:
---------------------------------

    Attachment: startSlave_1c.diff

startSlave v1c changes SQLState of the new exceptions to reflect changes in other patches.

> Replication: Add connection url command options for starting and stopping slave
> -------------------------------------------------------------------------------
>
>                 Key: DERBY-3205
>                 URL: https://issues.apache.org/jira/browse/DERBY-3205
>             Project: Derby
>          Issue Type: Sub-task
>          Components: JDBC
>    Affects Versions: 10.4.0.0
>            Reporter: Jørgen Løland
>            Assignee: V.Narayanan
>         Attachments: derby-3205_startslave_dontcommit.diff, derby-3205_startslave_dontcommit.stat, failover_impl_3205_NotForCommit_v1.diff, failover_impl_3205_NotForCommit_v1.stat, startSlave_1a.diff, startSlave_1a.stat, startSlave_1b.diff, startSlave_1b.stat, startSlave_1c.diff, StopSlave_impl_3205_NotForCommit_v1.diff, StopSlave_impl_3205_NotForCommit_v1.stat
>
>
> Add commands to start and stop the replication slave using properties or connection url. Example:
> 'jdbc:derby:<host><dbname>;startSlave=true';
> 'jdbc:derby:<host><dbname>;stopSlave=true';
> 'jdbc:derby:<host><dbname>;failover=true;
> Connection url options that must be recognized:
> startSlave=true
> stopSlave=true
> failover=true
> slaveHost=<host> (optional, defaults to localhost) (only for startSlave)
> slavePort=<port> (optional, defaults to 8001) (only for startSlave)
> See functional specification on Derby-2872 for further details.

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


[jira] Updated: (DERBY-3205) Replication: Add connection url command options for starting, stopping slave and for failover

Posted by "V.Narayanan (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/DERBY-3205?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

V.Narayanan updated DERBY-3205:
-------------------------------

    Attachment: failover_impl_3205_v1.stat
                failover_impl_3205_v1.diff

I have addressed the issues found in the earlier failover url.
Pls note that this patch is dependent on the failover implementation
that being done as part of Derby-3254 and will not compile without
the startFailover method introduced in 3254.

> Replication: Add connection url command options for starting, stopping slave and for failover
> ---------------------------------------------------------------------------------------------
>
>                 Key: DERBY-3205
>                 URL: https://issues.apache.org/jira/browse/DERBY-3205
>             Project: Derby
>          Issue Type: Sub-task
>          Components: JDBC
>    Affects Versions: 10.4.0.0
>            Reporter: Jørgen Løland
>            Assignee: V.Narayanan
>         Attachments: derby-3205_startslave_dontcommit.diff, derby-3205_startslave_dontcommit.stat, failover_impl_3205_NotForCommit_v1.diff, failover_impl_3205_NotForCommit_v1.stat, failover_impl_3205_v1.diff, failover_impl_3205_v1.stat, startSlave_1a.diff, startSlave_1a.stat, startSlave_1b.diff, startSlave_1b.stat, startSlave_1c.diff, startSlave_1d.diff, StopSlave_impl_3205_NotForCommit_v1.diff, StopSlave_impl_3205_NotForCommit_v1.stat
>
>
> Add commands to start and stop the replication slave using properties or connection url. Example:
> 'jdbc:derby:<host><dbname>;startSlave=true';
> 'jdbc:derby:<host><dbname>;stopSlave=true';
> 'jdbc:derby:<host><dbname>;failover=true;
> Connection url options that must be recognized:
> startSlave=true
> stopSlave=true
> failover=true
> slaveHost=<host> (optional, defaults to localhost) (only for startSlave)
> slavePort=<port> (optional, defaults to 8001) (only for startSlave)
> See functional specification on Derby-2872 for further details.

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


[jira] Updated: (DERBY-3205) Replication: Add connection url command options for starting, stopping slave and for failover

Posted by "Jørgen Løland (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/DERBY-3205?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Jørgen Løland updated DERBY-3205:
---------------------------------

    Derby Info: [Patch Available]

> Replication: Add connection url command options for starting, stopping slave and for failover
> ---------------------------------------------------------------------------------------------
>
>                 Key: DERBY-3205
>                 URL: https://issues.apache.org/jira/browse/DERBY-3205
>             Project: Derby
>          Issue Type: Sub-task
>          Components: JDBC
>    Affects Versions: 10.4.0.0
>            Reporter: Jørgen Løland
>            Assignee: V.Narayanan
>         Attachments: derby-3205_startslave_dontcommit.diff, derby-3205_startslave_dontcommit.stat, failover_impl_3205_NotForCommit_v1.diff, failover_impl_3205_NotForCommit_v1.stat, failover_impl_3205_v1.diff, failover_impl_3205_v1.stat, startSlave_1a.diff, startSlave_1a.stat, startSlave_1b.diff, startSlave_1b.stat, startSlave_1c.diff, startSlave_1d.diff, StopSlave_impl_3205_NotForCommit_v1.diff, StopSlave_impl_3205_NotForCommit_v1.stat, stopSlave_v1a.diff, stopSlave_v1a.stat
>
>
> Add commands to start and stop the replication slave using properties or connection url. Example:
> 'jdbc:derby:<host><dbname>;startSlave=true';
> 'jdbc:derby:<host><dbname>;stopSlave=true';
> 'jdbc:derby:<host><dbname>;failover=true;
> Connection url options that must be recognized:
> startSlave=true
> stopSlave=true
> failover=true
> slaveHost=<host> (optional, defaults to localhost) (only for startSlave)
> slavePort=<port> (optional, defaults to 8001) (only for startSlave)
> See functional specification on Derby-2872 for further details.

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


[jira] Updated: (DERBY-3205) Replication: Add connection url command options for starting and stopping slave

Posted by "V.Narayanan (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/DERBY-3205?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

V.Narayanan updated DERBY-3205:
-------------------------------

    Derby Info: [Patch Available]

> Replication: Add connection url command options for starting and stopping slave
> -------------------------------------------------------------------------------
>
>                 Key: DERBY-3205
>                 URL: https://issues.apache.org/jira/browse/DERBY-3205
>             Project: Derby
>          Issue Type: Sub-task
>          Components: JDBC
>    Affects Versions: 10.4.0.0
>            Reporter: Jørgen Løland
>            Assignee: V.Narayanan
>         Attachments: derby-3205_startslave_dontcommit.diff, derby-3205_startslave_dontcommit.stat, failover_impl_3205_NotForCommit_v1.diff, failover_impl_3205_NotForCommit_v1.stat, StopSlave_impl_3205_NotForCommit_v1.diff, StopSlave_impl_3205_NotForCommit_v1.stat
>
>
> Add commands to start and stop the replication slave using properties or connection url. Example:
> 'jdbc:derby:<host><dbname>;startSlave=true';
> 'jdbc:derby:<host><dbname>;stopSlave=true';
> 'jdbc:derby:<host><dbname>;failover=true;
> Connection url options that must be recognized:
> startSlave=true
> stopSlave=true
> failover=true
> slaveHost=<host> (optional, defaults to localhost) (only for startSlave)
> slavePort=<port> (optional, defaults to 8001) (only for startSlave)
> See functional specification on Derby-2872 for further details.

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


[jira] Commented: (DERBY-3205) Replication: Add connection url command options for starting and stopping slave

Posted by "Jørgen Løland (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/DERBY-3205?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12556838#action_12556838 ] 

Jørgen Løland commented on DERBY-3205:
--------------------------------------

I had a look at the stopSlave and failover v1 patch.  A few comments:

You cannot get a connection to a database in replication slave mode. This implies that:

1) (I have not tried it, but...) I think the new method EmbedConnection#handleStopReplicationSlave will not work because the call to getLanguageConnection() will throw an exception (cannot connect...). See DERBY-2872 discussion and funcspec for more details why authorization cannot be performed on a database in slave mode.

2) Since you cannot get a connection to the database, tr.getDatabase().<method> will not work. The stopSlave command must be handed to the slave database through connect, i.e. by setting a value in the Properties object and calling tr.getDatabase(). Instead of tr.getDatabase().stopReplicationSlave(), you need to do:

p.setProperty(SlaveFactory.REPLICATION_MODE, SlaveFactory.STOP);
tr.getDatabase();

And in SlaveDatabase.setupConnection, you will need:

String isStop = p.getProperty(SlaveFactory.REPLICATION_MODE);
if (isStop.equals(SlaveFactory.STOP)) {
  slaveFac.stopReplicationSlave();
}

> Replication: Add connection url command options for starting and stopping slave
> -------------------------------------------------------------------------------
>
>                 Key: DERBY-3205
>                 URL: https://issues.apache.org/jira/browse/DERBY-3205
>             Project: Derby
>          Issue Type: Sub-task
>          Components: JDBC
>    Affects Versions: 10.4.0.0
>            Reporter: Jørgen Løland
>            Assignee: V.Narayanan
>         Attachments: derby-3205_startslave_dontcommit.diff, derby-3205_startslave_dontcommit.stat, failover_impl_3205_NotForCommit_v1.diff, failover_impl_3205_NotForCommit_v1.stat, startSlave_1a.diff, startSlave_1a.stat, StopSlave_impl_3205_NotForCommit_v1.diff, StopSlave_impl_3205_NotForCommit_v1.stat
>
>
> Add commands to start and stop the replication slave using properties or connection url. Example:
> 'jdbc:derby:<host><dbname>;startSlave=true';
> 'jdbc:derby:<host><dbname>;stopSlave=true';
> 'jdbc:derby:<host><dbname>;failover=true;
> Connection url options that must be recognized:
> startSlave=true
> stopSlave=true
> failover=true
> slaveHost=<host> (optional, defaults to localhost) (only for startSlave)
> slavePort=<port> (optional, defaults to 8001) (only for startSlave)
> See functional specification on Derby-2872 for further details.

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


[jira] Commented: (DERBY-3205) Replication: Add connection url command options for starting, stopping slave and for failover

Posted by "V.Narayanan (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/DERBY-3205?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12560786#action_12560786 ] 

V.Narayanan commented on DERBY-3205:
------------------------------------

I have been trying to integrate the preliminary failover patch here and the failover
implementation patch submitted as part of Derby-3254 and I found a few issues in
both patches.

1) The patch  failover_impl_3205_NotForCommit_v1.diff needs to use Monitor#findServiceModule
     instead of Monitor#bootServiceModule in RawStore#failover().

I shall enumerate the issues found in the failover implementation in the jira for that issue.



> Replication: Add connection url command options for starting, stopping slave and for failover
> ---------------------------------------------------------------------------------------------
>
>                 Key: DERBY-3205
>                 URL: https://issues.apache.org/jira/browse/DERBY-3205
>             Project: Derby
>          Issue Type: Sub-task
>          Components: JDBC
>    Affects Versions: 10.4.0.0
>            Reporter: Jørgen Løland
>            Assignee: V.Narayanan
>         Attachments: derby-3205_startslave_dontcommit.diff, derby-3205_startslave_dontcommit.stat, failover_impl_3205_NotForCommit_v1.diff, failover_impl_3205_NotForCommit_v1.stat, startSlave_1a.diff, startSlave_1a.stat, startSlave_1b.diff, startSlave_1b.stat, startSlave_1c.diff, startSlave_1d.diff, StopSlave_impl_3205_NotForCommit_v1.diff, StopSlave_impl_3205_NotForCommit_v1.stat
>
>
> Add commands to start and stop the replication slave using properties or connection url. Example:
> 'jdbc:derby:<host><dbname>;startSlave=true';
> 'jdbc:derby:<host><dbname>;stopSlave=true';
> 'jdbc:derby:<host><dbname>;failover=true;
> Connection url options that must be recognized:
> startSlave=true
> stopSlave=true
> failover=true
> slaveHost=<host> (optional, defaults to localhost) (only for startSlave)
> slavePort=<port> (optional, defaults to 8001) (only for startSlave)
> See functional specification on Derby-2872 for further details.

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


[jira] Resolved: (DERBY-3205) Replication: Add connection url command options for starting, stopping slave and for failover

Posted by "Jørgen Løland (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/DERBY-3205?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Jørgen Løland resolved DERBY-3205.
----------------------------------

       Resolution: Fixed
    Fix Version/s: 10.4.0.0

All issues on this jira have been addressed. 

> Replication: Add connection url command options for starting, stopping slave and for failover
> ---------------------------------------------------------------------------------------------
>
>                 Key: DERBY-3205
>                 URL: https://issues.apache.org/jira/browse/DERBY-3205
>             Project: Derby
>          Issue Type: Sub-task
>          Components: JDBC
>    Affects Versions: 10.4.0.0
>            Reporter: Jørgen Løland
>            Assignee: Jørgen Løland
>             Fix For: 10.4.0.0
>
>         Attachments: derby-3205_startslave_dontcommit.diff, derby-3205_startslave_dontcommit.stat, failover-slave-1a.diff, failover-slave-1a.stat, failover-slave-2a.diff, failover-slave-2a.stat, failover-slave-2b.diff, failover_impl_3205_NotForCommit_v1.diff, failover_impl_3205_NotForCommit_v1.stat, failover_impl_3205_v1.diff, failover_impl_3205_v1.stat, failover_impl_3205_v2.diff, failover_impl_3205_v2.stat, failover_impl_3205_v3.diff, failover_impl_3205_v3.stat, failover_impl_3205_v4.diff, failover_impl_3205_v4.stat, Socket_Close_Fix_v1.diff, Socket_Close_Fix_v1.stat, startSlave_1a.diff, startSlave_1a.stat, startSlave_1b.diff, startSlave_1b.stat, startSlave_1c.diff, startSlave_1d.diff, StopSlave_impl_3205_NotForCommit_v1.diff, StopSlave_impl_3205_NotForCommit_v1.stat, stopSlave_v1a.diff, stopSlave_v1a.stat, stopSlave_v1b.diff, stopSlave_v1b.stat, stopSlave_v1c.diff, stopSlave_v1c.stat
>
>
> Add commands to start and stop the replication slave using properties or connection url. Example:
> 'jdbc:derby:<host><dbname>;startSlave=true';
> 'jdbc:derby:<host><dbname>;stopSlave=true';
> 'jdbc:derby:<host><dbname>;failover=true;
> Connection url options that must be recognized:
> startSlave=true
> stopSlave=true
> failover=true
> slaveHost=<host> (optional, defaults to localhost) (only for startSlave)
> slavePort=<port> (optional, defaults to 8001) (only for startSlave)
> See functional specification on Derby-2872 for further details.

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


[jira] Updated: (DERBY-3205) Replication: Add connection url command options for starting, stopping slave and for failover

Posted by "V.Narayanan (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/DERBY-3205?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

V.Narayanan updated DERBY-3205:
-------------------------------

    Attachment: Socket_Close_Fix_v1.stat
                Socket_Close_Fix_v1.diff

You are right in your observation Jorgen. I have attached a patch here that adds this new functionality. Pls feel free to use it for the patch you are working on. 

> Replication: Add connection url command options for starting, stopping slave and for failover
> ---------------------------------------------------------------------------------------------
>
>                 Key: DERBY-3205
>                 URL: https://issues.apache.org/jira/browse/DERBY-3205
>             Project: Derby
>          Issue Type: Sub-task
>          Components: JDBC
>    Affects Versions: 10.4.0.0
>            Reporter: Jørgen Løland
>            Assignee: V.Narayanan
>         Attachments: derby-3205_startslave_dontcommit.diff, derby-3205_startslave_dontcommit.stat, failover_impl_3205_NotForCommit_v1.diff, failover_impl_3205_NotForCommit_v1.stat, failover_impl_3205_v1.diff, failover_impl_3205_v1.stat, Socket_Close_Fix_v1.diff, Socket_Close_Fix_v1.stat, startSlave_1a.diff, startSlave_1a.stat, startSlave_1b.diff, startSlave_1b.stat, startSlave_1c.diff, startSlave_1d.diff, StopSlave_impl_3205_NotForCommit_v1.diff, StopSlave_impl_3205_NotForCommit_v1.stat, stopSlave_v1a.diff, stopSlave_v1a.stat
>
>
> Add commands to start and stop the replication slave using properties or connection url. Example:
> 'jdbc:derby:<host><dbname>;startSlave=true';
> 'jdbc:derby:<host><dbname>;stopSlave=true';
> 'jdbc:derby:<host><dbname>;failover=true;
> Connection url options that must be recognized:
> startSlave=true
> stopSlave=true
> failover=true
> slaveHost=<host> (optional, defaults to localhost) (only for startSlave)
> slavePort=<port> (optional, defaults to 8001) (only for startSlave)
> See functional specification on Derby-2872 for further details.

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


[jira] Commented: (DERBY-3205) Replication: Add connection url command options for starting, stopping slave and for failover

Posted by "V.Narayanan (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/DERBY-3205?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12565312#action_12565312 ] 

V.Narayanan commented on DERBY-3205:
------------------------------------

>a. Exception javadocs: A missing comment after "If the failover
>      succeeds" 

Are you pointing out these diffs

-     * @throws StandardException 1) If the failover succeeds
+     * @throws StandardException 1) If the failover succeeds an exception is
+     *                              thrown to indicate that the master database
+     *                              was shutdown after a successful failover

There is a '-' sign before the first line which is being replaced by the second
lines with the '+' lines. The lines with the '+' lines are complete.

Do you see a place in the patch where I have not replaced the original one
liner with the better and more complete comment?

> Replication: Add connection url command options for starting, stopping slave and for failover
> ---------------------------------------------------------------------------------------------
>
>                 Key: DERBY-3205
>                 URL: https://issues.apache.org/jira/browse/DERBY-3205
>             Project: Derby
>          Issue Type: Sub-task
>          Components: JDBC
>    Affects Versions: 10.4.0.0
>            Reporter: Jørgen Løland
>            Assignee: V.Narayanan
>         Attachments: derby-3205_startslave_dontcommit.diff, derby-3205_startslave_dontcommit.stat, failover_impl_3205_NotForCommit_v1.diff, failover_impl_3205_NotForCommit_v1.stat, failover_impl_3205_v1.diff, failover_impl_3205_v1.stat, failover_impl_3205_v2.diff, failover_impl_3205_v2.stat, failover_impl_3205_v3.diff, failover_impl_3205_v3.stat, Socket_Close_Fix_v1.diff, Socket_Close_Fix_v1.stat, startSlave_1a.diff, startSlave_1a.stat, startSlave_1b.diff, startSlave_1b.stat, startSlave_1c.diff, startSlave_1d.diff, StopSlave_impl_3205_NotForCommit_v1.diff, StopSlave_impl_3205_NotForCommit_v1.stat, stopSlave_v1a.diff, stopSlave_v1a.stat, stopSlave_v1b.diff, stopSlave_v1b.stat, stopSlave_v1c.diff, stopSlave_v1c.stat
>
>
> Add commands to start and stop the replication slave using properties or connection url. Example:
> 'jdbc:derby:<host><dbname>;startSlave=true';
> 'jdbc:derby:<host><dbname>;stopSlave=true';
> 'jdbc:derby:<host><dbname>;failover=true;
> Connection url options that must be recognized:
> startSlave=true
> stopSlave=true
> failover=true
> slaveHost=<host> (optional, defaults to localhost) (only for startSlave)
> slavePort=<port> (optional, defaults to 8001) (only for startSlave)
> See functional specification on Derby-2872 for further details.

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


[jira] Commented: (DERBY-3205) Replication: Add connection url command options for starting and stopping slave

Posted by "Jørgen Løland (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/DERBY-3205?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12542749 ] 

Jørgen Løland commented on DERBY-3205:
--------------------------------------

This issue is meant to handle the aforementioned start/stop commands *after* the database has been copied to the correct slave location. An issue for copying the database over the master/slave network connection will be added later.

I played a bit with startSlave in the proof of concept code. Using a "two phase" login like in encrypt database seems like a good plan since we need to authenticate and authorize users starting the slave replication behavior (if these security measures are turned on). A quick and dirty implementation of the plan below seems to work fine in the proof of concept code:

EmbedConnection#<init> 
if (isReplicationSlaveStart == true)
1) boot database with Property value REPLICATION_MODE=PRE_SLAVE_MODE set (property not in codeline yet). This ensures that LogToFile does not write anything to the log files (very important!! Functionality not in codeline yet)
2) authenticate user with the booted database. 
3) shut the database down
4) boot the database with Property value REPLICATION_MODE=SLAVE_MODE set (property already in the codeline). This ensures that the slave replication functionality is booted, and that the logging system does not leave LogToFile#recover() (functionality already in codeline)

> Replication: Add connection url command options for starting and stopping slave
> -------------------------------------------------------------------------------
>
>                 Key: DERBY-3205
>                 URL: https://issues.apache.org/jira/browse/DERBY-3205
>             Project: Derby
>          Issue Type: Sub-task
>          Components: JDBC
>    Affects Versions: 10.4.0.0
>            Reporter: Jørgen Løland
>
> Add commands to start and stop the replication slave using properties or connection url. Example:
> 'jdbc:derby:<host><dbname>;startSlave=true';
> 'jdbc:derby:<host><dbname>;stopSlave=true';
> 'jdbc:derby:<host><dbname>;failover=true;
> Connection url options that must be recognized:
> startSlave=true
> stopSlave=true
> failover=true
> slaveHost=<host> (optional, defaults to localhost) (only for startSlave)
> slavePort=<port> (optional, defaults to 8001) (only for startSlave)
> See functional specification on Derby-2872 for further details.

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


[jira] Commented: (DERBY-3205) Replication: Add connection url command options for starting, stopping slave and for failover

Posted by "Jørgen Løland (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/DERBY-3205?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12574370#action_12574370 ] 

Jørgen Løland commented on DERBY-3205:
--------------------------------------

All tests passed for patch failover slave 2b.

> Replication: Add connection url command options for starting, stopping slave and for failover
> ---------------------------------------------------------------------------------------------
>
>                 Key: DERBY-3205
>                 URL: https://issues.apache.org/jira/browse/DERBY-3205
>             Project: Derby
>          Issue Type: Sub-task
>          Components: JDBC
>    Affects Versions: 10.4.0.0
>            Reporter: Jørgen Løland
>            Assignee: Jørgen Løland
>         Attachments: derby-3205_startslave_dontcommit.diff, derby-3205_startslave_dontcommit.stat, failover-slave-1a.diff, failover-slave-1a.stat, failover-slave-2a.diff, failover-slave-2a.stat, failover-slave-2b.diff, failover_impl_3205_NotForCommit_v1.diff, failover_impl_3205_NotForCommit_v1.stat, failover_impl_3205_v1.diff, failover_impl_3205_v1.stat, failover_impl_3205_v2.diff, failover_impl_3205_v2.stat, failover_impl_3205_v3.diff, failover_impl_3205_v3.stat, failover_impl_3205_v4.diff, failover_impl_3205_v4.stat, Socket_Close_Fix_v1.diff, Socket_Close_Fix_v1.stat, startSlave_1a.diff, startSlave_1a.stat, startSlave_1b.diff, startSlave_1b.stat, startSlave_1c.diff, startSlave_1d.diff, StopSlave_impl_3205_NotForCommit_v1.diff, StopSlave_impl_3205_NotForCommit_v1.stat, stopSlave_v1a.diff, stopSlave_v1a.stat, stopSlave_v1b.diff, stopSlave_v1b.stat, stopSlave_v1c.diff, stopSlave_v1c.stat
>
>
> Add commands to start and stop the replication slave using properties or connection url. Example:
> 'jdbc:derby:<host><dbname>;startSlave=true';
> 'jdbc:derby:<host><dbname>;stopSlave=true';
> 'jdbc:derby:<host><dbname>;failover=true;
> Connection url options that must be recognized:
> startSlave=true
> stopSlave=true
> failover=true
> slaveHost=<host> (optional, defaults to localhost) (only for startSlave)
> slavePort=<port> (optional, defaults to 8001) (only for startSlave)
> See functional specification on Derby-2872 for further details.

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


[jira] Commented: (DERBY-3205) Replication: Add connection url command options for starting, stopping slave and for failover

Posted by "Øystein Grøvlen (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/DERBY-3205?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12564686#action_12564686 ] 

Øystein Grøvlen commented on DERBY-3205:
----------------------------------------

Thanks for the patch, Jørgen.  It looks good, and most of my comments
are minor.  If you like, I can  commit the current version of the
patch, and you can handle my comments in a follow-up patch.

To my comments:

1. EmbedConnection: 

   a. handleDBNotFound(): The comment "the finally clause below" is
      not right anymore.  Also, the finally clause referred to is only
      in one of the calling methods.

   b. handleStopReplicationSlave(): The two cases makes me wonder
      whether this should rather be two methods.  Javadoc:  "call case
      2)" sounds a bit strange.  The case 2) description ends with an
      incomplete sentence.

2. SlaveDatabase:

   a. Unused imports of MessageId and ReplicationLogger

   b. Does not slaveFac need to be volatile?  The synchronization in
      setSlaveFactory() does not seem to be of any help since other
      access is not synchronized.

   c. stop():  I would like a comment explaining when and for what
      purpose this method is called.

   d. verifyShutdownSlave(): Why does this method need to be
      synchronized when shutdownInitiated is volatile?

   e. handleShutdown(): Seems a bit strange to use the external JDBC
      API in an internal class.  Is there not some method that can be
      called to shut down a Database directly?  If doing this at JDBC
      level, I wonder whether it would be better use
      EmbeddedDataSource instead of using the DriverManager.

3. SlaveController:

   a. When I experiment with stopSlave, I see that the slave shutdown
      message is written to derby.log twice.  I have not looked into
      why, but I think once should be sufficient :-)

   b. stop(): Javadoc says that this should be called after either
      stopSlave and failover, but I think this method is used by
      Monitor when stopping the services of a system, and I am not
      sure you can control the shutdown sequence for the services.

   c. startSlave(): The assumption that if it is not LogToFile, it
      must be ReadOnly is right today.  However, this assumption makes
      the code brittle since it is will be hard to detect for people
      that want to add new implementations of LogFactory.

   d. stopSlave(): Javadoc still says it is not implemented yet.

   e. stopSlave(boolean): Javadoc: "database system shutdown".  Do you
      mean the shutdown of this database, or the entire system by this
      term.  For the explanation of forceStop, I would rather say that
      "if true, the slave will be shut down even if connected to the
      master", or something.  (Note: Same javadoc in SlaveFactory.
      Maybe you should consider to use @see instead?)

4. LogToFile: 

   a. AFAICT when the slave is stopped, recovery thread will complete
      the redo of the current log file before stopping.  Is that
      intentional?

   b. stopReplicationSlaveMode() and stopReplicationSlaveRole() is
      confusingly similar names.  At least, it confused me.  I am not
      sure of the distinction between mode and role here, and but I do
      not think the names reflect that the first causes the slave to
      stop while the latter causes it to do failover.

5. messages:

   a. Generally, it seems like the names of several of the SQLState
      constants are more general that the associated text.  That can
      lead people to reuse constants when the message is not really
      appropriate.

   b. XRE40: Would it be an idea to mention the database name here?

   c. XRE41: Maybe the message could say more explicitly that the
      operation was requested on a slave database.

   d. XRE43: First sentence is general, but the second sentence seems
      to assume a very specific context.
      


> Replication: Add connection url command options for starting, stopping slave and for failover
> ---------------------------------------------------------------------------------------------
>
>                 Key: DERBY-3205
>                 URL: https://issues.apache.org/jira/browse/DERBY-3205
>             Project: Derby
>          Issue Type: Sub-task
>          Components: JDBC
>    Affects Versions: 10.4.0.0
>            Reporter: Jørgen Løland
>            Assignee: V.Narayanan
>         Attachments: derby-3205_startslave_dontcommit.diff, derby-3205_startslave_dontcommit.stat, failover_impl_3205_NotForCommit_v1.diff, failover_impl_3205_NotForCommit_v1.stat, failover_impl_3205_v1.diff, failover_impl_3205_v1.stat, failover_impl_3205_v2.diff, failover_impl_3205_v2.stat, Socket_Close_Fix_v1.diff, Socket_Close_Fix_v1.stat, startSlave_1a.diff, startSlave_1a.stat, startSlave_1b.diff, startSlave_1b.stat, startSlave_1c.diff, startSlave_1d.diff, StopSlave_impl_3205_NotForCommit_v1.diff, StopSlave_impl_3205_NotForCommit_v1.stat, stopSlave_v1a.diff, stopSlave_v1a.stat, stopSlave_v1b.diff, stopSlave_v1b.stat
>
>
> Add commands to start and stop the replication slave using properties or connection url. Example:
> 'jdbc:derby:<host><dbname>;startSlave=true';
> 'jdbc:derby:<host><dbname>;stopSlave=true';
> 'jdbc:derby:<host><dbname>;failover=true;
> Connection url options that must be recognized:
> startSlave=true
> stopSlave=true
> failover=true
> slaveHost=<host> (optional, defaults to localhost) (only for startSlave)
> slavePort=<port> (optional, defaults to 8001) (only for startSlave)
> See functional specification on Derby-2872 for further details.

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


[jira] Updated: (DERBY-3205) Replication: Add connection url command options for starting, stopping slave and for failover

Posted by "Jørgen Løland (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/DERBY-3205?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Jørgen Løland updated DERBY-3205:
---------------------------------

    Attachment: failover-slave-1a.diff
                failover-slave-1a.stat

The attached patch, failover-slave-1a, adds failover functionality to the slave-side. I have not found the proper way to remove the SlaveFactory module from the Monitor after a failover, so I'll leave that task to a follow-up patch. Request for review.

> Replication: Add connection url command options for starting, stopping slave and for failover
> ---------------------------------------------------------------------------------------------
>
>                 Key: DERBY-3205
>                 URL: https://issues.apache.org/jira/browse/DERBY-3205
>             Project: Derby
>          Issue Type: Sub-task
>          Components: JDBC
>    Affects Versions: 10.4.0.0
>            Reporter: Jørgen Løland
>            Assignee: Jørgen Løland
>         Attachments: derby-3205_startslave_dontcommit.diff, derby-3205_startslave_dontcommit.stat, failover-slave-1a.diff, failover-slave-1a.stat, failover_impl_3205_NotForCommit_v1.diff, failover_impl_3205_NotForCommit_v1.stat, failover_impl_3205_v1.diff, failover_impl_3205_v1.stat, failover_impl_3205_v2.diff, failover_impl_3205_v2.stat, failover_impl_3205_v3.diff, failover_impl_3205_v3.stat, failover_impl_3205_v4.diff, failover_impl_3205_v4.stat, Socket_Close_Fix_v1.diff, Socket_Close_Fix_v1.stat, startSlave_1a.diff, startSlave_1a.stat, startSlave_1b.diff, startSlave_1b.stat, startSlave_1c.diff, startSlave_1d.diff, StopSlave_impl_3205_NotForCommit_v1.diff, StopSlave_impl_3205_NotForCommit_v1.stat, stopSlave_v1a.diff, stopSlave_v1a.stat, stopSlave_v1b.diff, stopSlave_v1b.stat, stopSlave_v1c.diff, stopSlave_v1c.stat
>
>
> Add commands to start and stop the replication slave using properties or connection url. Example:
> 'jdbc:derby:<host><dbname>;startSlave=true';
> 'jdbc:derby:<host><dbname>;stopSlave=true';
> 'jdbc:derby:<host><dbname>;failover=true;
> Connection url options that must be recognized:
> startSlave=true
> stopSlave=true
> failover=true
> slaveHost=<host> (optional, defaults to localhost) (only for startSlave)
> slavePort=<port> (optional, defaults to 8001) (only for startSlave)
> See functional specification on Derby-2872 for further details.

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


[jira] Commented: (DERBY-3205) Replication: Add connection url command options for starting, stopping slave and for failover

Posted by "V.Narayanan (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/DERBY-3205?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12565313#action_12565313 ] 

V.Narayanan commented on DERBY-3205:
------------------------------------

>b. I think you could use @see a bit more instead of repeating the
>      javadoc. Makes it less brittle if the behavior changes.

I need to change the whole gamut of call propagations to change this
in this patch now. (which incidentally is the very reason you are asking
me to do this change :-D)

But, can you please  allow me to do this as a follow-up?


> Replication: Add connection url command options for starting, stopping slave and for failover
> ---------------------------------------------------------------------------------------------
>
>                 Key: DERBY-3205
>                 URL: https://issues.apache.org/jira/browse/DERBY-3205
>             Project: Derby
>          Issue Type: Sub-task
>          Components: JDBC
>    Affects Versions: 10.4.0.0
>            Reporter: Jørgen Løland
>            Assignee: V.Narayanan
>         Attachments: derby-3205_startslave_dontcommit.diff, derby-3205_startslave_dontcommit.stat, failover_impl_3205_NotForCommit_v1.diff, failover_impl_3205_NotForCommit_v1.stat, failover_impl_3205_v1.diff, failover_impl_3205_v1.stat, failover_impl_3205_v2.diff, failover_impl_3205_v2.stat, failover_impl_3205_v3.diff, failover_impl_3205_v3.stat, Socket_Close_Fix_v1.diff, Socket_Close_Fix_v1.stat, startSlave_1a.diff, startSlave_1a.stat, startSlave_1b.diff, startSlave_1b.stat, startSlave_1c.diff, startSlave_1d.diff, StopSlave_impl_3205_NotForCommit_v1.diff, StopSlave_impl_3205_NotForCommit_v1.stat, stopSlave_v1a.diff, stopSlave_v1a.stat, stopSlave_v1b.diff, stopSlave_v1b.stat, stopSlave_v1c.diff, stopSlave_v1c.stat
>
>
> Add commands to start and stop the replication slave using properties or connection url. Example:
> 'jdbc:derby:<host><dbname>;startSlave=true';
> 'jdbc:derby:<host><dbname>;stopSlave=true';
> 'jdbc:derby:<host><dbname>;failover=true;
> Connection url options that must be recognized:
> startSlave=true
> stopSlave=true
> failover=true
> slaveHost=<host> (optional, defaults to localhost) (only for startSlave)
> slavePort=<port> (optional, defaults to 8001) (only for startSlave)
> See functional specification on Derby-2872 for further details.

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


[jira] Updated: (DERBY-3205) Replication: Add connection url command options for starting, stopping slave and for failover

Posted by "Jørgen Løland (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/DERBY-3205?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Jørgen Løland updated DERBY-3205:
---------------------------------

    Attachment: failover-slave-2b.diff

Thanks for reviewing the patch, Øystein

The security exception can be thrown if SecurityManager is used. But according to the API and some testing, you cannot interrupt a thread listening to a stream on a Socket. Hence, the interrupt does not have any effect unless we decide to use an InterruptableChannel instead of a plain Socket. In patch v2b, I simply removed the interrupt. In testing, the log receiver thread consistently gets an EOFException when teardownNetwork is called. Will report back with test results.

> Replication: Add connection url command options for starting, stopping slave and for failover
> ---------------------------------------------------------------------------------------------
>
>                 Key: DERBY-3205
>                 URL: https://issues.apache.org/jira/browse/DERBY-3205
>             Project: Derby
>          Issue Type: Sub-task
>          Components: JDBC
>    Affects Versions: 10.4.0.0
>            Reporter: Jørgen Løland
>            Assignee: Jørgen Løland
>         Attachments: derby-3205_startslave_dontcommit.diff, derby-3205_startslave_dontcommit.stat, failover-slave-1a.diff, failover-slave-1a.stat, failover-slave-2a.diff, failover-slave-2a.stat, failover-slave-2b.diff, failover_impl_3205_NotForCommit_v1.diff, failover_impl_3205_NotForCommit_v1.stat, failover_impl_3205_v1.diff, failover_impl_3205_v1.stat, failover_impl_3205_v2.diff, failover_impl_3205_v2.stat, failover_impl_3205_v3.diff, failover_impl_3205_v3.stat, failover_impl_3205_v4.diff, failover_impl_3205_v4.stat, Socket_Close_Fix_v1.diff, Socket_Close_Fix_v1.stat, startSlave_1a.diff, startSlave_1a.stat, startSlave_1b.diff, startSlave_1b.stat, startSlave_1c.diff, startSlave_1d.diff, StopSlave_impl_3205_NotForCommit_v1.diff, StopSlave_impl_3205_NotForCommit_v1.stat, stopSlave_v1a.diff, stopSlave_v1a.stat, stopSlave_v1b.diff, stopSlave_v1b.stat, stopSlave_v1c.diff, stopSlave_v1c.stat
>
>
> Add commands to start and stop the replication slave using properties or connection url. Example:
> 'jdbc:derby:<host><dbname>;startSlave=true';
> 'jdbc:derby:<host><dbname>;stopSlave=true';
> 'jdbc:derby:<host><dbname>;failover=true;
> Connection url options that must be recognized:
> startSlave=true
> stopSlave=true
> failover=true
> slaveHost=<host> (optional, defaults to localhost) (only for startSlave)
> slavePort=<port> (optional, defaults to 8001) (only for startSlave)
> See functional specification on Derby-2872 for further details.

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


[jira] Updated: (DERBY-3205) Replication: Add connection url command options for starting and stopping slave

Posted by "Jørgen Løland (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/DERBY-3205?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Jørgen Løland updated DERBY-3205:
---------------------------------

    Attachment: startSlave_1d.diff

Hi Øystein, 

Thanks for reviewing the patch. The attached patch is improved over the last one in the following ways:

* Removes duplication of code by wiring in on the other two phase boot code in EmbedConnection
* Shuts down the database after the first boot if authentication fails, which means you will be able to retry startSlave with other credentials

And regarding two Attribute.java file - I have no idea why there are two of them. Maybe one could be removed?

> Replication: Add connection url command options for starting and stopping slave
> -------------------------------------------------------------------------------
>
>                 Key: DERBY-3205
>                 URL: https://issues.apache.org/jira/browse/DERBY-3205
>             Project: Derby
>          Issue Type: Sub-task
>          Components: JDBC
>    Affects Versions: 10.4.0.0
>            Reporter: Jørgen Løland
>            Assignee: V.Narayanan
>         Attachments: derby-3205_startslave_dontcommit.diff, derby-3205_startslave_dontcommit.stat, failover_impl_3205_NotForCommit_v1.diff, failover_impl_3205_NotForCommit_v1.stat, startSlave_1a.diff, startSlave_1a.stat, startSlave_1b.diff, startSlave_1b.stat, startSlave_1c.diff, startSlave_1d.diff, StopSlave_impl_3205_NotForCommit_v1.diff, StopSlave_impl_3205_NotForCommit_v1.stat
>
>
> Add commands to start and stop the replication slave using properties or connection url. Example:
> 'jdbc:derby:<host><dbname>;startSlave=true';
> 'jdbc:derby:<host><dbname>;stopSlave=true';
> 'jdbc:derby:<host><dbname>;failover=true;
> Connection url options that must be recognized:
> startSlave=true
> stopSlave=true
> failover=true
> slaveHost=<host> (optional, defaults to localhost) (only for startSlave)
> slavePort=<port> (optional, defaults to 8001) (only for startSlave)
> See functional specification on Derby-2872 for further details.

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


[jira] Commented: (DERBY-3205) Replication: Add connection url command options for starting, stopping slave and for failover

Posted by "Øystein Grøvlen (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/DERBY-3205?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12565343#action_12565343 ] 

Øystein Grøvlen commented on DERBY-3205:
----------------------------------------

If I do failover on a database where replication has not been started, I get the following:

ij version 10.4
ij> connect 'jdbc:derby:masterDB;user=oystein;password=pass';
ij> connect 'jdbc:derby:masterDB;user=oystein;password=pass;failover=true';
ERROR XRE21: Error occurred while performing failover for database 'masterDB', Failover attempt was aborted.

I think I should rather get an error that says that database is not being replicated.  (I get that if I try to stop replication on a non-replicated database).





> Replication: Add connection url command options for starting, stopping slave and for failover
> ---------------------------------------------------------------------------------------------
>
>                 Key: DERBY-3205
>                 URL: https://issues.apache.org/jira/browse/DERBY-3205
>             Project: Derby
>          Issue Type: Sub-task
>          Components: JDBC
>    Affects Versions: 10.4.0.0
>            Reporter: Jørgen Løland
>            Assignee: V.Narayanan
>         Attachments: derby-3205_startslave_dontcommit.diff, derby-3205_startslave_dontcommit.stat, failover_impl_3205_NotForCommit_v1.diff, failover_impl_3205_NotForCommit_v1.stat, failover_impl_3205_v1.diff, failover_impl_3205_v1.stat, failover_impl_3205_v2.diff, failover_impl_3205_v2.stat, failover_impl_3205_v3.diff, failover_impl_3205_v3.stat, Socket_Close_Fix_v1.diff, Socket_Close_Fix_v1.stat, startSlave_1a.diff, startSlave_1a.stat, startSlave_1b.diff, startSlave_1b.stat, startSlave_1c.diff, startSlave_1d.diff, StopSlave_impl_3205_NotForCommit_v1.diff, StopSlave_impl_3205_NotForCommit_v1.stat, stopSlave_v1a.diff, stopSlave_v1a.stat, stopSlave_v1b.diff, stopSlave_v1b.stat, stopSlave_v1c.diff, stopSlave_v1c.stat
>
>
> Add commands to start and stop the replication slave using properties or connection url. Example:
> 'jdbc:derby:<host><dbname>;startSlave=true';
> 'jdbc:derby:<host><dbname>;stopSlave=true';
> 'jdbc:derby:<host><dbname>;failover=true;
> Connection url options that must be recognized:
> startSlave=true
> stopSlave=true
> failover=true
> slaveHost=<host> (optional, defaults to localhost) (only for startSlave)
> slavePort=<port> (optional, defaults to 8001) (only for startSlave)
> See functional specification on Derby-2872 for further details.

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


[jira] Commented: (DERBY-3205) Replication: Add connection url command options for starting, stopping slave and for failover

Posted by "Øystein Grøvlen (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/DERBY-3205?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12565732#action_12565732 ] 

Øystein Grøvlen commented on DERBY-3205:
----------------------------------------

Committed v4 of the failover patch as revision 618632.  Thanks for the good work, Narayanan.

> Replication: Add connection url command options for starting, stopping slave and for failover
> ---------------------------------------------------------------------------------------------
>
>                 Key: DERBY-3205
>                 URL: https://issues.apache.org/jira/browse/DERBY-3205
>             Project: Derby
>          Issue Type: Sub-task
>          Components: JDBC
>    Affects Versions: 10.4.0.0
>            Reporter: Jørgen Løland
>            Assignee: V.Narayanan
>         Attachments: derby-3205_startslave_dontcommit.diff, derby-3205_startslave_dontcommit.stat, failover_impl_3205_NotForCommit_v1.diff, failover_impl_3205_NotForCommit_v1.stat, failover_impl_3205_v1.diff, failover_impl_3205_v1.stat, failover_impl_3205_v2.diff, failover_impl_3205_v2.stat, failover_impl_3205_v3.diff, failover_impl_3205_v3.stat, failover_impl_3205_v4.diff, failover_impl_3205_v4.stat, Socket_Close_Fix_v1.diff, Socket_Close_Fix_v1.stat, startSlave_1a.diff, startSlave_1a.stat, startSlave_1b.diff, startSlave_1b.stat, startSlave_1c.diff, startSlave_1d.diff, StopSlave_impl_3205_NotForCommit_v1.diff, StopSlave_impl_3205_NotForCommit_v1.stat, stopSlave_v1a.diff, stopSlave_v1a.stat, stopSlave_v1b.diff, stopSlave_v1b.stat, stopSlave_v1c.diff, stopSlave_v1c.stat
>
>
> Add commands to start and stop the replication slave using properties or connection url. Example:
> 'jdbc:derby:<host><dbname>;startSlave=true';
> 'jdbc:derby:<host><dbname>;stopSlave=true';
> 'jdbc:derby:<host><dbname>;failover=true;
> Connection url options that must be recognized:
> startSlave=true
> stopSlave=true
> failover=true
> slaveHost=<host> (optional, defaults to localhost) (only for startSlave)
> slavePort=<port> (optional, defaults to 8001) (only for startSlave)
> See functional specification on Derby-2872 for further details.

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


[jira] Commented: (DERBY-3205) Replication: Add connection url command options for starting, stopping slave and for failover

Posted by "Jørgen Løland (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/DERBY-3205?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12564802#action_12564802 ] 

Jørgen Løland commented on DERBY-3205:
--------------------------------------

Øystein,

It's a few days since I wrote this patch, and I just remembered what caused problem: When the stop slave command comes from the master, we can't throw the database severity exception to a thread that will hand it to TransactionResourceImpl#handleException. I'm not sure why, but there seems to be some caching or a reference to the booted database in the EmbedConnection layer which needs to be cleaned up. Hence the internal connection in SlaveDatabase#handleShutdown

In the case that stopSlave is executed on the slave database (from a client, through EmbedConnection#handleStopReplicationSlave), everything works fine without the internal connection.


> Replication: Add connection url command options for starting, stopping slave and for failover
> ---------------------------------------------------------------------------------------------
>
>                 Key: DERBY-3205
>                 URL: https://issues.apache.org/jira/browse/DERBY-3205
>             Project: Derby
>          Issue Type: Sub-task
>          Components: JDBC
>    Affects Versions: 10.4.0.0
>            Reporter: Jørgen Løland
>            Assignee: V.Narayanan
>         Attachments: derby-3205_startslave_dontcommit.diff, derby-3205_startslave_dontcommit.stat, failover_impl_3205_NotForCommit_v1.diff, failover_impl_3205_NotForCommit_v1.stat, failover_impl_3205_v1.diff, failover_impl_3205_v1.stat, failover_impl_3205_v2.diff, failover_impl_3205_v2.stat, Socket_Close_Fix_v1.diff, Socket_Close_Fix_v1.stat, startSlave_1a.diff, startSlave_1a.stat, startSlave_1b.diff, startSlave_1b.stat, startSlave_1c.diff, startSlave_1d.diff, StopSlave_impl_3205_NotForCommit_v1.diff, StopSlave_impl_3205_NotForCommit_v1.stat, stopSlave_v1a.diff, stopSlave_v1a.stat, stopSlave_v1b.diff, stopSlave_v1b.stat, stopSlave_v1c.diff, stopSlave_v1c.stat
>
>
> Add commands to start and stop the replication slave using properties or connection url. Example:
> 'jdbc:derby:<host><dbname>;startSlave=true';
> 'jdbc:derby:<host><dbname>;stopSlave=true';
> 'jdbc:derby:<host><dbname>;failover=true;
> Connection url options that must be recognized:
> startSlave=true
> stopSlave=true
> failover=true
> slaveHost=<host> (optional, defaults to localhost) (only for startSlave)
> slavePort=<port> (optional, defaults to 8001) (only for startSlave)
> See functional specification on Derby-2872 for further details.

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


[jira] Updated: (DERBY-3205) Replication: Add connection url command options for starting, stopping slave and for failover

Posted by "Øystein Grøvlen (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/DERBY-3205?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Øystein Grøvlen updated DERBY-3205:
-----------------------------------

    Derby Info:   (was: [Patch Available])

I have briefly tested the added functionality, and it worked for me.
Patch, failover-slave-1a.diff, committed as revision 630806.

> Replication: Add connection url command options for starting, stopping slave and for failover
> ---------------------------------------------------------------------------------------------
>
>                 Key: DERBY-3205
>                 URL: https://issues.apache.org/jira/browse/DERBY-3205
>             Project: Derby
>          Issue Type: Sub-task
>          Components: JDBC
>    Affects Versions: 10.4.0.0
>            Reporter: Jørgen Løland
>            Assignee: Jørgen Løland
>         Attachments: derby-3205_startslave_dontcommit.diff, derby-3205_startslave_dontcommit.stat, failover-slave-1a.diff, failover-slave-1a.stat, failover_impl_3205_NotForCommit_v1.diff, failover_impl_3205_NotForCommit_v1.stat, failover_impl_3205_v1.diff, failover_impl_3205_v1.stat, failover_impl_3205_v2.diff, failover_impl_3205_v2.stat, failover_impl_3205_v3.diff, failover_impl_3205_v3.stat, failover_impl_3205_v4.diff, failover_impl_3205_v4.stat, Socket_Close_Fix_v1.diff, Socket_Close_Fix_v1.stat, startSlave_1a.diff, startSlave_1a.stat, startSlave_1b.diff, startSlave_1b.stat, startSlave_1c.diff, startSlave_1d.diff, StopSlave_impl_3205_NotForCommit_v1.diff, StopSlave_impl_3205_NotForCommit_v1.stat, stopSlave_v1a.diff, stopSlave_v1a.stat, stopSlave_v1b.diff, stopSlave_v1b.stat, stopSlave_v1c.diff, stopSlave_v1c.stat
>
>
> Add commands to start and stop the replication slave using properties or connection url. Example:
> 'jdbc:derby:<host><dbname>;startSlave=true';
> 'jdbc:derby:<host><dbname>;stopSlave=true';
> 'jdbc:derby:<host><dbname>;failover=true;
> Connection url options that must be recognized:
> startSlave=true
> stopSlave=true
> failover=true
> slaveHost=<host> (optional, defaults to localhost) (only for startSlave)
> slavePort=<port> (optional, defaults to 8001) (only for startSlave)
> See functional specification on Derby-2872 for further details.

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


[jira] Updated: (DERBY-3205) Replication: Add connection url command options for starting and stopping slave

Posted by "Øystein Grøvlen (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/DERBY-3205?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Øystein Grøvlen updated DERBY-3205:
-----------------------------------

    Derby Info:   (was: [Patch Available])

Thanks for the new patch, Jørgen
Committed patch, startSlave_1d.diff, as revision 613097.

> Replication: Add connection url command options for starting and stopping slave
> -------------------------------------------------------------------------------
>
>                 Key: DERBY-3205
>                 URL: https://issues.apache.org/jira/browse/DERBY-3205
>             Project: Derby
>          Issue Type: Sub-task
>          Components: JDBC
>    Affects Versions: 10.4.0.0
>            Reporter: Jørgen Løland
>            Assignee: V.Narayanan
>         Attachments: derby-3205_startslave_dontcommit.diff, derby-3205_startslave_dontcommit.stat, failover_impl_3205_NotForCommit_v1.diff, failover_impl_3205_NotForCommit_v1.stat, startSlave_1a.diff, startSlave_1a.stat, startSlave_1b.diff, startSlave_1b.stat, startSlave_1c.diff, startSlave_1d.diff, StopSlave_impl_3205_NotForCommit_v1.diff, StopSlave_impl_3205_NotForCommit_v1.stat
>
>
> Add commands to start and stop the replication slave using properties or connection url. Example:
> 'jdbc:derby:<host><dbname>;startSlave=true';
> 'jdbc:derby:<host><dbname>;stopSlave=true';
> 'jdbc:derby:<host><dbname>;failover=true;
> Connection url options that must be recognized:
> startSlave=true
> stopSlave=true
> failover=true
> slaveHost=<host> (optional, defaults to localhost) (only for startSlave)
> slavePort=<port> (optional, defaults to 8001) (only for startSlave)
> See functional specification on Derby-2872 for further details.

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


[jira] Commented: (DERBY-3205) Replication: Add connection url command options for starting, stopping slave and for failover

Posted by "V.Narayanan (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/DERBY-3205?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12564354#action_12564354 ] 

V.Narayanan commented on DERBY-3205:
------------------------------------

failover patch v2 did not give any failures in the junit all run.

> Replication: Add connection url command options for starting, stopping slave and for failover
> ---------------------------------------------------------------------------------------------
>
>                 Key: DERBY-3205
>                 URL: https://issues.apache.org/jira/browse/DERBY-3205
>             Project: Derby
>          Issue Type: Sub-task
>          Components: JDBC
>    Affects Versions: 10.4.0.0
>            Reporter: Jørgen Løland
>            Assignee: V.Narayanan
>         Attachments: derby-3205_startslave_dontcommit.diff, derby-3205_startslave_dontcommit.stat, failover_impl_3205_NotForCommit_v1.diff, failover_impl_3205_NotForCommit_v1.stat, failover_impl_3205_v1.diff, failover_impl_3205_v1.stat, failover_impl_3205_v2.diff, failover_impl_3205_v2.stat, Socket_Close_Fix_v1.diff, Socket_Close_Fix_v1.stat, startSlave_1a.diff, startSlave_1a.stat, startSlave_1b.diff, startSlave_1b.stat, startSlave_1c.diff, startSlave_1d.diff, StopSlave_impl_3205_NotForCommit_v1.diff, StopSlave_impl_3205_NotForCommit_v1.stat, stopSlave_v1a.diff, stopSlave_v1a.stat, stopSlave_v1b.diff, stopSlave_v1b.stat
>
>
> Add commands to start and stop the replication slave using properties or connection url. Example:
> 'jdbc:derby:<host><dbname>;startSlave=true';
> 'jdbc:derby:<host><dbname>;stopSlave=true';
> 'jdbc:derby:<host><dbname>;failover=true;
> Connection url options that must be recognized:
> startSlave=true
> stopSlave=true
> failover=true
> slaveHost=<host> (optional, defaults to localhost) (only for startSlave)
> slavePort=<port> (optional, defaults to 8001) (only for startSlave)
> See functional specification on Derby-2872 for further details.

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


[jira] Commented: (DERBY-3205) Replication: Add connection url command options for starting and stopping slave

Posted by "Øystein Grøvlen (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/DERBY-3205?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12559421#action_12559421 ] 

Øystein Grøvlen commented on DERBY-3205:
----------------------------------------

The code for the  startSlave_1c.diff looks good, but I wonder whether it would be possible to avoid the duplication of code with respect to the other multi-phase boot scenario.  Would it be possible to integrate the multiphase for the slave with the existing code?

I must also admit that I do not quite understand why there is two Attribute.java files.

> Replication: Add connection url command options for starting and stopping slave
> -------------------------------------------------------------------------------
>
>                 Key: DERBY-3205
>                 URL: https://issues.apache.org/jira/browse/DERBY-3205
>             Project: Derby
>          Issue Type: Sub-task
>          Components: JDBC
>    Affects Versions: 10.4.0.0
>            Reporter: Jørgen Løland
>            Assignee: V.Narayanan
>         Attachments: derby-3205_startslave_dontcommit.diff, derby-3205_startslave_dontcommit.stat, failover_impl_3205_NotForCommit_v1.diff, failover_impl_3205_NotForCommit_v1.stat, startSlave_1a.diff, startSlave_1a.stat, startSlave_1b.diff, startSlave_1b.stat, startSlave_1c.diff, StopSlave_impl_3205_NotForCommit_v1.diff, StopSlave_impl_3205_NotForCommit_v1.stat
>
>
> Add commands to start and stop the replication slave using properties or connection url. Example:
> 'jdbc:derby:<host><dbname>;startSlave=true';
> 'jdbc:derby:<host><dbname>;stopSlave=true';
> 'jdbc:derby:<host><dbname>;failover=true;
> Connection url options that must be recognized:
> startSlave=true
> stopSlave=true
> failover=true
> slaveHost=<host> (optional, defaults to localhost) (only for startSlave)
> slavePort=<port> (optional, defaults to 8001) (only for startSlave)
> See functional specification on Derby-2872 for further details.

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


[jira] Commented: (DERBY-3205) Replication: Add connection url command options for starting, stopping slave and for failover

Posted by "V.Narayanan (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/DERBY-3205?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12561972#action_12561972 ] 

V.Narayanan commented on DERBY-3205:
------------------------------------

I ran tests on  failover_impl_3205_v1.diff and found some failures which were replicated on a fresh workspace
also. I request for this patch to be considered for reviews and if everything is OK a commit too.

> Replication: Add connection url command options for starting, stopping slave and for failover
> ---------------------------------------------------------------------------------------------
>
>                 Key: DERBY-3205
>                 URL: https://issues.apache.org/jira/browse/DERBY-3205
>             Project: Derby
>          Issue Type: Sub-task
>          Components: JDBC
>    Affects Versions: 10.4.0.0
>            Reporter: Jørgen Løland
>            Assignee: V.Narayanan
>         Attachments: derby-3205_startslave_dontcommit.diff, derby-3205_startslave_dontcommit.stat, failover_impl_3205_NotForCommit_v1.diff, failover_impl_3205_NotForCommit_v1.stat, failover_impl_3205_v1.diff, failover_impl_3205_v1.stat, startSlave_1a.diff, startSlave_1a.stat, startSlave_1b.diff, startSlave_1b.stat, startSlave_1c.diff, startSlave_1d.diff, StopSlave_impl_3205_NotForCommit_v1.diff, StopSlave_impl_3205_NotForCommit_v1.stat, stopSlave_v1a.diff, stopSlave_v1a.stat
>
>
> Add commands to start and stop the replication slave using properties or connection url. Example:
> 'jdbc:derby:<host><dbname>;startSlave=true';
> 'jdbc:derby:<host><dbname>;stopSlave=true';
> 'jdbc:derby:<host><dbname>;failover=true;
> Connection url options that must be recognized:
> startSlave=true
> stopSlave=true
> failover=true
> slaveHost=<host> (optional, defaults to localhost) (only for startSlave)
> slavePort=<port> (optional, defaults to 8001) (only for startSlave)
> See functional specification on Derby-2872 for further details.

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


[jira] Updated: (DERBY-3205) Replication: Add connection url command options for starting, stopping slave and for failover

Posted by "V.Narayanan (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/DERBY-3205?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

V.Narayanan updated DERBY-3205:
-------------------------------

    Attachment: failover_impl_3205_v2.stat
                failover_impl_3205_v2.diff

Thank you for the review and comments on the patch Jorgen!

I have fixed issues 1-6 pointed out and have raised Derby-3364 for 7.

>4) There are two Attribute.java files. I'm not sure if both are in use, but previously 
>replication attributes have been added to both files. We either need some insight on 
>which file can be ignored or continue to add the attributes to both files.

I used the following comments to in  org.apache.derby.iapi.reference.Attributes to
conclude that we need to place the failover attribute in both the files.

    "At some point this class should be replaced by
    org.apache.derby.shared.common.reference.Attribute.
    The issue is that this class is used by ij to check attributes,
    ij uses reflection on this class to get the list of valid attributes.
    The expanded class in shared has the client attributes as well.
    Ideally ij would work of an explicit list of attributes and not
    infer the set from reflection. See DERBY-1151"

I shall run tests on this patch and shall post results by today evening.

> Replication: Add connection url command options for starting, stopping slave and for failover
> ---------------------------------------------------------------------------------------------
>
>                 Key: DERBY-3205
>                 URL: https://issues.apache.org/jira/browse/DERBY-3205
>             Project: Derby
>          Issue Type: Sub-task
>          Components: JDBC
>    Affects Versions: 10.4.0.0
>            Reporter: Jørgen Løland
>            Assignee: V.Narayanan
>         Attachments: derby-3205_startslave_dontcommit.diff, derby-3205_startslave_dontcommit.stat, failover_impl_3205_NotForCommit_v1.diff, failover_impl_3205_NotForCommit_v1.stat, failover_impl_3205_v1.diff, failover_impl_3205_v1.stat, failover_impl_3205_v2.diff, failover_impl_3205_v2.stat, Socket_Close_Fix_v1.diff, Socket_Close_Fix_v1.stat, startSlave_1a.diff, startSlave_1a.stat, startSlave_1b.diff, startSlave_1b.stat, startSlave_1c.diff, startSlave_1d.diff, StopSlave_impl_3205_NotForCommit_v1.diff, StopSlave_impl_3205_NotForCommit_v1.stat, stopSlave_v1a.diff, stopSlave_v1a.stat, stopSlave_v1b.diff, stopSlave_v1b.stat
>
>
> Add commands to start and stop the replication slave using properties or connection url. Example:
> 'jdbc:derby:<host><dbname>;startSlave=true';
> 'jdbc:derby:<host><dbname>;stopSlave=true';
> 'jdbc:derby:<host><dbname>;failover=true;
> Connection url options that must be recognized:
> startSlave=true
> stopSlave=true
> failover=true
> slaveHost=<host> (optional, defaults to localhost) (only for startSlave)
> slavePort=<port> (optional, defaults to 8001) (only for startSlave)
> See functional specification on Derby-2872 for further details.

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


[jira] Commented: (DERBY-3205) Replication: Add connection url command options for starting, stopping slave and for failover

Posted by "Øystein Grøvlen (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/DERBY-3205?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12564798#action_12564798 ] 

Øystein Grøvlen commented on DERBY-3205:
----------------------------------------

The failover patch (v2) has some conflicts with the stopSlave patch I just committed.  (E.g., the name of an SQLState used by the patch has got a new name). Could you please regenerate the patch.

> Replication: Add connection url command options for starting, stopping slave and for failover
> ---------------------------------------------------------------------------------------------
>
>                 Key: DERBY-3205
>                 URL: https://issues.apache.org/jira/browse/DERBY-3205
>             Project: Derby
>          Issue Type: Sub-task
>          Components: JDBC
>    Affects Versions: 10.4.0.0
>            Reporter: Jørgen Løland
>            Assignee: V.Narayanan
>         Attachments: derby-3205_startslave_dontcommit.diff, derby-3205_startslave_dontcommit.stat, failover_impl_3205_NotForCommit_v1.diff, failover_impl_3205_NotForCommit_v1.stat, failover_impl_3205_v1.diff, failover_impl_3205_v1.stat, failover_impl_3205_v2.diff, failover_impl_3205_v2.stat, Socket_Close_Fix_v1.diff, Socket_Close_Fix_v1.stat, startSlave_1a.diff, startSlave_1a.stat, startSlave_1b.diff, startSlave_1b.stat, startSlave_1c.diff, startSlave_1d.diff, StopSlave_impl_3205_NotForCommit_v1.diff, StopSlave_impl_3205_NotForCommit_v1.stat, stopSlave_v1a.diff, stopSlave_v1a.stat, stopSlave_v1b.diff, stopSlave_v1b.stat, stopSlave_v1c.diff, stopSlave_v1c.stat
>
>
> Add commands to start and stop the replication slave using properties or connection url. Example:
> 'jdbc:derby:<host><dbname>;startSlave=true';
> 'jdbc:derby:<host><dbname>;stopSlave=true';
> 'jdbc:derby:<host><dbname>;failover=true;
> Connection url options that must be recognized:
> startSlave=true
> stopSlave=true
> failover=true
> slaveHost=<host> (optional, defaults to localhost) (only for startSlave)
> slavePort=<port> (optional, defaults to 8001) (only for startSlave)
> See functional specification on Derby-2872 for further details.

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


[jira] Updated: (DERBY-3205) Replication: Add connection url command options for starting and stopping slave

Posted by "Jørgen Løland (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/DERBY-3205?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Jørgen Løland updated DERBY-3205:
---------------------------------

    Attachment: derby-3205_startslave_dontcommit.stat
                derby-3205_startslave_dontcommit.diff

Attaching the startslave code that I already tested in the proof of concept codeline. This code needs cleanup, but should give an idea of how the two-phase boot of startSlave could be done. The patch is not intended for commit!

> Replication: Add connection url command options for starting and stopping slave
> -------------------------------------------------------------------------------
>
>                 Key: DERBY-3205
>                 URL: https://issues.apache.org/jira/browse/DERBY-3205
>             Project: Derby
>          Issue Type: Sub-task
>          Components: JDBC
>    Affects Versions: 10.4.0.0
>            Reporter: Jørgen Løland
>         Attachments: derby-3205_startslave_dontcommit.diff, derby-3205_startslave_dontcommit.stat
>
>
> Add commands to start and stop the replication slave using properties or connection url. Example:
> 'jdbc:derby:<host><dbname>;startSlave=true';
> 'jdbc:derby:<host><dbname>;stopSlave=true';
> 'jdbc:derby:<host><dbname>;failover=true;
> Connection url options that must be recognized:
> startSlave=true
> stopSlave=true
> failover=true
> slaveHost=<host> (optional, defaults to localhost) (only for startSlave)
> slavePort=<port> (optional, defaults to 8001) (only for startSlave)
> See functional specification on Derby-2872 for further details.

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


[jira] Commented: (DERBY-3205) Replication: Add connection url command options for starting, stopping slave and for failover

Posted by "Øystein Grøvlen (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/DERBY-3205?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12571436#action_12571436 ] 

Øystein Grøvlen commented on DERBY-3205:
----------------------------------------

Thanks for the failover patch for slave, Jørgen.  It looks good to me,
but I have not had a chance to try it out yet.  My only concern from
reading the code is whether there a scenarios where we get into a
situation where the master fails and the slave refuses to do failover.
As far as I can tell, the only way the slave will recognize that the
connection with the master is lost is if the LogReceiver gets a
EOFException.  Are you sure that covers all the situations where the
master fails?

A minor issue: I do not quite understand the comment for "if
(isFailoverMasterBoot)".  Are you saying this must happen after
startTransaction in order for authentication/authorization to happen
first?

> Replication: Add connection url command options for starting, stopping slave and for failover
> ---------------------------------------------------------------------------------------------
>
>                 Key: DERBY-3205
>                 URL: https://issues.apache.org/jira/browse/DERBY-3205
>             Project: Derby
>          Issue Type: Sub-task
>          Components: JDBC
>    Affects Versions: 10.4.0.0
>            Reporter: Jørgen Løland
>            Assignee: Jørgen Løland
>         Attachments: derby-3205_startslave_dontcommit.diff, derby-3205_startslave_dontcommit.stat, failover-slave-1a.diff, failover-slave-1a.stat, failover_impl_3205_NotForCommit_v1.diff, failover_impl_3205_NotForCommit_v1.stat, failover_impl_3205_v1.diff, failover_impl_3205_v1.stat, failover_impl_3205_v2.diff, failover_impl_3205_v2.stat, failover_impl_3205_v3.diff, failover_impl_3205_v3.stat, failover_impl_3205_v4.diff, failover_impl_3205_v4.stat, Socket_Close_Fix_v1.diff, Socket_Close_Fix_v1.stat, startSlave_1a.diff, startSlave_1a.stat, startSlave_1b.diff, startSlave_1b.stat, startSlave_1c.diff, startSlave_1d.diff, StopSlave_impl_3205_NotForCommit_v1.diff, StopSlave_impl_3205_NotForCommit_v1.stat, stopSlave_v1a.diff, stopSlave_v1a.stat, stopSlave_v1b.diff, stopSlave_v1b.stat, stopSlave_v1c.diff, stopSlave_v1c.stat
>
>
> Add commands to start and stop the replication slave using properties or connection url. Example:
> 'jdbc:derby:<host><dbname>;startSlave=true';
> 'jdbc:derby:<host><dbname>;stopSlave=true';
> 'jdbc:derby:<host><dbname>;failover=true;
> Connection url options that must be recognized:
> startSlave=true
> stopSlave=true
> failover=true
> slaveHost=<host> (optional, defaults to localhost) (only for startSlave)
> slavePort=<port> (optional, defaults to 8001) (only for startSlave)
> See functional specification on Derby-2872 for further details.

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


[jira] Commented: (DERBY-3205) Replication: Add connection url command options for starting, stopping slave and for failover

Posted by "Jørgen Løland (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/DERBY-3205?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12563987#action_12563987 ] 

Jørgen Løland commented on DERBY-3205:
--------------------------------------

Hi Narayanan,

The failover patch v2 looks good to me, although I think SQLState.REPLICATION_UNABLE_TO_STOP_MASTER would give a better error message than REPLICATION_FAILOVER_UNSUCCESSFUL in RawStore#failover if that message was slightly changed to "Could not perform replication operation because... ". I don't consider this a blocker for the patch.

I also ran all tests without any error.  +1 to commit.

> Replication: Add connection url command options for starting, stopping slave and for failover
> ---------------------------------------------------------------------------------------------
>
>                 Key: DERBY-3205
>                 URL: https://issues.apache.org/jira/browse/DERBY-3205
>             Project: Derby
>          Issue Type: Sub-task
>          Components: JDBC
>    Affects Versions: 10.4.0.0
>            Reporter: Jørgen Løland
>            Assignee: V.Narayanan
>         Attachments: derby-3205_startslave_dontcommit.diff, derby-3205_startslave_dontcommit.stat, failover_impl_3205_NotForCommit_v1.diff, failover_impl_3205_NotForCommit_v1.stat, failover_impl_3205_v1.diff, failover_impl_3205_v1.stat, failover_impl_3205_v2.diff, failover_impl_3205_v2.stat, Socket_Close_Fix_v1.diff, Socket_Close_Fix_v1.stat, startSlave_1a.diff, startSlave_1a.stat, startSlave_1b.diff, startSlave_1b.stat, startSlave_1c.diff, startSlave_1d.diff, StopSlave_impl_3205_NotForCommit_v1.diff, StopSlave_impl_3205_NotForCommit_v1.stat, stopSlave_v1a.diff, stopSlave_v1a.stat, stopSlave_v1b.diff, stopSlave_v1b.stat
>
>
> Add commands to start and stop the replication slave using properties or connection url. Example:
> 'jdbc:derby:<host><dbname>;startSlave=true';
> 'jdbc:derby:<host><dbname>;stopSlave=true';
> 'jdbc:derby:<host><dbname>;failover=true;
> Connection url options that must be recognized:
> startSlave=true
> stopSlave=true
> failover=true
> slaveHost=<host> (optional, defaults to localhost) (only for startSlave)
> slavePort=<port> (optional, defaults to 8001) (only for startSlave)
> See functional specification on Derby-2872 for further details.

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


[jira] Commented: (DERBY-3205) Replication: Add connection url command options for starting, stopping slave and for failover

Posted by "Jørgen Løland (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/DERBY-3205?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12572042#action_12572042 ] 

Jørgen Løland commented on DERBY-3205:
--------------------------------------

Re lost replication connection: 
I have experimented a bit and not found a way to loose the connection without the slave noticing, but I'm afraid I'm not 100% sure. Maybe Socket.isConnected can be used? Otherwise, pinging the master would be a way to be absolutely sure. That would require more work though.

Re comment on EmbedConnection isFailoverMasterBoot:
Authentication is checked as part of startTransaction. That is why the slave-side failover must be performed before startTransaction while master-side failover must be performed after startTransaction. However, I see that db ownership is not checked for any of startMaster, stopMaster or masterside failover. If it is ok with you, I'll move these three down a few lines to the following block:

if (isTwoPhaseEncryptionBoot ||
    isTwoPhaseUpgradeBoot ||
    isStartSlaveBoot) {
...}

in a followup patch.


> Replication: Add connection url command options for starting, stopping slave and for failover
> ---------------------------------------------------------------------------------------------
>
>                 Key: DERBY-3205
>                 URL: https://issues.apache.org/jira/browse/DERBY-3205
>             Project: Derby
>          Issue Type: Sub-task
>          Components: JDBC
>    Affects Versions: 10.4.0.0
>            Reporter: Jørgen Løland
>            Assignee: Jørgen Løland
>         Attachments: derby-3205_startslave_dontcommit.diff, derby-3205_startslave_dontcommit.stat, failover-slave-1a.diff, failover-slave-1a.stat, failover_impl_3205_NotForCommit_v1.diff, failover_impl_3205_NotForCommit_v1.stat, failover_impl_3205_v1.diff, failover_impl_3205_v1.stat, failover_impl_3205_v2.diff, failover_impl_3205_v2.stat, failover_impl_3205_v3.diff, failover_impl_3205_v3.stat, failover_impl_3205_v4.diff, failover_impl_3205_v4.stat, Socket_Close_Fix_v1.diff, Socket_Close_Fix_v1.stat, startSlave_1a.diff, startSlave_1a.stat, startSlave_1b.diff, startSlave_1b.stat, startSlave_1c.diff, startSlave_1d.diff, StopSlave_impl_3205_NotForCommit_v1.diff, StopSlave_impl_3205_NotForCommit_v1.stat, stopSlave_v1a.diff, stopSlave_v1a.stat, stopSlave_v1b.diff, stopSlave_v1b.stat, stopSlave_v1c.diff, stopSlave_v1c.stat
>
>
> Add commands to start and stop the replication slave using properties or connection url. Example:
> 'jdbc:derby:<host><dbname>;startSlave=true';
> 'jdbc:derby:<host><dbname>;stopSlave=true';
> 'jdbc:derby:<host><dbname>;failover=true;
> Connection url options that must be recognized:
> startSlave=true
> stopSlave=true
> failover=true
> slaveHost=<host> (optional, defaults to localhost) (only for startSlave)
> slavePort=<port> (optional, defaults to 8001) (only for startSlave)
> See functional specification on Derby-2872 for further details.

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


[jira] Commented: (DERBY-3205) Replication: Add connection url command options for starting and stopping slave

Posted by "Jørgen Løland (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/DERBY-3205?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12558539#action_12558539 ] 

Jørgen Løland commented on DERBY-3205:
--------------------------------------

I've been thinking about this issue for a few days, and I think my second comment may be disregarded. That is, it may be possible to call getDatabase().stopDatabase() as long as you do this before any call to getDatabase().getTransaction().  

> Replication: Add connection url command options for starting and stopping slave
> -------------------------------------------------------------------------------
>
>                 Key: DERBY-3205
>                 URL: https://issues.apache.org/jira/browse/DERBY-3205
>             Project: Derby
>          Issue Type: Sub-task
>          Components: JDBC
>    Affects Versions: 10.4.0.0
>            Reporter: Jørgen Løland
>            Assignee: V.Narayanan
>         Attachments: derby-3205_startslave_dontcommit.diff, derby-3205_startslave_dontcommit.stat, failover_impl_3205_NotForCommit_v1.diff, failover_impl_3205_NotForCommit_v1.stat, startSlave_1a.diff, startSlave_1a.stat, StopSlave_impl_3205_NotForCommit_v1.diff, StopSlave_impl_3205_NotForCommit_v1.stat
>
>
> Add commands to start and stop the replication slave using properties or connection url. Example:
> 'jdbc:derby:<host><dbname>;startSlave=true';
> 'jdbc:derby:<host><dbname>;stopSlave=true';
> 'jdbc:derby:<host><dbname>;failover=true;
> Connection url options that must be recognized:
> startSlave=true
> stopSlave=true
> failover=true
> slaveHost=<host> (optional, defaults to localhost) (only for startSlave)
> slavePort=<port> (optional, defaults to 8001) (only for startSlave)
> See functional specification on Derby-2872 for further details.

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


[jira] Commented: (DERBY-3205) Replication: Add connection url command options for starting, stopping slave and for failover

Posted by "Jørgen Løland (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/DERBY-3205?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12562070#action_12562070 ] 

Jørgen Løland commented on DERBY-3205:
--------------------------------------

I have tested start/stop slave a little bit. What strikes me is that I get a "replication started successfully" even when it does not. Added to todo-list.

> Replication: Add connection url command options for starting, stopping slave and for failover
> ---------------------------------------------------------------------------------------------
>
>                 Key: DERBY-3205
>                 URL: https://issues.apache.org/jira/browse/DERBY-3205
>             Project: Derby
>          Issue Type: Sub-task
>          Components: JDBC
>    Affects Versions: 10.4.0.0
>            Reporter: Jørgen Løland
>            Assignee: V.Narayanan
>         Attachments: derby-3205_startslave_dontcommit.diff, derby-3205_startslave_dontcommit.stat, failover_impl_3205_NotForCommit_v1.diff, failover_impl_3205_NotForCommit_v1.stat, failover_impl_3205_v1.diff, failover_impl_3205_v1.stat, startSlave_1a.diff, startSlave_1a.stat, startSlave_1b.diff, startSlave_1b.stat, startSlave_1c.diff, startSlave_1d.diff, StopSlave_impl_3205_NotForCommit_v1.diff, StopSlave_impl_3205_NotForCommit_v1.stat, stopSlave_v1a.diff, stopSlave_v1a.stat
>
>
> Add commands to start and stop the replication slave using properties or connection url. Example:
> 'jdbc:derby:<host><dbname>;startSlave=true';
> 'jdbc:derby:<host><dbname>;stopSlave=true';
> 'jdbc:derby:<host><dbname>;failover=true;
> Connection url options that must be recognized:
> startSlave=true
> stopSlave=true
> failover=true
> slaveHost=<host> (optional, defaults to localhost) (only for startSlave)
> slavePort=<port> (optional, defaults to 8001) (only for startSlave)
> See functional specification on Derby-2872 for further details.

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


[jira] Updated: (DERBY-3205) Replication: Add connection url command options for starting and stopping slave

Posted by "V.Narayanan (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/DERBY-3205?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

V.Narayanan updated DERBY-3205:
-------------------------------

    Attachment: failover_impl_3205_NotForCommit_v1.diff
                StopSlave_impl_3205_NotForCommit_v1.stat
                StopSlave_impl_3205_NotForCommit_v1.diff

Pls find attached preliminary patches for stopSlave and failover. These patches
conflict with 3189 and 3254 and can be committed only after these patches
are committed.

I request for these patches to be considered for reviews and comments.

> Replication: Add connection url command options for starting and stopping slave
> -------------------------------------------------------------------------------
>
>                 Key: DERBY-3205
>                 URL: https://issues.apache.org/jira/browse/DERBY-3205
>             Project: Derby
>          Issue Type: Sub-task
>          Components: JDBC
>    Affects Versions: 10.4.0.0
>            Reporter: Jørgen Løland
>            Assignee: V.Narayanan
>         Attachments: derby-3205_startslave_dontcommit.diff, derby-3205_startslave_dontcommit.stat, failover_impl_3205_NotForCommit_v1.diff, failover_impl_3205_NotForCommit_v1.stat, StopSlave_impl_3205_NotForCommit_v1.diff, StopSlave_impl_3205_NotForCommit_v1.stat
>
>
> Add commands to start and stop the replication slave using properties or connection url. Example:
> 'jdbc:derby:<host><dbname>;startSlave=true';
> 'jdbc:derby:<host><dbname>;stopSlave=true';
> 'jdbc:derby:<host><dbname>;failover=true;
> Connection url options that must be recognized:
> startSlave=true
> stopSlave=true
> failover=true
> slaveHost=<host> (optional, defaults to localhost) (only for startSlave)
> slavePort=<port> (optional, defaults to 8001) (only for startSlave)
> See functional specification on Derby-2872 for further details.

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


[jira] Updated: (DERBY-3205) Replication: Add connection url command options for starting, stopping slave and for failover

Posted by "Øystein Grøvlen (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/DERBY-3205?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Øystein Grøvlen updated DERBY-3205:
-----------------------------------

    Derby Info:   (was: [Patch Available])

Thanks, Jørgen.  Committed stopSlave_v1c.diff as revision 617501.

One thing that probably needs correction is the Javadoc of EmbedConnection#handleStopReplicationSlave which says "this operation will cause SlaveDatabase to call internalStopReplicationSlave".  This doe not seem to be correct.

I do not understand your comment on 2e. about the TransactionResource needed to be cleaned.  When you set up a new connection, don't you get a new TransactionResource? If so, I do not understand why you need to create a new TransactionResource just to clean it.


> Replication: Add connection url command options for starting, stopping slave and for failover
> ---------------------------------------------------------------------------------------------
>
>                 Key: DERBY-3205
>                 URL: https://issues.apache.org/jira/browse/DERBY-3205
>             Project: Derby
>          Issue Type: Sub-task
>          Components: JDBC
>    Affects Versions: 10.4.0.0
>            Reporter: Jørgen Løland
>            Assignee: V.Narayanan
>         Attachments: derby-3205_startslave_dontcommit.diff, derby-3205_startslave_dontcommit.stat, failover_impl_3205_NotForCommit_v1.diff, failover_impl_3205_NotForCommit_v1.stat, failover_impl_3205_v1.diff, failover_impl_3205_v1.stat, failover_impl_3205_v2.diff, failover_impl_3205_v2.stat, Socket_Close_Fix_v1.diff, Socket_Close_Fix_v1.stat, startSlave_1a.diff, startSlave_1a.stat, startSlave_1b.diff, startSlave_1b.stat, startSlave_1c.diff, startSlave_1d.diff, StopSlave_impl_3205_NotForCommit_v1.diff, StopSlave_impl_3205_NotForCommit_v1.stat, stopSlave_v1a.diff, stopSlave_v1a.stat, stopSlave_v1b.diff, stopSlave_v1b.stat, stopSlave_v1c.diff, stopSlave_v1c.stat
>
>
> Add commands to start and stop the replication slave using properties or connection url. Example:
> 'jdbc:derby:<host><dbname>;startSlave=true';
> 'jdbc:derby:<host><dbname>;stopSlave=true';
> 'jdbc:derby:<host><dbname>;failover=true;
> Connection url options that must be recognized:
> startSlave=true
> stopSlave=true
> failover=true
> slaveHost=<host> (optional, defaults to localhost) (only for startSlave)
> slavePort=<port> (optional, defaults to 8001) (only for startSlave)
> See functional specification on Derby-2872 for further details.

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


[jira] Commented: (DERBY-3205) Replication: Add connection url command options for starting and stopping slave

Posted by "Øystein Grøvlen (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/DERBY-3205?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12558631#action_12558631 ] 

Øystein Grøvlen commented on DERBY-3205:
----------------------------------------

I applied the startSlave_1a.diff patch, and was able to start a slave
, and a master was able to connect.

However, I am not quite the messages I got:

> java -jar jars/sane/derbyrun.jar ij
ij version 10.4
ij> connect 'jdbc:derby:slaveDB;startSlave=true';
ERROR 08004: Connection refused to database 'slaveDB' because it is in replication slave mode.
ij> connect 'jdbc:derby:slaveDB';
ERROR XJ001: Java exception: 'ASSERT FAILED Unexpected - There is no valid authentication service for the database!: org.apache.derby.shared.common.sanity.AssertFailure'.
ij> connect 'jdbc:derby:slaveDB;startSlave=true';
ERROR XJ001: Java exception: 'ASSERT FAILED Unexpected - There is no valid authentication service for the database!: org.apache.derby.shared.common.sanity.AssertFailure'.
ij> 

For the first connection, I think it would be good if it said something
about the slave having been started.  The current message may lead one
to think that the database was already in slave mode before the
connection was attempted.

For the second connection, I would have expected the first message.  I
have not tried to run an insane version to see what happens when the
assert is not hit.

For the third connection, it would be good if a warning was given that
the database was already in slave mode.


> Replication: Add connection url command options for starting and stopping slave
> -------------------------------------------------------------------------------
>
>                 Key: DERBY-3205
>                 URL: https://issues.apache.org/jira/browse/DERBY-3205
>             Project: Derby
>          Issue Type: Sub-task
>          Components: JDBC
>    Affects Versions: 10.4.0.0
>            Reporter: Jørgen Løland
>            Assignee: V.Narayanan
>         Attachments: derby-3205_startslave_dontcommit.diff, derby-3205_startslave_dontcommit.stat, failover_impl_3205_NotForCommit_v1.diff, failover_impl_3205_NotForCommit_v1.stat, startSlave_1a.diff, startSlave_1a.stat, StopSlave_impl_3205_NotForCommit_v1.diff, StopSlave_impl_3205_NotForCommit_v1.stat
>
>
> Add commands to start and stop the replication slave using properties or connection url. Example:
> 'jdbc:derby:<host><dbname>;startSlave=true';
> 'jdbc:derby:<host><dbname>;stopSlave=true';
> 'jdbc:derby:<host><dbname>;failover=true;
> Connection url options that must be recognized:
> startSlave=true
> stopSlave=true
> failover=true
> slaveHost=<host> (optional, defaults to localhost) (only for startSlave)
> slavePort=<port> (optional, defaults to 8001) (only for startSlave)
> See functional specification on Derby-2872 for further details.

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


[jira] Commented: (DERBY-3205) Replication: Add connection url command options for starting and stopping slave

Posted by "Øystein Grøvlen (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/DERBY-3205?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12559407#action_12559407 ] 

Øystein Grøvlen commented on DERBY-3205:
----------------------------------------

If I first try to start the slave with another user than the database
owner (DBO), and then try the DBO afterwards, the following happens:

ij> connect 'jdbc:derby:slaveDB;user=johndoe;password=pass;startSlave=true';
ERROR 08004: User 'JOHNDOE' cannot issue a replication operation on database 'slaveDB'. Only the database owner can perform this operation.
ij> connect 'jdbc:derby:slaveDB;user=oystein;password=pass;startSlave=true';
ERROR XRE09: Cannot start replication slave mode for database 'slaveDB'. The database has already been booted. 
ij>

Both users are defined as system users before creating the master
(derby.properties are shared between master and slave).



> Replication: Add connection url command options for starting and stopping slave
> -------------------------------------------------------------------------------
>
>                 Key: DERBY-3205
>                 URL: https://issues.apache.org/jira/browse/DERBY-3205
>             Project: Derby
>          Issue Type: Sub-task
>          Components: JDBC
>    Affects Versions: 10.4.0.0
>            Reporter: Jørgen Løland
>            Assignee: V.Narayanan
>         Attachments: derby-3205_startslave_dontcommit.diff, derby-3205_startslave_dontcommit.stat, failover_impl_3205_NotForCommit_v1.diff, failover_impl_3205_NotForCommit_v1.stat, startSlave_1a.diff, startSlave_1a.stat, startSlave_1b.diff, startSlave_1b.stat, startSlave_1c.diff, StopSlave_impl_3205_NotForCommit_v1.diff, StopSlave_impl_3205_NotForCommit_v1.stat
>
>
> Add commands to start and stop the replication slave using properties or connection url. Example:
> 'jdbc:derby:<host><dbname>;startSlave=true';
> 'jdbc:derby:<host><dbname>;stopSlave=true';
> 'jdbc:derby:<host><dbname>;failover=true;
> Connection url options that must be recognized:
> startSlave=true
> stopSlave=true
> failover=true
> slaveHost=<host> (optional, defaults to localhost) (only for startSlave)
> slavePort=<port> (optional, defaults to 8001) (only for startSlave)
> See functional specification on Derby-2872 for further details.

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


[jira] Commented: (DERBY-3205) Replication: Add connection url command options for starting and stopping slave

Posted by "Øystein Grøvlen (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/DERBY-3205?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12559413#action_12559413 ] 

Øystein Grøvlen commented on DERBY-3205:
----------------------------------------

I still get the assert if try to connect to a booted slave:

ij> connect 'jdbc:derby:slaveDB;user=oystein;password=pass;startSlave=true';
ERROR XRE08: Replication slave mode started successfully for database 'slaveDB'. Connection refused because the database is in replication slave mode. 
ij> connect 'jdbc:derby:slaveDB;user=johndoe;password=pass';
ERROR XJ001: Java exception: 'ASSERT FAILED Unexpected - There is no valid authentication service for the database!: org.apache.derby.shared.common.sanity.AssertFailure'.
ij> 

> Replication: Add connection url command options for starting and stopping slave
> -------------------------------------------------------------------------------
>
>                 Key: DERBY-3205
>                 URL: https://issues.apache.org/jira/browse/DERBY-3205
>             Project: Derby
>          Issue Type: Sub-task
>          Components: JDBC
>    Affects Versions: 10.4.0.0
>            Reporter: Jørgen Løland
>            Assignee: V.Narayanan
>         Attachments: derby-3205_startslave_dontcommit.diff, derby-3205_startslave_dontcommit.stat, failover_impl_3205_NotForCommit_v1.diff, failover_impl_3205_NotForCommit_v1.stat, startSlave_1a.diff, startSlave_1a.stat, startSlave_1b.diff, startSlave_1b.stat, startSlave_1c.diff, StopSlave_impl_3205_NotForCommit_v1.diff, StopSlave_impl_3205_NotForCommit_v1.stat
>
>
> Add commands to start and stop the replication slave using properties or connection url. Example:
> 'jdbc:derby:<host><dbname>;startSlave=true';
> 'jdbc:derby:<host><dbname>;stopSlave=true';
> 'jdbc:derby:<host><dbname>;failover=true;
> Connection url options that must be recognized:
> startSlave=true
> stopSlave=true
> failover=true
> slaveHost=<host> (optional, defaults to localhost) (only for startSlave)
> slavePort=<port> (optional, defaults to 8001) (only for startSlave)
> See functional specification on Derby-2872 for further details.

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


[jira] Assigned: (DERBY-3205) Replication: Add connection url command options for starting, stopping slave and for failover

Posted by "Jørgen Løland (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/DERBY-3205?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Jørgen Løland reassigned DERBY-3205:
------------------------------------

    Assignee: Jørgen Løland  (was: V.Narayanan)

Assigning myself to this issue since I submitted most of the slave-side url patches.

Apart from adding junit tests for the patches, the only work left on this issue is to enable the failover command on the slave side. I'll start working on slave side failover now

> Replication: Add connection url command options for starting, stopping slave and for failover
> ---------------------------------------------------------------------------------------------
>
>                 Key: DERBY-3205
>                 URL: https://issues.apache.org/jira/browse/DERBY-3205
>             Project: Derby
>          Issue Type: Sub-task
>          Components: JDBC
>    Affects Versions: 10.4.0.0
>            Reporter: Jørgen Løland
>            Assignee: Jørgen Løland
>         Attachments: derby-3205_startslave_dontcommit.diff, derby-3205_startslave_dontcommit.stat, failover_impl_3205_NotForCommit_v1.diff, failover_impl_3205_NotForCommit_v1.stat, failover_impl_3205_v1.diff, failover_impl_3205_v1.stat, failover_impl_3205_v2.diff, failover_impl_3205_v2.stat, failover_impl_3205_v3.diff, failover_impl_3205_v3.stat, failover_impl_3205_v4.diff, failover_impl_3205_v4.stat, Socket_Close_Fix_v1.diff, Socket_Close_Fix_v1.stat, startSlave_1a.diff, startSlave_1a.stat, startSlave_1b.diff, startSlave_1b.stat, startSlave_1c.diff, startSlave_1d.diff, StopSlave_impl_3205_NotForCommit_v1.diff, StopSlave_impl_3205_NotForCommit_v1.stat, stopSlave_v1a.diff, stopSlave_v1a.stat, stopSlave_v1b.diff, stopSlave_v1b.stat, stopSlave_v1c.diff, stopSlave_v1c.stat
>
>
> Add commands to start and stop the replication slave using properties or connection url. Example:
> 'jdbc:derby:<host><dbname>;startSlave=true';
> 'jdbc:derby:<host><dbname>;stopSlave=true';
> 'jdbc:derby:<host><dbname>;failover=true;
> Connection url options that must be recognized:
> startSlave=true
> stopSlave=true
> failover=true
> slaveHost=<host> (optional, defaults to localhost) (only for startSlave)
> slavePort=<port> (optional, defaults to 8001) (only for startSlave)
> See functional specification on Derby-2872 for further details.

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


[jira] Updated: (DERBY-3205) Replication: Add connection url command options for starting, stopping slave and for failover

Posted by "Jørgen Løland (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/DERBY-3205?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Jørgen Løland updated DERBY-3205:
---------------------------------

    Attachment: failover-slave-2a.diff
                failover-slave-2a.stat

Patch failover-slave 2a is a follow-up of 1a. It does:

M      java/engine/org/apache/derby/impl/jdbc/EmbedConnection.java

 - ensures that no other operation is used in the same conn
   attempt as failover (also added this check for all other
   repliation operations)

 - checks that the caller of master-side failover is db
   owner (also added to other master-side replication commands)

M      java/engine/org/apache/derby/impl/services/replication/slave/SlaveController.java

 - replication network connection is shutdown (including streams
   and socket) when failover is processed

All tests passed.

> Replication: Add connection url command options for starting, stopping slave and for failover
> ---------------------------------------------------------------------------------------------
>
>                 Key: DERBY-3205
>                 URL: https://issues.apache.org/jira/browse/DERBY-3205
>             Project: Derby
>          Issue Type: Sub-task
>          Components: JDBC
>    Affects Versions: 10.4.0.0
>            Reporter: Jørgen Løland
>            Assignee: Jørgen Løland
>         Attachments: derby-3205_startslave_dontcommit.diff, derby-3205_startslave_dontcommit.stat, failover-slave-1a.diff, failover-slave-1a.stat, failover-slave-2a.diff, failover-slave-2a.stat, failover_impl_3205_NotForCommit_v1.diff, failover_impl_3205_NotForCommit_v1.stat, failover_impl_3205_v1.diff, failover_impl_3205_v1.stat, failover_impl_3205_v2.diff, failover_impl_3205_v2.stat, failover_impl_3205_v3.diff, failover_impl_3205_v3.stat, failover_impl_3205_v4.diff, failover_impl_3205_v4.stat, Socket_Close_Fix_v1.diff, Socket_Close_Fix_v1.stat, startSlave_1a.diff, startSlave_1a.stat, startSlave_1b.diff, startSlave_1b.stat, startSlave_1c.diff, startSlave_1d.diff, StopSlave_impl_3205_NotForCommit_v1.diff, StopSlave_impl_3205_NotForCommit_v1.stat, stopSlave_v1a.diff, stopSlave_v1a.stat, stopSlave_v1b.diff, stopSlave_v1b.stat, stopSlave_v1c.diff, stopSlave_v1c.stat
>
>
> Add commands to start and stop the replication slave using properties or connection url. Example:
> 'jdbc:derby:<host><dbname>;startSlave=true';
> 'jdbc:derby:<host><dbname>;stopSlave=true';
> 'jdbc:derby:<host><dbname>;failover=true;
> Connection url options that must be recognized:
> startSlave=true
> stopSlave=true
> failover=true
> slaveHost=<host> (optional, defaults to localhost) (only for startSlave)
> slavePort=<port> (optional, defaults to 8001) (only for startSlave)
> See functional specification on Derby-2872 for further details.

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


[jira] Updated: (DERBY-3205) Replication: Add connection url command options for starting, stopping slave and for failover

Posted by "Jørgen Løland (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/DERBY-3205?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Jørgen Løland updated DERBY-3205:
---------------------------------

    Derby Info: [Patch Available]

All tests passed for patch failover slave v1a

> Replication: Add connection url command options for starting, stopping slave and for failover
> ---------------------------------------------------------------------------------------------
>
>                 Key: DERBY-3205
>                 URL: https://issues.apache.org/jira/browse/DERBY-3205
>             Project: Derby
>          Issue Type: Sub-task
>          Components: JDBC
>    Affects Versions: 10.4.0.0
>            Reporter: Jørgen Løland
>            Assignee: Jørgen Løland
>         Attachments: derby-3205_startslave_dontcommit.diff, derby-3205_startslave_dontcommit.stat, failover-slave-1a.diff, failover-slave-1a.stat, failover_impl_3205_NotForCommit_v1.diff, failover_impl_3205_NotForCommit_v1.stat, failover_impl_3205_v1.diff, failover_impl_3205_v1.stat, failover_impl_3205_v2.diff, failover_impl_3205_v2.stat, failover_impl_3205_v3.diff, failover_impl_3205_v3.stat, failover_impl_3205_v4.diff, failover_impl_3205_v4.stat, Socket_Close_Fix_v1.diff, Socket_Close_Fix_v1.stat, startSlave_1a.diff, startSlave_1a.stat, startSlave_1b.diff, startSlave_1b.stat, startSlave_1c.diff, startSlave_1d.diff, StopSlave_impl_3205_NotForCommit_v1.diff, StopSlave_impl_3205_NotForCommit_v1.stat, stopSlave_v1a.diff, stopSlave_v1a.stat, stopSlave_v1b.diff, stopSlave_v1b.stat, stopSlave_v1c.diff, stopSlave_v1c.stat
>
>
> Add commands to start and stop the replication slave using properties or connection url. Example:
> 'jdbc:derby:<host><dbname>;startSlave=true';
> 'jdbc:derby:<host><dbname>;stopSlave=true';
> 'jdbc:derby:<host><dbname>;failover=true;
> Connection url options that must be recognized:
> startSlave=true
> stopSlave=true
> failover=true
> slaveHost=<host> (optional, defaults to localhost) (only for startSlave)
> slavePort=<port> (optional, defaults to 8001) (only for startSlave)
> See functional specification on Derby-2872 for further details.

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


[jira] Updated: (DERBY-3205) Replication: Add connection url command options for starting, stopping slave and for failover

Posted by "V.Narayanan (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/DERBY-3205?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

V.Narayanan updated DERBY-3205:
-------------------------------

    Attachment: failover_impl_3205_v3.stat
                failover_impl_3205_v3.diff

fixed the conflicts in v2 of the failover patch.

> Replication: Add connection url command options for starting, stopping slave and for failover
> ---------------------------------------------------------------------------------------------
>
>                 Key: DERBY-3205
>                 URL: https://issues.apache.org/jira/browse/DERBY-3205
>             Project: Derby
>          Issue Type: Sub-task
>          Components: JDBC
>    Affects Versions: 10.4.0.0
>            Reporter: Jørgen Løland
>            Assignee: V.Narayanan
>         Attachments: derby-3205_startslave_dontcommit.diff, derby-3205_startslave_dontcommit.stat, failover_impl_3205_NotForCommit_v1.diff, failover_impl_3205_NotForCommit_v1.stat, failover_impl_3205_v1.diff, failover_impl_3205_v1.stat, failover_impl_3205_v2.diff, failover_impl_3205_v2.stat, failover_impl_3205_v3.diff, failover_impl_3205_v3.stat, Socket_Close_Fix_v1.diff, Socket_Close_Fix_v1.stat, startSlave_1a.diff, startSlave_1a.stat, startSlave_1b.diff, startSlave_1b.stat, startSlave_1c.diff, startSlave_1d.diff, StopSlave_impl_3205_NotForCommit_v1.diff, StopSlave_impl_3205_NotForCommit_v1.stat, stopSlave_v1a.diff, stopSlave_v1a.stat, stopSlave_v1b.diff, stopSlave_v1b.stat, stopSlave_v1c.diff, stopSlave_v1c.stat
>
>
> Add commands to start and stop the replication slave using properties or connection url. Example:
> 'jdbc:derby:<host><dbname>;startSlave=true';
> 'jdbc:derby:<host><dbname>;stopSlave=true';
> 'jdbc:derby:<host><dbname>;failover=true;
> Connection url options that must be recognized:
> startSlave=true
> stopSlave=true
> failover=true
> slaveHost=<host> (optional, defaults to localhost) (only for startSlave)
> slavePort=<port> (optional, defaults to 8001) (only for startSlave)
> See functional specification on Derby-2872 for further details.

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


[jira] Updated: (DERBY-3205) Replication: Add connection url command options for starting, stopping slave and for failover

Posted by "Jørgen Løland (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/DERBY-3205?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Jørgen Løland updated DERBY-3205:
---------------------------------

    Derby Info: [Patch Available]

> Replication: Add connection url command options for starting, stopping slave and for failover
> ---------------------------------------------------------------------------------------------
>
>                 Key: DERBY-3205
>                 URL: https://issues.apache.org/jira/browse/DERBY-3205
>             Project: Derby
>          Issue Type: Sub-task
>          Components: JDBC
>    Affects Versions: 10.4.0.0
>            Reporter: Jørgen Løland
>            Assignee: Jørgen Løland
>         Attachments: derby-3205_startslave_dontcommit.diff, derby-3205_startslave_dontcommit.stat, failover-slave-1a.diff, failover-slave-1a.stat, failover-slave-2a.diff, failover-slave-2a.stat, failover_impl_3205_NotForCommit_v1.diff, failover_impl_3205_NotForCommit_v1.stat, failover_impl_3205_v1.diff, failover_impl_3205_v1.stat, failover_impl_3205_v2.diff, failover_impl_3205_v2.stat, failover_impl_3205_v3.diff, failover_impl_3205_v3.stat, failover_impl_3205_v4.diff, failover_impl_3205_v4.stat, Socket_Close_Fix_v1.diff, Socket_Close_Fix_v1.stat, startSlave_1a.diff, startSlave_1a.stat, startSlave_1b.diff, startSlave_1b.stat, startSlave_1c.diff, startSlave_1d.diff, StopSlave_impl_3205_NotForCommit_v1.diff, StopSlave_impl_3205_NotForCommit_v1.stat, stopSlave_v1a.diff, stopSlave_v1a.stat, stopSlave_v1b.diff, stopSlave_v1b.stat, stopSlave_v1c.diff, stopSlave_v1c.stat
>
>
> Add commands to start and stop the replication slave using properties or connection url. Example:
> 'jdbc:derby:<host><dbname>;startSlave=true';
> 'jdbc:derby:<host><dbname>;stopSlave=true';
> 'jdbc:derby:<host><dbname>;failover=true;
> Connection url options that must be recognized:
> startSlave=true
> stopSlave=true
> failover=true
> slaveHost=<host> (optional, defaults to localhost) (only for startSlave)
> slavePort=<port> (optional, defaults to 8001) (only for startSlave)
> See functional specification on Derby-2872 for further details.

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


[jira] Closed: (DERBY-3205) Replication: Add connection url command options for starting, stopping slave and for failover

Posted by "Jørgen Løland (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/DERBY-3205?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Jørgen Løland closed DERBY-3205.
--------------------------------


> Replication: Add connection url command options for starting, stopping slave and for failover
> ---------------------------------------------------------------------------------------------
>
>                 Key: DERBY-3205
>                 URL: https://issues.apache.org/jira/browse/DERBY-3205
>             Project: Derby
>          Issue Type: Sub-task
>          Components: JDBC
>    Affects Versions: 10.4.0.0
>            Reporter: Jørgen Løland
>            Assignee: Jørgen Løland
>             Fix For: 10.4.0.0
>
>         Attachments: derby-3205_startslave_dontcommit.diff, derby-3205_startslave_dontcommit.stat, failover-slave-1a.diff, failover-slave-1a.stat, failover-slave-2a.diff, failover-slave-2a.stat, failover-slave-2b.diff, failover_impl_3205_NotForCommit_v1.diff, failover_impl_3205_NotForCommit_v1.stat, failover_impl_3205_v1.diff, failover_impl_3205_v1.stat, failover_impl_3205_v2.diff, failover_impl_3205_v2.stat, failover_impl_3205_v3.diff, failover_impl_3205_v3.stat, failover_impl_3205_v4.diff, failover_impl_3205_v4.stat, Socket_Close_Fix_v1.diff, Socket_Close_Fix_v1.stat, startSlave_1a.diff, startSlave_1a.stat, startSlave_1b.diff, startSlave_1b.stat, startSlave_1c.diff, startSlave_1d.diff, StopSlave_impl_3205_NotForCommit_v1.diff, StopSlave_impl_3205_NotForCommit_v1.stat, stopSlave_v1a.diff, stopSlave_v1a.stat, stopSlave_v1b.diff, stopSlave_v1b.stat, stopSlave_v1c.diff, stopSlave_v1c.stat
>
>
> Add commands to start and stop the replication slave using properties or connection url. Example:
> 'jdbc:derby:<host><dbname>;startSlave=true';
> 'jdbc:derby:<host><dbname>;stopSlave=true';
> 'jdbc:derby:<host><dbname>;failover=true;
> Connection url options that must be recognized:
> startSlave=true
> stopSlave=true
> failover=true
> slaveHost=<host> (optional, defaults to localhost) (only for startSlave)
> slavePort=<port> (optional, defaults to 8001) (only for startSlave)
> See functional specification on Derby-2872 for further details.

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


[jira] Commented: (DERBY-3205) Replication: Add connection url command options for starting, stopping slave and for failover

Posted by "Jørgen Løland (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/DERBY-3205?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12564782#action_12564782 ] 

Jørgen Løland commented on DERBY-3205:
--------------------------------------

Thanks for committing the patch, Øystein.

> One thing that probably needs correction is the Javadoc of EmbedConnection#handleStopReplicationSlave which says "this operation will cause SlaveDatabase to call internalStopReplicationSlave". This doe not seem to be correct. 

I agree - the javadoc could be clearer. But it wil, in fact, cause SlaveDatabase to call internalStopReplicationSlave from the thread used to boot services. After the thread in LogToFile.recover() is told to throw an exception (LogToFile.stopReplicationSlaveMode), the exception is propagates all the way down to SlaveDatabase and causes handleShutdown to be called.

> I do not understand your comment on 2e. about the TransactionResource needed to be cleaned. When you set up a new connection, don't you get a new TransactionResource? If so, I do not understand why you need to create a new TransactionResource just to clean it. 

I'm actually not sure about how the connection/transactionresource code works. It could be the root connection that messes things up.

> Replication: Add connection url command options for starting, stopping slave and for failover
> ---------------------------------------------------------------------------------------------
>
>                 Key: DERBY-3205
>                 URL: https://issues.apache.org/jira/browse/DERBY-3205
>             Project: Derby
>          Issue Type: Sub-task
>          Components: JDBC
>    Affects Versions: 10.4.0.0
>            Reporter: Jørgen Løland
>            Assignee: V.Narayanan
>         Attachments: derby-3205_startslave_dontcommit.diff, derby-3205_startslave_dontcommit.stat, failover_impl_3205_NotForCommit_v1.diff, failover_impl_3205_NotForCommit_v1.stat, failover_impl_3205_v1.diff, failover_impl_3205_v1.stat, failover_impl_3205_v2.diff, failover_impl_3205_v2.stat, Socket_Close_Fix_v1.diff, Socket_Close_Fix_v1.stat, startSlave_1a.diff, startSlave_1a.stat, startSlave_1b.diff, startSlave_1b.stat, startSlave_1c.diff, startSlave_1d.diff, StopSlave_impl_3205_NotForCommit_v1.diff, StopSlave_impl_3205_NotForCommit_v1.stat, stopSlave_v1a.diff, stopSlave_v1a.stat, stopSlave_v1b.diff, stopSlave_v1b.stat, stopSlave_v1c.diff, stopSlave_v1c.stat
>
>
> Add commands to start and stop the replication slave using properties or connection url. Example:
> 'jdbc:derby:<host><dbname>;startSlave=true';
> 'jdbc:derby:<host><dbname>;stopSlave=true';
> 'jdbc:derby:<host><dbname>;failover=true;
> Connection url options that must be recognized:
> startSlave=true
> stopSlave=true
> failover=true
> slaveHost=<host> (optional, defaults to localhost) (only for startSlave)
> slavePort=<port> (optional, defaults to 8001) (only for startSlave)
> See functional specification on Derby-2872 for further details.

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


[jira] Commented: (DERBY-3205) Replication: Add connection url command options for starting, stopping slave and for failover

Posted by "Øystein Grøvlen (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/DERBY-3205?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12565352#action_12565352 ] 

Øystein Grøvlen commented on DERBY-3205:
----------------------------------------

After executing a failover, I am told that the database is shut down, but I still able to use the connection to access the database:

ij version 10.4
ij> connect 'jdbc:derby:masterDB;user=oystein;password=pass';
ij> call syscs_util.syscs_freeze_database();
0 rows inserted/updated/deleted
ij> connect 'jdbc:derby:masterDB;user=oystein;password=pass;startMaster=true;slaveHost=localhost';
ij(CONNECTION1)> call syscs_util.syscs_unfreeze_database();
0 rows inserted/updated/deleted
ij(CONNECTION1)> connect 'jdbc:derby:masterDB;user=oystein;password=pass;failover=true';
ERROR XRE20: Failover performed successfully for database 'null', the database has been shutdown.
ij(CONNECTION1)> select * from t;
I          
-----------
1          
2          
3          
4          
5          
6          
7          
8          
9          
10         
10         

11 rows selected
ij(CONNECTION1)> 

> Replication: Add connection url command options for starting, stopping slave and for failover
> ---------------------------------------------------------------------------------------------
>
>                 Key: DERBY-3205
>                 URL: https://issues.apache.org/jira/browse/DERBY-3205
>             Project: Derby
>          Issue Type: Sub-task
>          Components: JDBC
>    Affects Versions: 10.4.0.0
>            Reporter: Jørgen Løland
>            Assignee: V.Narayanan
>         Attachments: derby-3205_startslave_dontcommit.diff, derby-3205_startslave_dontcommit.stat, failover_impl_3205_NotForCommit_v1.diff, failover_impl_3205_NotForCommit_v1.stat, failover_impl_3205_v1.diff, failover_impl_3205_v1.stat, failover_impl_3205_v2.diff, failover_impl_3205_v2.stat, failover_impl_3205_v3.diff, failover_impl_3205_v3.stat, Socket_Close_Fix_v1.diff, Socket_Close_Fix_v1.stat, startSlave_1a.diff, startSlave_1a.stat, startSlave_1b.diff, startSlave_1b.stat, startSlave_1c.diff, startSlave_1d.diff, StopSlave_impl_3205_NotForCommit_v1.diff, StopSlave_impl_3205_NotForCommit_v1.stat, stopSlave_v1a.diff, stopSlave_v1a.stat, stopSlave_v1b.diff, stopSlave_v1b.stat, stopSlave_v1c.diff, stopSlave_v1c.stat
>
>
> Add commands to start and stop the replication slave using properties or connection url. Example:
> 'jdbc:derby:<host><dbname>;startSlave=true';
> 'jdbc:derby:<host><dbname>;stopSlave=true';
> 'jdbc:derby:<host><dbname>;failover=true;
> Connection url options that must be recognized:
> startSlave=true
> stopSlave=true
> failover=true
> slaveHost=<host> (optional, defaults to localhost) (only for startSlave)
> slavePort=<port> (optional, defaults to 8001) (only for startSlave)
> See functional specification on Derby-2872 for further details.

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


[jira] Commented: (DERBY-3205) Replication: Add connection url command options for starting, stopping slave and for failover

Posted by "V.Narayanan (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/DERBY-3205?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12565737#action_12565737 ] 

V.Narayanan commented on DERBY-3205:
------------------------------------

Thank you for the commit and the guidance through the patch Oystein :).

Narayanan




> Replication: Add connection url command options for starting, stopping slave and for failover
> ---------------------------------------------------------------------------------------------
>
>                 Key: DERBY-3205
>                 URL: https://issues.apache.org/jira/browse/DERBY-3205
>             Project: Derby
>          Issue Type: Sub-task
>          Components: JDBC
>    Affects Versions: 10.4.0.0
>            Reporter: Jørgen Løland
>            Assignee: V.Narayanan
>         Attachments: derby-3205_startslave_dontcommit.diff, derby-3205_startslave_dontcommit.stat, failover_impl_3205_NotForCommit_v1.diff, failover_impl_3205_NotForCommit_v1.stat, failover_impl_3205_v1.diff, failover_impl_3205_v1.stat, failover_impl_3205_v2.diff, failover_impl_3205_v2.stat, failover_impl_3205_v3.diff, failover_impl_3205_v3.stat, failover_impl_3205_v4.diff, failover_impl_3205_v4.stat, Socket_Close_Fix_v1.diff, Socket_Close_Fix_v1.stat, startSlave_1a.diff, startSlave_1a.stat, startSlave_1b.diff, startSlave_1b.stat, startSlave_1c.diff, startSlave_1d.diff, StopSlave_impl_3205_NotForCommit_v1.diff, StopSlave_impl_3205_NotForCommit_v1.stat, stopSlave_v1a.diff, stopSlave_v1a.stat, stopSlave_v1b.diff, stopSlave_v1b.stat, stopSlave_v1c.diff, stopSlave_v1c.stat
>
>
> Add commands to start and stop the replication slave using properties or connection url. Example:
> 'jdbc:derby:<host><dbname>;startSlave=true';
> 'jdbc:derby:<host><dbname>;stopSlave=true';
> 'jdbc:derby:<host><dbname>;failover=true;
> Connection url options that must be recognized:
> startSlave=true
> stopSlave=true
> failover=true
> slaveHost=<host> (optional, defaults to localhost) (only for startSlave)
> slavePort=<port> (optional, defaults to 8001) (only for startSlave)
> See functional specification on Derby-2872 for further details.

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


[jira] Commented: (DERBY-3205) Replication: Add connection url command options for starting, stopping slave and for failover

Posted by "Øystein Grøvlen (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/DERBY-3205?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12565295#action_12565295 ] 

Øystein Grøvlen commented on DERBY-3205:
----------------------------------------

Thanks for the patch, Narayanan. v3 of the failover patch looks very good.
I have only a few minor comments.

1. EmbedConnection#handleFailover: There seems to be a cut&paste error
   for comment in handleFailover (talks about ready to start
   replication)

2. a. Exception javadocs:  A missing comment after "If the failover
      succeeds"
   b. I think you could use @see a bit more instead of repeating the
      javadoc.  Makes it less brittle if the behavior changes.

3. RawStore#failover: Use another version of newException to chain the
   caught exception, se, to the REPLICATION_FAILOVER_UNSUCCESSFUL
   exception.


> Replication: Add connection url command options for starting, stopping slave and for failover
> ---------------------------------------------------------------------------------------------
>
>                 Key: DERBY-3205
>                 URL: https://issues.apache.org/jira/browse/DERBY-3205
>             Project: Derby
>          Issue Type: Sub-task
>          Components: JDBC
>    Affects Versions: 10.4.0.0
>            Reporter: Jørgen Løland
>            Assignee: V.Narayanan
>         Attachments: derby-3205_startslave_dontcommit.diff, derby-3205_startslave_dontcommit.stat, failover_impl_3205_NotForCommit_v1.diff, failover_impl_3205_NotForCommit_v1.stat, failover_impl_3205_v1.diff, failover_impl_3205_v1.stat, failover_impl_3205_v2.diff, failover_impl_3205_v2.stat, failover_impl_3205_v3.diff, failover_impl_3205_v3.stat, Socket_Close_Fix_v1.diff, Socket_Close_Fix_v1.stat, startSlave_1a.diff, startSlave_1a.stat, startSlave_1b.diff, startSlave_1b.stat, startSlave_1c.diff, startSlave_1d.diff, StopSlave_impl_3205_NotForCommit_v1.diff, StopSlave_impl_3205_NotForCommit_v1.stat, stopSlave_v1a.diff, stopSlave_v1a.stat, stopSlave_v1b.diff, stopSlave_v1b.stat, stopSlave_v1c.diff, stopSlave_v1c.stat
>
>
> Add commands to start and stop the replication slave using properties or connection url. Example:
> 'jdbc:derby:<host><dbname>;startSlave=true';
> 'jdbc:derby:<host><dbname>;stopSlave=true';
> 'jdbc:derby:<host><dbname>;failover=true;
> Connection url options that must be recognized:
> startSlave=true
> stopSlave=true
> failover=true
> slaveHost=<host> (optional, defaults to localhost) (only for startSlave)
> slavePort=<port> (optional, defaults to 8001) (only for startSlave)
> See functional specification on Derby-2872 for further details.

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


[jira] Updated: (DERBY-3205) Replication: Add connection url command options for starting and stopping slave

Posted by "Jørgen Løland (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/DERBY-3205?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Jørgen Løland updated DERBY-3205:
---------------------------------

    Attachment: startSlave_1b.diff
                startSlave_1b.stat

The attached startslave patch, v1b, adds exceptions in the following cases:

* if startSlave is combined with any of create/shutdown/encrypt*/upgrade*
* if startSlave is requested on an already booted database
* if startSlave completes successfully, throws a more descriptive exception than v1a

The patch is ready for review.

> Replication: Add connection url command options for starting and stopping slave
> -------------------------------------------------------------------------------
>
>                 Key: DERBY-3205
>                 URL: https://issues.apache.org/jira/browse/DERBY-3205
>             Project: Derby
>          Issue Type: Sub-task
>          Components: JDBC
>    Affects Versions: 10.4.0.0
>            Reporter: Jørgen Løland
>            Assignee: V.Narayanan
>         Attachments: derby-3205_startslave_dontcommit.diff, derby-3205_startslave_dontcommit.stat, failover_impl_3205_NotForCommit_v1.diff, failover_impl_3205_NotForCommit_v1.stat, startSlave_1a.diff, startSlave_1a.stat, startSlave_1b.diff, startSlave_1b.stat, StopSlave_impl_3205_NotForCommit_v1.diff, StopSlave_impl_3205_NotForCommit_v1.stat
>
>
> Add commands to start and stop the replication slave using properties or connection url. Example:
> 'jdbc:derby:<host><dbname>;startSlave=true';
> 'jdbc:derby:<host><dbname>;stopSlave=true';
> 'jdbc:derby:<host><dbname>;failover=true;
> Connection url options that must be recognized:
> startSlave=true
> stopSlave=true
> failover=true
> slaveHost=<host> (optional, defaults to localhost) (only for startSlave)
> slavePort=<port> (optional, defaults to 8001) (only for startSlave)
> See functional specification on Derby-2872 for further details.

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


[jira] Updated: (DERBY-3205) Replication: Add connection url command options for starting, stopping slave and for failover

Posted by "Jørgen Løland (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/DERBY-3205?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Jørgen Løland updated DERBY-3205:
---------------------------------

    Attachment: stopSlave_v1c.diff
                stopSlave_v1c.stat

Thanks for reviewing stopSlave v1b Øystein.

I have addressed most of your comments in patch 1c. Comments:

2e: When a database is shut down, the TransactionResource needs to be cleaned. I found no other way of doing this than setting up a connection.

3a: I don't know why the message is logged twice in derby.log. The same applies to startSlave. I will fix this in a later patch.

4a: You are right, but this is not harmful since recover() is only allowed to redo log files that have been completed. The only problem with letting recover complete redo of a log file is that it may take a little longer before the database is shut down. To fix this, we could use a reference to the recovery thread and interrupt it, or we could make FileLogger check for the replicationSlaveException between every redone log record. However, I don't think this added complexity is justified at the moment. At least not until we get feedback that this is unacceptable. Unless you feel strongly about it, I will not address this now.

5b: XRE40 is thrown from locations where the database name is unknown (in BasicDatabase). I'm reluctant to add the dbname to the method signature only to get it into the exception text, especially since this exception is only thrown from connection-attempts that have to specify the db name.

> Replication: Add connection url command options for starting, stopping slave and for failover
> ---------------------------------------------------------------------------------------------
>
>                 Key: DERBY-3205
>                 URL: https://issues.apache.org/jira/browse/DERBY-3205
>             Project: Derby
>          Issue Type: Sub-task
>          Components: JDBC
>    Affects Versions: 10.4.0.0
>            Reporter: Jørgen Løland
>            Assignee: V.Narayanan
>         Attachments: derby-3205_startslave_dontcommit.diff, derby-3205_startslave_dontcommit.stat, failover_impl_3205_NotForCommit_v1.diff, failover_impl_3205_NotForCommit_v1.stat, failover_impl_3205_v1.diff, failover_impl_3205_v1.stat, failover_impl_3205_v2.diff, failover_impl_3205_v2.stat, Socket_Close_Fix_v1.diff, Socket_Close_Fix_v1.stat, startSlave_1a.diff, startSlave_1a.stat, startSlave_1b.diff, startSlave_1b.stat, startSlave_1c.diff, startSlave_1d.diff, StopSlave_impl_3205_NotForCommit_v1.diff, StopSlave_impl_3205_NotForCommit_v1.stat, stopSlave_v1a.diff, stopSlave_v1a.stat, stopSlave_v1b.diff, stopSlave_v1b.stat, stopSlave_v1c.diff, stopSlave_v1c.stat
>
>
> Add commands to start and stop the replication slave using properties or connection url. Example:
> 'jdbc:derby:<host><dbname>;startSlave=true';
> 'jdbc:derby:<host><dbname>;stopSlave=true';
> 'jdbc:derby:<host><dbname>;failover=true;
> Connection url options that must be recognized:
> startSlave=true
> stopSlave=true
> failover=true
> slaveHost=<host> (optional, defaults to localhost) (only for startSlave)
> slavePort=<port> (optional, defaults to 8001) (only for startSlave)
> See functional specification on Derby-2872 for further details.

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


[jira] Issue Comment Edited: (DERBY-3205) Replication: Add connection url command options for starting and stopping slave

Posted by "Øystein Grøvlen (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/DERBY-3205?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12558631#action_12558631 ] 

oysteing edited comment on DERBY-3205 at 1/14/08 7:18 AM:
-----------------------------------------------------------------

I applied the startSlave_1a.diff patch, and was able to start a slave, and a master was able to connect.

However, I am not quite satisfied with the messages I got:

> java -jar jars/sane/derbyrun.jar ij
ij version 10.4
ij> connect 'jdbc:derby:slaveDB;startSlave=true';
ERROR 08004: Connection refused to database 'slaveDB' because it is in replication slave mode.
ij> connect 'jdbc:derby:slaveDB';
ERROR XJ001: Java exception: 'ASSERT FAILED Unexpected - There is no valid authentication service for the database!: org.apache.derby.shared.common.sanity.AssertFailure'.
ij> connect 'jdbc:derby:slaveDB;startSlave=true';
ERROR XJ001: Java exception: 'ASSERT FAILED Unexpected - There is no valid authentication service for the database!: org.apache.derby.shared.common.sanity.AssertFailure'.
ij> 

For the first connection, I think it would be good if it said something
about the slave having been started.  The current message may lead one
to think that the database was already in slave mode before the
connection was attempted.

For the second connection, I would have expected the first message.  I
have not tried to run an insane version to see what happens when the
assert is not hit.

For the third connection, it would be good if a warning was given that
the database was already in slave mode.


      was (Author: oysteing):
    I applied the startSlave_1a.diff patch, and was able to start a slave
, and a master was able to connect.

However, I am not quite the messages I got:

> java -jar jars/sane/derbyrun.jar ij
ij version 10.4
ij> connect 'jdbc:derby:slaveDB;startSlave=true';
ERROR 08004: Connection refused to database 'slaveDB' because it is in replication slave mode.
ij> connect 'jdbc:derby:slaveDB';
ERROR XJ001: Java exception: 'ASSERT FAILED Unexpected - There is no valid authentication service for the database!: org.apache.derby.shared.common.sanity.AssertFailure'.
ij> connect 'jdbc:derby:slaveDB;startSlave=true';
ERROR XJ001: Java exception: 'ASSERT FAILED Unexpected - There is no valid authentication service for the database!: org.apache.derby.shared.common.sanity.AssertFailure'.
ij> 

For the first connection, I think it would be good if it said something
about the slave having been started.  The current message may lead one
to think that the database was already in slave mode before the
connection was attempted.

For the second connection, I would have expected the first message.  I
have not tried to run an insane version to see what happens when the
assert is not hit.

For the third connection, it would be good if a warning was given that
the database was already in slave mode.

  
> Replication: Add connection url command options for starting and stopping slave
> -------------------------------------------------------------------------------
>
>                 Key: DERBY-3205
>                 URL: https://issues.apache.org/jira/browse/DERBY-3205
>             Project: Derby
>          Issue Type: Sub-task
>          Components: JDBC
>    Affects Versions: 10.4.0.0
>            Reporter: Jørgen Løland
>            Assignee: V.Narayanan
>         Attachments: derby-3205_startslave_dontcommit.diff, derby-3205_startslave_dontcommit.stat, failover_impl_3205_NotForCommit_v1.diff, failover_impl_3205_NotForCommit_v1.stat, startSlave_1a.diff, startSlave_1a.stat, StopSlave_impl_3205_NotForCommit_v1.diff, StopSlave_impl_3205_NotForCommit_v1.stat
>
>
> Add commands to start and stop the replication slave using properties or connection url. Example:
> 'jdbc:derby:<host><dbname>;startSlave=true';
> 'jdbc:derby:<host><dbname>;stopSlave=true';
> 'jdbc:derby:<host><dbname>;failover=true;
> Connection url options that must be recognized:
> startSlave=true
> stopSlave=true
> failover=true
> slaveHost=<host> (optional, defaults to localhost) (only for startSlave)
> slavePort=<port> (optional, defaults to 8001) (only for startSlave)
> See functional specification on Derby-2872 for further details.

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


[jira] Updated: (DERBY-3205) Replication: Add connection url command options for starting and stopping slave

Posted by "Jørgen Løland (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/DERBY-3205?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Jørgen Løland updated DERBY-3205:
---------------------------------

    Attachment: startSlave_1a.diff
                startSlave_1a.stat

Hi Narayanan,

While working on derby-3184, I needed the startSlave command for testing. The attached patch, startSlave_1a, is extracted from that work. Have a look at it and see if it fits into your plan for this issue. All tests passed for this patch combined with patch 2a on derby-3184.

> Replication: Add connection url command options for starting and stopping slave
> -------------------------------------------------------------------------------
>
>                 Key: DERBY-3205
>                 URL: https://issues.apache.org/jira/browse/DERBY-3205
>             Project: Derby
>          Issue Type: Sub-task
>          Components: JDBC
>    Affects Versions: 10.4.0.0
>            Reporter: Jørgen Løland
>            Assignee: V.Narayanan
>         Attachments: derby-3205_startslave_dontcommit.diff, derby-3205_startslave_dontcommit.stat, failover_impl_3205_NotForCommit_v1.diff, failover_impl_3205_NotForCommit_v1.stat, startSlave_1a.diff, startSlave_1a.stat, StopSlave_impl_3205_NotForCommit_v1.diff, StopSlave_impl_3205_NotForCommit_v1.stat
>
>
> Add commands to start and stop the replication slave using properties or connection url. Example:
> 'jdbc:derby:<host><dbname>;startSlave=true';
> 'jdbc:derby:<host><dbname>;stopSlave=true';
> 'jdbc:derby:<host><dbname>;failover=true;
> Connection url options that must be recognized:
> startSlave=true
> stopSlave=true
> failover=true
> slaveHost=<host> (optional, defaults to localhost) (only for startSlave)
> slavePort=<port> (optional, defaults to 8001) (only for startSlave)
> See functional specification on Derby-2872 for further details.

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


[jira] Commented: (DERBY-3205) Replication: Add connection url command options for starting, stopping slave and for failover

Posted by "Øystein Grøvlen (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/DERBY-3205?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12572052#action_12572052 ] 

Øystein Grøvlen commented on DERBY-3205:
----------------------------------------

One concern is what will have if the master process hangs or something.  What will then happen to the TCP connection?  I guess one solution is that the administrator will have to kill the master process if it becomes unresponsive, before attempting failover on the slave.

I am glad that my question on authentication made you think of other issues.  Anyhow, it would be good if you could make the comment a bit clearer. 

> Replication: Add connection url command options for starting, stopping slave and for failover
> ---------------------------------------------------------------------------------------------
>
>                 Key: DERBY-3205
>                 URL: https://issues.apache.org/jira/browse/DERBY-3205
>             Project: Derby
>          Issue Type: Sub-task
>          Components: JDBC
>    Affects Versions: 10.4.0.0
>            Reporter: Jørgen Løland
>            Assignee: Jørgen Løland
>         Attachments: derby-3205_startslave_dontcommit.diff, derby-3205_startslave_dontcommit.stat, failover-slave-1a.diff, failover-slave-1a.stat, failover_impl_3205_NotForCommit_v1.diff, failover_impl_3205_NotForCommit_v1.stat, failover_impl_3205_v1.diff, failover_impl_3205_v1.stat, failover_impl_3205_v2.diff, failover_impl_3205_v2.stat, failover_impl_3205_v3.diff, failover_impl_3205_v3.stat, failover_impl_3205_v4.diff, failover_impl_3205_v4.stat, Socket_Close_Fix_v1.diff, Socket_Close_Fix_v1.stat, startSlave_1a.diff, startSlave_1a.stat, startSlave_1b.diff, startSlave_1b.stat, startSlave_1c.diff, startSlave_1d.diff, StopSlave_impl_3205_NotForCommit_v1.diff, StopSlave_impl_3205_NotForCommit_v1.stat, stopSlave_v1a.diff, stopSlave_v1a.stat, stopSlave_v1b.diff, stopSlave_v1b.stat, stopSlave_v1c.diff, stopSlave_v1c.stat
>
>
> Add commands to start and stop the replication slave using properties or connection url. Example:
> 'jdbc:derby:<host><dbname>;startSlave=true';
> 'jdbc:derby:<host><dbname>;stopSlave=true';
> 'jdbc:derby:<host><dbname>;failover=true;
> Connection url options that must be recognized:
> startSlave=true
> stopSlave=true
> failover=true
> slaveHost=<host> (optional, defaults to localhost) (only for startSlave)
> slavePort=<port> (optional, defaults to 8001) (only for startSlave)
> See functional specification on Derby-2872 for further details.

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


[jira] Updated: (DERBY-3205) Replication: Add connection url command options for starting, stopping slave and for failover

Posted by "V.Narayanan (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/DERBY-3205?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

V.Narayanan updated DERBY-3205:
-------------------------------

    Summary: Replication: Add connection url command options for starting, stopping slave and for failover  (was: Replication: Add connection url command options for starting and stopping slave)

This patch has been used to submit patches for the failover url also hence
updating the issue description to reflect the same.

> Replication: Add connection url command options for starting, stopping slave and for failover
> ---------------------------------------------------------------------------------------------
>
>                 Key: DERBY-3205
>                 URL: https://issues.apache.org/jira/browse/DERBY-3205
>             Project: Derby
>          Issue Type: Sub-task
>          Components: JDBC
>    Affects Versions: 10.4.0.0
>            Reporter: Jørgen Løland
>            Assignee: V.Narayanan
>         Attachments: derby-3205_startslave_dontcommit.diff, derby-3205_startslave_dontcommit.stat, failover_impl_3205_NotForCommit_v1.diff, failover_impl_3205_NotForCommit_v1.stat, startSlave_1a.diff, startSlave_1a.stat, startSlave_1b.diff, startSlave_1b.stat, startSlave_1c.diff, startSlave_1d.diff, StopSlave_impl_3205_NotForCommit_v1.diff, StopSlave_impl_3205_NotForCommit_v1.stat
>
>
> Add commands to start and stop the replication slave using properties or connection url. Example:
> 'jdbc:derby:<host><dbname>;startSlave=true';
> 'jdbc:derby:<host><dbname>;stopSlave=true';
> 'jdbc:derby:<host><dbname>;failover=true;
> Connection url options that must be recognized:
> startSlave=true
> stopSlave=true
> failover=true
> slaveHost=<host> (optional, defaults to localhost) (only for startSlave)
> slavePort=<port> (optional, defaults to 8001) (only for startSlave)
> See functional specification on Derby-2872 for further details.

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


[jira] Updated: (DERBY-3205) Replication: Add connection url command options for starting, stopping slave and for failover

Posted by "V.Narayanan (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/DERBY-3205?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

V.Narayanan updated DERBY-3205:
-------------------------------

    Attachment: failover_impl_3205_v4.stat
                failover_impl_3205_v4.diff

Thank you for the comments!

I have fixed all the issues pointed out in the previous patch I had submitted.

>I think you could use @see a bit more instead of repeating the
>      javadoc. Makes it less brittle if the behavior changes.

I retained the original javadoc in the interfaces and used the @see in the
implementations. i generated the javadoc and saw that the javadocs were
inherited correctly with a comment like

"    Description copied from interface: AccessFactory
    Start the failover for this database."

In the case of the RamAccessManager class. So I concluded that I have done
the right thing in the @see tags.

I request for this patch to be considered for a commit.




> Replication: Add connection url command options for starting, stopping slave and for failover
> ---------------------------------------------------------------------------------------------
>
>                 Key: DERBY-3205
>                 URL: https://issues.apache.org/jira/browse/DERBY-3205
>             Project: Derby
>          Issue Type: Sub-task
>          Components: JDBC
>    Affects Versions: 10.4.0.0
>            Reporter: Jørgen Løland
>            Assignee: V.Narayanan
>         Attachments: derby-3205_startslave_dontcommit.diff, derby-3205_startslave_dontcommit.stat, failover_impl_3205_NotForCommit_v1.diff, failover_impl_3205_NotForCommit_v1.stat, failover_impl_3205_v1.diff, failover_impl_3205_v1.stat, failover_impl_3205_v2.diff, failover_impl_3205_v2.stat, failover_impl_3205_v3.diff, failover_impl_3205_v3.stat, failover_impl_3205_v4.diff, failover_impl_3205_v4.stat, Socket_Close_Fix_v1.diff, Socket_Close_Fix_v1.stat, startSlave_1a.diff, startSlave_1a.stat, startSlave_1b.diff, startSlave_1b.stat, startSlave_1c.diff, startSlave_1d.diff, StopSlave_impl_3205_NotForCommit_v1.diff, StopSlave_impl_3205_NotForCommit_v1.stat, stopSlave_v1a.diff, stopSlave_v1a.stat, stopSlave_v1b.diff, stopSlave_v1b.stat, stopSlave_v1c.diff, stopSlave_v1c.stat
>
>
> Add commands to start and stop the replication slave using properties or connection url. Example:
> 'jdbc:derby:<host><dbname>;startSlave=true';
> 'jdbc:derby:<host><dbname>;stopSlave=true';
> 'jdbc:derby:<host><dbname>;failover=true;
> Connection url options that must be recognized:
> startSlave=true
> stopSlave=true
> failover=true
> slaveHost=<host> (optional, defaults to localhost) (only for startSlave)
> slavePort=<port> (optional, defaults to 8001) (only for startSlave)
> See functional specification on Derby-2872 for further details.

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


[jira] Assigned: (DERBY-3205) Replication: Add connection url command options for starting and stopping slave

Posted by "V.Narayanan (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/DERBY-3205?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

V.Narayanan reassigned DERBY-3205:
----------------------------------

    Assignee: V.Narayanan  (was: Jørgen Løland)

> Replication: Add connection url command options for starting and stopping slave
> -------------------------------------------------------------------------------
>
>                 Key: DERBY-3205
>                 URL: https://issues.apache.org/jira/browse/DERBY-3205
>             Project: Derby
>          Issue Type: Sub-task
>          Components: JDBC
>    Affects Versions: 10.4.0.0
>            Reporter: Jørgen Løland
>            Assignee: V.Narayanan
>         Attachments: derby-3205_startslave_dontcommit.diff, derby-3205_startslave_dontcommit.stat
>
>
> Add commands to start and stop the replication slave using properties or connection url. Example:
> 'jdbc:derby:<host><dbname>;startSlave=true';
> 'jdbc:derby:<host><dbname>;stopSlave=true';
> 'jdbc:derby:<host><dbname>;failover=true;
> Connection url options that must be recognized:
> startSlave=true
> stopSlave=true
> failover=true
> slaveHost=<host> (optional, defaults to localhost) (only for startSlave)
> slavePort=<port> (optional, defaults to 8001) (only for startSlave)
> See functional specification on Derby-2872 for further details.

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


[jira] Commented: (DERBY-3205) Replication: Add connection url command options for starting, stopping slave and for failover

Posted by "Øystein Grøvlen (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/DERBY-3205?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12573264#action_12573264 ] 

Øystein Grøvlen commented on DERBY-3205:
----------------------------------------

I have look at the failover-slave-2a patch, and the EmbedConnection
changes looks good.  I have also tested that if I am not the database
owner, I am not allowed to initiate failover.

For the SlaveController changes, I do not quite understand the
catching of SecurityException in stopReceiverThread.  Is this
something you get when you run with the security manager?  Does this
mean that this should ideally be put in a doPrivileged call?  If it
happens, I guess the thread will not be interrupted, but according to
the comment this is OK since the thread will stop anyway.  So why call
interrupt in the first place?

I tested a scenario where I started replication and directly killed
the master without performing any database operations.  When I
performed failover on the slave, the statement never completed.  The
derby.log file showed that the recovery thread had got an error
similar to what I reported in DERBY-3475 after it had detected that
the master had died.  This caused the boot thread to terminate, but
my connection attempt was still hanging in the sleep call of
SlaveDatabase#failover.  It seems there is some more clean-up that is
missing.


> Replication: Add connection url command options for starting, stopping slave and for failover
> ---------------------------------------------------------------------------------------------
>
>                 Key: DERBY-3205
>                 URL: https://issues.apache.org/jira/browse/DERBY-3205
>             Project: Derby
>          Issue Type: Sub-task
>          Components: JDBC
>    Affects Versions: 10.4.0.0
>            Reporter: Jørgen Løland
>            Assignee: Jørgen Løland
>         Attachments: derby-3205_startslave_dontcommit.diff, derby-3205_startslave_dontcommit.stat, failover-slave-1a.diff, failover-slave-1a.stat, failover-slave-2a.diff, failover-slave-2a.stat, failover_impl_3205_NotForCommit_v1.diff, failover_impl_3205_NotForCommit_v1.stat, failover_impl_3205_v1.diff, failover_impl_3205_v1.stat, failover_impl_3205_v2.diff, failover_impl_3205_v2.stat, failover_impl_3205_v3.diff, failover_impl_3205_v3.stat, failover_impl_3205_v4.diff, failover_impl_3205_v4.stat, Socket_Close_Fix_v1.diff, Socket_Close_Fix_v1.stat, startSlave_1a.diff, startSlave_1a.stat, startSlave_1b.diff, startSlave_1b.stat, startSlave_1c.diff, startSlave_1d.diff, StopSlave_impl_3205_NotForCommit_v1.diff, StopSlave_impl_3205_NotForCommit_v1.stat, stopSlave_v1a.diff, stopSlave_v1a.stat, stopSlave_v1b.diff, stopSlave_v1b.stat, stopSlave_v1c.diff, stopSlave_v1c.stat
>
>
> Add commands to start and stop the replication slave using properties or connection url. Example:
> 'jdbc:derby:<host><dbname>;startSlave=true';
> 'jdbc:derby:<host><dbname>;stopSlave=true';
> 'jdbc:derby:<host><dbname>;failover=true;
> Connection url options that must be recognized:
> startSlave=true
> stopSlave=true
> failover=true
> slaveHost=<host> (optional, defaults to localhost) (only for startSlave)
> slavePort=<port> (optional, defaults to 8001) (only for startSlave)
> See functional specification on Derby-2872 for further details.

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


[jira] Updated: (DERBY-3205) Replication: Add connection url command options for starting and stopping slave

Posted by "V.Narayanan (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/DERBY-3205?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

V.Narayanan updated DERBY-3205:
-------------------------------

    Attachment: failover_impl_3205_NotForCommit_v1.stat

> Replication: Add connection url command options for starting and stopping slave
> -------------------------------------------------------------------------------
>
>                 Key: DERBY-3205
>                 URL: https://issues.apache.org/jira/browse/DERBY-3205
>             Project: Derby
>          Issue Type: Sub-task
>          Components: JDBC
>    Affects Versions: 10.4.0.0
>            Reporter: Jørgen Løland
>            Assignee: V.Narayanan
>         Attachments: derby-3205_startslave_dontcommit.diff, derby-3205_startslave_dontcommit.stat, failover_impl_3205_NotForCommit_v1.diff, failover_impl_3205_NotForCommit_v1.stat, StopSlave_impl_3205_NotForCommit_v1.diff, StopSlave_impl_3205_NotForCommit_v1.stat
>
>
> Add commands to start and stop the replication slave using properties or connection url. Example:
> 'jdbc:derby:<host><dbname>;startSlave=true';
> 'jdbc:derby:<host><dbname>;stopSlave=true';
> 'jdbc:derby:<host><dbname>;failover=true;
> Connection url options that must be recognized:
> startSlave=true
> stopSlave=true
> failover=true
> slaveHost=<host> (optional, defaults to localhost) (only for startSlave)
> slavePort=<port> (optional, defaults to 8001) (only for startSlave)
> See functional specification on Derby-2872 for further details.

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


[jira] Commented: (DERBY-3205) Replication: Add connection url command options for starting and stopping slave

Posted by "Øystein Grøvlen (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/DERBY-3205?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12559036#action_12559036 ] 

Øystein Grøvlen commented on DERBY-3205:
----------------------------------------

After my latest commit, the v1b patch does not apply cleanly anymore.
Please, could you regenerate the patch?

> Replication: Add connection url command options for starting and stopping slave
> -------------------------------------------------------------------------------
>
>                 Key: DERBY-3205
>                 URL: https://issues.apache.org/jira/browse/DERBY-3205
>             Project: Derby
>          Issue Type: Sub-task
>          Components: JDBC
>    Affects Versions: 10.4.0.0
>            Reporter: Jørgen Løland
>            Assignee: V.Narayanan
>         Attachments: derby-3205_startslave_dontcommit.diff, derby-3205_startslave_dontcommit.stat, failover_impl_3205_NotForCommit_v1.diff, failover_impl_3205_NotForCommit_v1.stat, startSlave_1a.diff, startSlave_1a.stat, startSlave_1b.diff, startSlave_1b.stat, StopSlave_impl_3205_NotForCommit_v1.diff, StopSlave_impl_3205_NotForCommit_v1.stat
>
>
> Add commands to start and stop the replication slave using properties or connection url. Example:
> 'jdbc:derby:<host><dbname>;startSlave=true';
> 'jdbc:derby:<host><dbname>;stopSlave=true';
> 'jdbc:derby:<host><dbname>;failover=true;
> Connection url options that must be recognized:
> startSlave=true
> stopSlave=true
> failover=true
> slaveHost=<host> (optional, defaults to localhost) (only for startSlave)
> slavePort=<port> (optional, defaults to 8001) (only for startSlave)
> See functional specification on Derby-2872 for further details.

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


[jira] Commented: (DERBY-3205) Replication: Add connection url command options for starting, stopping slave and for failover

Posted by "Jørgen Løland (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/DERBY-3205?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12562392#action_12562392 ] 

Jørgen Løland commented on DERBY-3205:
--------------------------------------

stopSlave is almost ready now, but I can't see any way of closing the ServerSocket listening for incoming Master connections. Do you know if teardown functionality of the replication network is something we have forgotten to add Narayanan?

> Replication: Add connection url command options for starting, stopping slave and for failover
> ---------------------------------------------------------------------------------------------
>
>                 Key: DERBY-3205
>                 URL: https://issues.apache.org/jira/browse/DERBY-3205
>             Project: Derby
>          Issue Type: Sub-task
>          Components: JDBC
>    Affects Versions: 10.4.0.0
>            Reporter: Jørgen Løland
>            Assignee: V.Narayanan
>         Attachments: derby-3205_startslave_dontcommit.diff, derby-3205_startslave_dontcommit.stat, failover_impl_3205_NotForCommit_v1.diff, failover_impl_3205_NotForCommit_v1.stat, failover_impl_3205_v1.diff, failover_impl_3205_v1.stat, startSlave_1a.diff, startSlave_1a.stat, startSlave_1b.diff, startSlave_1b.stat, startSlave_1c.diff, startSlave_1d.diff, StopSlave_impl_3205_NotForCommit_v1.diff, StopSlave_impl_3205_NotForCommit_v1.stat, stopSlave_v1a.diff, stopSlave_v1a.stat
>
>
> Add commands to start and stop the replication slave using properties or connection url. Example:
> 'jdbc:derby:<host><dbname>;startSlave=true';
> 'jdbc:derby:<host><dbname>;stopSlave=true';
> 'jdbc:derby:<host><dbname>;failover=true;
> Connection url options that must be recognized:
> startSlave=true
> stopSlave=true
> failover=true
> slaveHost=<host> (optional, defaults to localhost) (only for startSlave)
> slavePort=<port> (optional, defaults to 8001) (only for startSlave)
> See functional specification on Derby-2872 for further details.

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


[jira] Assigned: (DERBY-3205) Replication: Add connection url command options for starting and stopping slave

Posted by "Jørgen Løland (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/DERBY-3205?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Jørgen Løland reassigned DERBY-3205:
------------------------------------

    Assignee: Jørgen Løland

> Replication: Add connection url command options for starting and stopping slave
> -------------------------------------------------------------------------------
>
>                 Key: DERBY-3205
>                 URL: https://issues.apache.org/jira/browse/DERBY-3205
>             Project: Derby
>          Issue Type: Sub-task
>          Components: JDBC
>    Affects Versions: 10.4.0.0
>            Reporter: Jørgen Løland
>            Assignee: Jørgen Løland
>         Attachments: derby-3205_startslave_dontcommit.diff, derby-3205_startslave_dontcommit.stat
>
>
> Add commands to start and stop the replication slave using properties or connection url. Example:
> 'jdbc:derby:<host><dbname>;startSlave=true';
> 'jdbc:derby:<host><dbname>;stopSlave=true';
> 'jdbc:derby:<host><dbname>;failover=true;
> Connection url options that must be recognized:
> startSlave=true
> stopSlave=true
> failover=true
> slaveHost=<host> (optional, defaults to localhost) (only for startSlave)
> slavePort=<port> (optional, defaults to 8001) (only for startSlave)
> See functional specification on Derby-2872 for further details.

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


[jira] Commented: (DERBY-3205) Replication: Add connection url command options for starting, stopping slave and for failover

Posted by "Jørgen Løland (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/DERBY-3205?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12563424#action_12563424 ] 

Jørgen Løland commented on DERBY-3205:
--------------------------------------

Hi Narayanan,

I had a look at the failover_impl_3205_v1 patch, which looks good for the most part. I have some comments - most of which are nits:

1) Indentation in EmbedConnection around line 340 is strange - do you use tab length of four spaces? From the diff file I would guess you have a tab space of 8...
2) Typo in javadoc of EmbedConnection#isReplicationFailover - "stopSlave" instead of "failover".
3) AccessFactory - I think the new method "failover" would be easier to find if it was placed close to the other replication methods. Feel free to ignore...
4) There are two Attribute.java files. I'm not sure if both are in use, but previously replication attributes have been added to both files. We either need some insight on which file can be ignored or continue to add the attributes to both files.
5) RawStore.failover - Do you intend to write a follow-up patch with error handling for the case that MasterFactory is not found by the Monitor?
6) The javadoc for failover in all the classes say StandardException is thrown on error, but MasterController will always throw an exception. It would be easier to understand the code if the javadoc described the reason for throwing an exception even if failover was successful.
7) I tried to run the failover command on the master, which seems to work fine as long as the master and slave are still connected. If the slave has been stopped for some reason, however, failover hangs on MasterController#startFailover here: 
ack = transmitter.readMessage();
I'm not sure if this patch is the right one to fix this bug...


> Replication: Add connection url command options for starting, stopping slave and for failover
> ---------------------------------------------------------------------------------------------
>
>                 Key: DERBY-3205
>                 URL: https://issues.apache.org/jira/browse/DERBY-3205
>             Project: Derby
>          Issue Type: Sub-task
>          Components: JDBC
>    Affects Versions: 10.4.0.0
>            Reporter: Jørgen Løland
>            Assignee: V.Narayanan
>         Attachments: derby-3205_startslave_dontcommit.diff, derby-3205_startslave_dontcommit.stat, failover_impl_3205_NotForCommit_v1.diff, failover_impl_3205_NotForCommit_v1.stat, failover_impl_3205_v1.diff, failover_impl_3205_v1.stat, Socket_Close_Fix_v1.diff, Socket_Close_Fix_v1.stat, startSlave_1a.diff, startSlave_1a.stat, startSlave_1b.diff, startSlave_1b.stat, startSlave_1c.diff, startSlave_1d.diff, StopSlave_impl_3205_NotForCommit_v1.diff, StopSlave_impl_3205_NotForCommit_v1.stat, stopSlave_v1a.diff, stopSlave_v1a.stat, stopSlave_v1b.diff, stopSlave_v1b.stat
>
>
> Add commands to start and stop the replication slave using properties or connection url. Example:
> 'jdbc:derby:<host><dbname>;startSlave=true';
> 'jdbc:derby:<host><dbname>;stopSlave=true';
> 'jdbc:derby:<host><dbname>;failover=true;
> Connection url options that must be recognized:
> startSlave=true
> stopSlave=true
> failover=true
> slaveHost=<host> (optional, defaults to localhost) (only for startSlave)
> slavePort=<port> (optional, defaults to 8001) (only for startSlave)
> See functional specification on Derby-2872 for further details.

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


[jira] Commented: (DERBY-3205) Replication: Add connection url command options for starting, stopping slave and for failover

Posted by "Øystein Grøvlen (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/DERBY-3205?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12572876#action_12572876 ] 

Øystein Grøvlen commented on DERBY-3205:
----------------------------------------

DERBY-3472 illustrates the concern I have with the current limitation on slave-initiated failover.
A thread deadlock occurs on the master, but the slave is not allowed to do failover because the connection to the master is still up.


> Replication: Add connection url command options for starting, stopping slave and for failover
> ---------------------------------------------------------------------------------------------
>
>                 Key: DERBY-3205
>                 URL: https://issues.apache.org/jira/browse/DERBY-3205
>             Project: Derby
>          Issue Type: Sub-task
>          Components: JDBC
>    Affects Versions: 10.4.0.0
>            Reporter: Jørgen Løland
>            Assignee: Jørgen Løland
>         Attachments: derby-3205_startslave_dontcommit.diff, derby-3205_startslave_dontcommit.stat, failover-slave-1a.diff, failover-slave-1a.stat, failover-slave-2a.diff, failover-slave-2a.stat, failover_impl_3205_NotForCommit_v1.diff, failover_impl_3205_NotForCommit_v1.stat, failover_impl_3205_v1.diff, failover_impl_3205_v1.stat, failover_impl_3205_v2.diff, failover_impl_3205_v2.stat, failover_impl_3205_v3.diff, failover_impl_3205_v3.stat, failover_impl_3205_v4.diff, failover_impl_3205_v4.stat, Socket_Close_Fix_v1.diff, Socket_Close_Fix_v1.stat, startSlave_1a.diff, startSlave_1a.stat, startSlave_1b.diff, startSlave_1b.stat, startSlave_1c.diff, startSlave_1d.diff, StopSlave_impl_3205_NotForCommit_v1.diff, StopSlave_impl_3205_NotForCommit_v1.stat, stopSlave_v1a.diff, stopSlave_v1a.stat, stopSlave_v1b.diff, stopSlave_v1b.stat, stopSlave_v1c.diff, stopSlave_v1c.stat
>
>
> Add commands to start and stop the replication slave using properties or connection url. Example:
> 'jdbc:derby:<host><dbname>;startSlave=true';
> 'jdbc:derby:<host><dbname>;stopSlave=true';
> 'jdbc:derby:<host><dbname>;failover=true;
> Connection url options that must be recognized:
> startSlave=true
> stopSlave=true
> failover=true
> slaveHost=<host> (optional, defaults to localhost) (only for startSlave)
> slavePort=<port> (optional, defaults to 8001) (only for startSlave)
> See functional specification on Derby-2872 for further details.

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


[jira] Commented: (DERBY-3205) Replication: Add connection url command options for starting, stopping slave and for failover

Posted by "Jørgen Løland (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/DERBY-3205?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12564789#action_12564789 ] 

Jørgen Løland commented on DERBY-3205:
--------------------------------------

> I am not sure, but maybe a shutdown can be achieved by calling ContextManager#cleanupOnError with a shutdown exception? If so you should be able to use the ContextManager of the boot thread.

I tried doing that in handleShutdown first, but then I get an ASSERT error the next time I try to connect to the database that used to be slave. I think the problem is that that thread does not have a connection context. But I must admit I'm fumbling blindly here...

> Replication: Add connection url command options for starting, stopping slave and for failover
> ---------------------------------------------------------------------------------------------
>
>                 Key: DERBY-3205
>                 URL: https://issues.apache.org/jira/browse/DERBY-3205
>             Project: Derby
>          Issue Type: Sub-task
>          Components: JDBC
>    Affects Versions: 10.4.0.0
>            Reporter: Jørgen Løland
>            Assignee: V.Narayanan
>         Attachments: derby-3205_startslave_dontcommit.diff, derby-3205_startslave_dontcommit.stat, failover_impl_3205_NotForCommit_v1.diff, failover_impl_3205_NotForCommit_v1.stat, failover_impl_3205_v1.diff, failover_impl_3205_v1.stat, failover_impl_3205_v2.diff, failover_impl_3205_v2.stat, Socket_Close_Fix_v1.diff, Socket_Close_Fix_v1.stat, startSlave_1a.diff, startSlave_1a.stat, startSlave_1b.diff, startSlave_1b.stat, startSlave_1c.diff, startSlave_1d.diff, StopSlave_impl_3205_NotForCommit_v1.diff, StopSlave_impl_3205_NotForCommit_v1.stat, stopSlave_v1a.diff, stopSlave_v1a.stat, stopSlave_v1b.diff, stopSlave_v1b.stat, stopSlave_v1c.diff, stopSlave_v1c.stat
>
>
> Add commands to start and stop the replication slave using properties or connection url. Example:
> 'jdbc:derby:<host><dbname>;startSlave=true';
> 'jdbc:derby:<host><dbname>;stopSlave=true';
> 'jdbc:derby:<host><dbname>;failover=true;
> Connection url options that must be recognized:
> startSlave=true
> stopSlave=true
> failover=true
> slaveHost=<host> (optional, defaults to localhost) (only for startSlave)
> slavePort=<port> (optional, defaults to 8001) (only for startSlave)
> See functional specification on Derby-2872 for further details.

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


[jira] Updated: (DERBY-3205) Replication: Add connection url command options for starting, stopping slave and for failover

Posted by "Øystein Grøvlen (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/DERBY-3205?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Øystein Grøvlen updated DERBY-3205:
-----------------------------------

    Derby Info:   (was: [Patch Available])

Patch, failover-slave-2b.diff committed as revision 633043.

> Replication: Add connection url command options for starting, stopping slave and for failover
> ---------------------------------------------------------------------------------------------
>
>                 Key: DERBY-3205
>                 URL: https://issues.apache.org/jira/browse/DERBY-3205
>             Project: Derby
>          Issue Type: Sub-task
>          Components: JDBC
>    Affects Versions: 10.4.0.0
>            Reporter: Jørgen Løland
>            Assignee: Jørgen Løland
>         Attachments: derby-3205_startslave_dontcommit.diff, derby-3205_startslave_dontcommit.stat, failover-slave-1a.diff, failover-slave-1a.stat, failover-slave-2a.diff, failover-slave-2a.stat, failover-slave-2b.diff, failover_impl_3205_NotForCommit_v1.diff, failover_impl_3205_NotForCommit_v1.stat, failover_impl_3205_v1.diff, failover_impl_3205_v1.stat, failover_impl_3205_v2.diff, failover_impl_3205_v2.stat, failover_impl_3205_v3.diff, failover_impl_3205_v3.stat, failover_impl_3205_v4.diff, failover_impl_3205_v4.stat, Socket_Close_Fix_v1.diff, Socket_Close_Fix_v1.stat, startSlave_1a.diff, startSlave_1a.stat, startSlave_1b.diff, startSlave_1b.stat, startSlave_1c.diff, startSlave_1d.diff, StopSlave_impl_3205_NotForCommit_v1.diff, StopSlave_impl_3205_NotForCommit_v1.stat, stopSlave_v1a.diff, stopSlave_v1a.stat, stopSlave_v1b.diff, stopSlave_v1b.stat, stopSlave_v1c.diff, stopSlave_v1c.stat
>
>
> Add commands to start and stop the replication slave using properties or connection url. Example:
> 'jdbc:derby:<host><dbname>;startSlave=true';
> 'jdbc:derby:<host><dbname>;stopSlave=true';
> 'jdbc:derby:<host><dbname>;failover=true;
> Connection url options that must be recognized:
> startSlave=true
> stopSlave=true
> failover=true
> slaveHost=<host> (optional, defaults to localhost) (only for startSlave)
> slavePort=<port> (optional, defaults to 8001) (only for startSlave)
> See functional specification on Derby-2872 for further details.

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