db-derby-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From oyste...@apache.org
Subject svn commit: r612081 - in /db/derby/code/trunk/java: engine/org/apache/derby/database/ engine/org/apache/derby/iapi/store/access/ engine/org/apache/derby/iapi/store/raw/ engine/org/apache/derby/impl/db/ engine/org/apache/derby/impl/jdbc/ engine/org/apac...
Date Tue, 15 Jan 2008 11:11:15 GMT
Author: oysteing
Date: Tue Jan 15 03:11:14 2008
New Revision: 612081

URL: http://svn.apache.org/viewvc?rev=612081&view=rev
Log:
DERBY-3189: Replication: Add connection url command option for stopping master (Contributed
by V Narayanan)

Modified:
    db/derby/code/trunk/java/engine/org/apache/derby/database/Database.java
    db/derby/code/trunk/java/engine/org/apache/derby/iapi/store/access/AccessFactory.java
    db/derby/code/trunk/java/engine/org/apache/derby/iapi/store/raw/RawStoreFactory.java
    db/derby/code/trunk/java/engine/org/apache/derby/impl/db/BasicDatabase.java
    db/derby/code/trunk/java/engine/org/apache/derby/impl/jdbc/EmbedConnection.java
    db/derby/code/trunk/java/engine/org/apache/derby/impl/store/access/RAMAccessManager.java
    db/derby/code/trunk/java/engine/org/apache/derby/impl/store/raw/RawStore.java
    db/derby/code/trunk/java/engine/org/apache/derby/loc/messages.xml
    db/derby/code/trunk/java/shared/org/apache/derby/shared/common/reference/SQLState.java

Modified: db/derby/code/trunk/java/engine/org/apache/derby/database/Database.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/database/Database.java?rev=612081&r1=612080&r2=612081&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/database/Database.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/database/Database.java Tue Jan 15 03:11:14
2008
@@ -128,6 +128,13 @@
     public void startReplicationMaster(String host, int port, 
                                        String replicationMode)
         throws SQLException;
+    
+    /**
+     * Stop the replication master role for the given database.
+     * 
+     * @exception SQLException Thrown on error
+     */
+    public void stopReplicationMaster() throws SQLException;
 
 	/**
 	  * Freeze the database temporarily so a backup can be taken.

Modified: db/derby/code/trunk/java/engine/org/apache/derby/iapi/store/access/AccessFactory.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/iapi/store/access/AccessFactory.java?rev=612081&r1=612080&r2=612081&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/iapi/store/access/AccessFactory.java
(original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/iapi/store/access/AccessFactory.java
Tue Jan 15 03:11:14 2008
@@ -228,6 +228,14 @@
                                        String replicationMode)
         throws StandardException;
 
+    /**
+     * Stop the replication master role for this database.
+     * 
+     * @exception StandardException Standard Derby exception policy,
+     * thrown on error.
+     */
+    public void stopReplicationMaster() throws StandardException;
+
 	/**
 	  * Freeze the database temporarily so a backup can be taken.
 	  * <P>Please see Derby on line documentation on backup and restore.

Modified: db/derby/code/trunk/java/engine/org/apache/derby/iapi/store/raw/RawStoreFactory.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/iapi/store/raw/RawStoreFactory.java?rev=612081&r1=612080&r2=612081&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/iapi/store/raw/RawStoreFactory.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/iapi/store/raw/RawStoreFactory.java Tue
Jan 15 03:11:14 2008
@@ -694,6 +694,14 @@
     public void startReplicationMaster(String host, int port,
                                        String replicationMode)
         throws StandardException;
+    
+    /**
+     * Stop the replication master role for this database.
+     * 
+     * @exception StandardException Standard Derby exception policy,
+     * thrown on error.
+     */
+    public void stopReplicationMaster() throws StandardException;
 
 	/**
 	  * Freeze the database temporarily so a backup can be taken.

Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/db/BasicDatabase.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/db/BasicDatabase.java?rev=612081&r1=612080&r2=612081&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/db/BasicDatabase.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/db/BasicDatabase.java Tue Jan 15
03:11:14 2008
@@ -376,6 +376,19 @@
             throw PublicAPI.wrapStandardException(se);
         }
     }
+    
+    /**
+     * Stop the replication master role for this database.
+     * 
+     * @exception SQLException Thrown on error
+     */
+    public void stopReplicationMaster()  throws SQLException {
+        try {
+            af.stopReplicationMaster();
+        } catch (StandardException se) {
+            throw PublicAPI.wrapStandardException(se);
+        }
+    }
 
 	public void freeze() throws SQLException
 	{

Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/jdbc/EmbedConnection.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/jdbc/EmbedConnection.java?rev=612081&r1=612080&r2=612081&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/jdbc/EmbedConnection.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/jdbc/EmbedConnection.java Tue Jan
15 03:11:14 2008
@@ -558,8 +558,7 @@
         // replication - depending on the security mechanisms
         // Derby is running under.
 
-        // Waiting for Derby-2954:
-        // tr.getDatabase().stopReplicationMaster();
+        tr.getDatabase().stopReplicationMaster();
     }
 
 	/**

Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/store/access/RAMAccessManager.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/store/access/RAMAccessManager.java?rev=612081&r1=612080&r2=612081&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/store/access/RAMAccessManager.java
(original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/store/access/RAMAccessManager.java
Tue Jan 15 03:11:14 2008
@@ -928,6 +928,16 @@
         rawstore.startReplicationMaster(host, port, replicationMode);
     }
 
+    /**
+     * Stop the replication master role for this database.
+     * 
+     * @exception StandardException Standard Derby exception policy,
+     * thrown on error.
+     */
+    public void stopReplicationMaster() throws StandardException {
+        rawstore.stopReplicationMaster();
+    }
+
 	public void freeze() throws StandardException
 	{
 		rawstore.freeze();

Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/store/raw/RawStore.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/store/raw/RawStore.java?rev=612081&r1=612080&r2=612081&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/store/raw/RawStore.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/store/raw/RawStore.java Tue Jan
15 03:11:14 2008
@@ -499,6 +499,32 @@
         masterFactory.startMaster(this, dataFactory, logFactory);
 
     }
