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 2008/01/08 09:25:34 UTC

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

    [ 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.