+    
+    /**
+     * Stop the replication master role for this database.
+     * 
+     * @exception StandardException Standard Derby exception policy,
+     * thrown on error.
+     */
+    public void stopReplicationMaster() throws StandardException {
+        
+        MasterFactory masterFactory = null;
+        
+        if (isReadOnly()) {
+            throw StandardException.newException(
+                      SQLState.CANNOT_REPLICATE_READONLY_DATABASE);
+        }
+
+        try {
+            masterFactory = (MasterFactory) 
+                Monitor.findServiceModule(this, getMasterFactoryModule());
+        }
+        catch (StandardException se) {
+            throw StandardException.newException(
+                      SQLState.REPLICATION_UNABLE_TO_STOP_MASTER);
+        }
+        masterFactory.stopMaster();
+    }
 
 	public void freeze() throws StandardException
 	{

Modified: db/derby/code/trunk/java/engine/org/apache/derby/loc/messages.xml
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/loc/messages.xml?rev=612081&r1=612080&r2=612081&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/loc/messages.xml (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/loc/messages.xml Tue Jan 15 03:11:14
2008
@@ -4757,6 +4757,11 @@
                 <text>The connection attempts to the replication slave for the database
{0} exceeded the specified timeout period.</text>
                 <arg>dbname</arg>
             </msg>
+            
+            <msg>
+                <name>XRE07</name>
+                <text>Could not stop replication because the database is not in replication
master mode.</text>
+            </msg>
 
 
         </family>

Modified: db/derby/code/trunk/java/shared/org/apache/derby/shared/common/reference/SQLState.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/shared/org/apache/derby/shared/common/reference/SQLState.java?rev=612081&r1=612080&r2=612081&view=diff
==============================================================================
--- db/derby/code/trunk/java/shared/org/apache/derby/shared/common/reference/SQLState.java
(original)
+++ db/derby/code/trunk/java/shared/org/apache/derby/shared/common/reference/SQLState.java
Tue Jan 15 03:11:14 2008
@@ -1764,5 +1764,6 @@
     String REPLICATION_CONNECTION_EXCEPTION                        = "XRE04";
     String REPLICATION_LOG_OUT_OF_SYNCH                            = "XRE05";
     String REPLICATION_MASTER_TIMED_OUT                            = "XRE06";
+    String REPLICATION_UNABLE_TO_STOP_MASTER                       = "XRE07";
 }
 



Mime
View raw message