Please take our Survey
logo       

Choosing A Webhost:
A web hosting service is a type of Internet hosting service that allows individuals and organizations to provide their own website accessible via the World Wide Web. Web hosts are companies that provide space on a server they own for use by their clients as well as providing Internet connectivity, typically in a data center. Web hosts can also provide data center space and connectivity to the Internet for servers they do not own to be located in their data center, called colocation. more...

CVS update of sequoia/src/org/continuent/sequoia/controller (7 files): msg#00232

db.sequoia.cvs

Subject: CVS update of sequoia/src/org/continuent/sequoia/controller (7 files)

Date: Tuesday, June 20, 2006 @ 03:42:31
Author: ralph
Path: /cvsroot/sequoia/sequoia/src/org/continuent/sequoia/controller

Modified: backend/DatabaseBackend.java (1.91 -> 1.92)
connection/AbstractConnectionManager.java (1.24 -> 1.25)
connection/VariablePoolConnectionManager.java (1.17 -> 1.18)
loadbalancer/raidb1/RAIDb1.java (1.126 -> 1.127)
virtualdatabase/protocol/DistributedClosePersistentConnection.java
(1.6 -> 1.7) virtualdatabase/protocol/DistributedCommit.java
(1.1 -> 1.2)
virtualdatabase/protocol/DistributedOpenPersistentConnection.java
(1.5 -> 1.6)

Fixed SEQUOIA-624.

Added equals() and hashCode to DistributedOpenPersistentConnection and
DistributedClosePersistentConnection.

Changed the VariablePoolConnectionManager so that it detects when a backend
server has failed.

Log runtime exceptions in RAIDb1.

Don't call AbstractScheduler.commitComplete() unless abstractScheduler.commit()
was called.


--------------------------------------------------------------------+
backend/DatabaseBackend.java | 1
connection/AbstractConnectionManager.java | 17 ++++
connection/VariablePoolConnectionManager.java | 37
+++++++++-
loadbalancer/raidb1/RAIDb1.java | 9 ++
virtualdatabase/protocol/DistributedClosePersistentConnection.java | 24
++++++
virtualdatabase/protocol/DistributedCommit.java | 5 -
virtualdatabase/protocol/DistributedOpenPersistentConnection.java | 23
++++++
7 files changed, 111 insertions(+), 5 deletions(-)


Index:
sequoia/src/org/continuent/sequoia/controller/backend/DatabaseBackend.java
diff -u
sequoia/src/org/continuent/sequoia/controller/backend/DatabaseBackend.java:1.91
sequoia/src/org/continuent/sequoia/controller/backend/DatabaseBackend.java:1.92
---
sequoia/src/org/continuent/sequoia/controller/backend/DatabaseBackend.java:1.91
Mon Jun 19 13:54:00 2006
+++ sequoia/src/org/continuent/sequoia/controller/backend/DatabaseBackend.java
Tue Jun 20 03:42:31 2006
@@ -537,6 +537,7 @@
logger.info(Translate.get("backend.add.connection.manager.for.user",
vLogin));
connectionManager.setVLogin(vLogin);
+ connectionManager.setConnectionTestStatement(getConnectionTestStatement());
connectionManagers.put(vLogin, connectionManager);
}

Index:
sequoia/src/org/continuent/sequoia/controller/connection/AbstractConnectionManager.java
diff -u
sequoia/src/org/continuent/sequoia/controller/connection/AbstractConnectionManager.java:1.24

sequoia/src/org/continuent/sequoia/controller/connection/AbstractConnectionManager.java:1.25
---
sequoia/src/org/continuent/sequoia/controller/connection/AbstractConnectionManager.java:1.24
Wed Jun 14 19:55:49 2006
+++
sequoia/src/org/continuent/sequoia/controller/connection/AbstractConnectionManager.java
Tue Jun 20 03:42:31 2006
@@ -104,6 +104,8 @@
/** Virtual Login used this connection manager */
private String vLogin;

+ protected String connectionTestStatement;
+
/*
* Constructor(s)
*/
@@ -524,7 +526,8 @@
if (c == null)
{
c = getRenewedConnectionInAutoCommit();
- persistentConnections.put(id, c);
+ if (c != null)
+ persistentConnections.put(id, c);
}
return c;
}
@@ -670,6 +673,16 @@
}

/**
+ * Set the SQL string used to test whether or not the server is available.
+ *
+ * @param connectionTestStatement
+ */
+ public void setConnectionTestStatement(String connectionTestStatement)
+ {
+ this.connectionTestStatement = connectionTestStatement;
+ }
+
+ /**
* Gets xml formatted information on this connection manager
*
* @return xml formatted string that conforms to sequoia.dtd
@@ -690,4 +703,6 @@
info.append("</" + DatabasesXmlTags.ELT_ConnectionManager + ">");
return info.toString();
}
+
+
}
\ No newline at end of file
Index:
sequoia/src/org/continuent/sequoia/controller/connection/VariablePoolConnectionManager.java
diff -u
sequoia/src/org/continuent/sequoia/controller/connection/VariablePoolConnectionManager.java:1.17

sequoia/src/org/continuent/sequoia/controller/connection/VariablePoolConnectionManager.java:1.18
---
sequoia/src/org/continuent/sequoia/controller/connection/VariablePoolConnectionManager.java:1.17
Wed Jun 14 19:55:49 2006
+++
sequoia/src/org/continuent/sequoia/controller/connection/VariablePoolConnectionManager.java
Tue Jun 20 03:42:31 2006
@@ -25,6 +25,7 @@

import java.sql.Connection;
import java.sql.SQLException;
+import java.sql.Statement;
import java.util.Iterator;
import java.util.LinkedList;
import java.util.NoSuchElementException;
@@ -76,6 +77,8 @@
/** Allow to remove idle connections in the pool. */
private RemoveIdleConnectionsThread removeIdleConnectionsThread;

+ private Connection ping;
+
/**
* Creates a new <code>VariablePoolConnectionManager</code> instance with
* the default minPoolSize(initial pool size to be initialized at startup).
@@ -215,6 +218,7 @@
poolSize = maxPoolSize == 0 ? (initPoolSize > minPoolSize
? initPoolSize
: minPoolSize) : maxPoolSize;
+ this.ping = getConnectionFromDriver();
synchronized (this)
{
super.doConnectionInitialization(initPoolSize);
@@ -258,6 +262,16 @@
*/
protected void doConnectionFinalization() throws SQLException
{
+ try
+ {
+ if (ping != null)
+ ping.close();
+ ping = null;
+ }
+ catch (SQLException e)
+ {
+ // ignore the errors we are shutting down
+ }
synchronized (this)
{
super.doConnectionFinalization();
@@ -322,7 +336,28 @@
logger.error("Backend " + backendName + " is no more accessible.");
throw new UnreachableBackendException();
}
- // If it fails, just wait for a connection to be freed
+ /*
+ * Ping the server with an open connection in order to determine
+ * whether the server has failed or is has run out of connections.
+ * If the ping fails, the server is down.
+ */
+ try
+ {
+ Statement pingStatement = ping.createStatement();
+ pingStatement.execute(connectionTestStatement);
+ pingStatement.close();
+ }
+ catch (SQLException e)
+ {
+ isShutdown = true;
+ logger.error("Backend " + backendName + " is no more accessible.");
+ throw new UnreachableBackendException();
+ }
+ /*
+ * There are currently no connections available from the server,
+ * just wait for a connection to be freed
+ */
+
if (logger.isWarnEnabled())
logger.warn("Failed to create new connection on backend '"
+ backendName + "', waiting for a connection to be freed.");
Index:
sequoia/src/org/continuent/sequoia/controller/loadbalancer/raidb1/RAIDb1.java
diff -u
sequoia/src/org/continuent/sequoia/controller/loadbalancer/raidb1/RAIDb1.java:1.126

sequoia/src/org/continuent/sequoia/controller/loadbalancer/raidb1/RAIDb1.java:1.127
---
sequoia/src/org/continuent/sequoia/controller/loadbalancer/raidb1/RAIDb1.java:1.126
Mon Jun 19 19:02:47 2006
+++
sequoia/src/org/continuent/sequoia/controller/loadbalancer/raidb1/RAIDb1.java
Tue Jun 20 03:42:31 2006
@@ -466,6 +466,8 @@
}
catch (Throwable e)
{
+
+ logger.error("Unexpected exception:", e);
cm.releaseConnectionInAutoCommit(request, c);
throw new SQLException(Translate.get(
"loadbalancer.request.failed.on.backend", new String[]{
@@ -551,6 +553,7 @@
}
catch (Throwable e)
{
+ logger.error("Unexpected exception:", e);
throw new SQLException(Translate.get(
"loadbalancer.request.failed.on.backend", new String[]{
request.getSqlShortForm(vdb.getSqlShortFormLength()),
@@ -646,6 +649,7 @@
}
catch (Throwable e)
{
+ logger.error("Unexpected exception:", e);
throw new SQLException(Translate.get(
"loadbalancer.storedprocedure.failed.on.backend", new String[]{
proc.getSqlShortForm(vdb.getSqlShortFormLength()),
@@ -726,6 +730,7 @@
}
catch (Throwable e)
{
+ logger.error("Unexpected exception:", e);
throw new SQLException(Translate.get(
"loadbalancer.storedprocedure.failed.on.backend", new String[]{
proc.getSqlShortForm(vdb.getSqlShortFormLength()),
@@ -1067,6 +1072,8 @@
catch (Throwable e)
{
cm.releaseConnectionInAutoCommit(request, c);
+
+ logger.error("Unexpected exception:", e);
throw new SQLException(Translate.get(
"loadbalancer.request.failed.on.backend", new String[]{
request.getSqlShortForm(vdb.getSqlShortFormLength()),
@@ -1139,6 +1146,8 @@
}
catch (Throwable e)
{
+
+ logger.error("Unexpected exception:", e);
throw new SQLException(Translate.get(
"loadbalancer.request.failed.on.backend", new String[]{
request.getSqlShortForm(vdb.getSqlShortFormLength()),
Index:
sequoia/src/org/continuent/sequoia/controller/virtualdatabase/protocol/DistributedClosePersistentConnection.java
diff -u
sequoia/src/org/continuent/sequoia/controller/virtualdatabase/protocol/DistributedClosePersistentConnection.java:1.6

sequoia/src/org/continuent/sequoia/controller/virtualdatabase/protocol/DistributedClosePersistentConnection.java:1.7
---
sequoia/src/org/continuent/sequoia/controller/virtualdatabase/protocol/DistributedClosePersistentConnection.java:1.6
Mon Jun 19 18:56:08 2006
+++
sequoia/src/org/continuent/sequoia/controller/virtualdatabase/protocol/DistributedClosePersistentConnection.java
Tue Jun 20 03:42:31 2006
@@ -41,6 +41,7 @@
private String login;
private long persistentConnectionId;

+
/**
* Creates a new <code>DistributedClosePersistentConnection</code> object
*
@@ -108,4 +109,27 @@

return null;
}
+
+ /**
+ *
+ * @see java.lang.Object#equals(java.lang.Object)
+ */
+ public boolean equals(Object obj)
+ {
+ if (obj instanceof DistributedClosePersistentConnection)
+ {
+ DistributedClosePersistentConnection other =
(DistributedClosePersistentConnection)obj;
+ return persistentConnectionId == other.persistentConnectionId;
+ }
+ return false;
+ }
+
+ /**
+ *
+ * @see java.lang.Object#hashCode()
+ */
+ public int hashCode()
+ {
+ return (int) persistentConnectionId;
+ }
}
Index:
sequoia/src/org/continuent/sequoia/controller/virtualdatabase/protocol/DistributedCommit.java
diff -u
sequoia/src/org/continuent/sequoia/controller/virtualdatabase/protocol/DistributedCommit.java:1.1

sequoia/src/org/continuent/sequoia/controller/virtualdatabase/protocol/DistributedCommit.java:1.2
---
sequoia/src/org/continuent/sequoia/controller/virtualdatabase/protocol/DistributedCommit.java:1.1
Thu Jun 15 18:00:38 2006
+++
sequoia/src/org/continuent/sequoia/controller/virtualdatabase/protocol/DistributedCommit.java
Tue Jun 20 03:42:31 2006
@@ -131,11 +131,10 @@
// Update recovery log
drm.getRecoveryLog().logRequestCompletion(tm.getLogId(), true, 0);

- // Notify scheduler for completion
- drm.getScheduler().commitCompleted(tm, true);
-
if (transactionStartedOnThisController)
{
+ // Notify scheduler for completion
+ drm.getScheduler().commitCompleted(tm, true);
drm.completeTransaction(tid);
}
}
Index:
sequoia/src/org/continuent/sequoia/controller/virtualdatabase/protocol/DistributedOpenPersistentConnection.java
diff -u
sequoia/src/org/continuent/sequoia/controller/virtualdatabase/protocol/DistributedOpenPersistentConnection.java:1.5

sequoia/src/org/continuent/sequoia/controller/virtualdatabase/protocol/DistributedOpenPersistentConnection.java:1.6
---
sequoia/src/org/continuent/sequoia/controller/virtualdatabase/protocol/DistributedOpenPersistentConnection.java:1.5
Mon Jun 19 18:56:08 2006
+++
sequoia/src/org/continuent/sequoia/controller/virtualdatabase/protocol/DistributedOpenPersistentConnection.java
Tue Jun 20 03:42:31 2006
@@ -109,4 +109,27 @@

return null;
}
+
+ /**
+ *
+ * @see java.lang.Object#equals(java.lang.Object)
+ */
+ public boolean equals(Object obj)
+ {
+ if (obj instanceof DistributedOpenPersistentConnection)
+ {
+ DistributedOpenPersistentConnection other =
(DistributedOpenPersistentConnection)obj;
+ return persistentConnectionId == other.persistentConnectionId;
+ }
+ return false;
+ }
+
+ /**
+ *
+ * @see java.lang.Object#hashCode()
+ */
+ public int hashCode()
+ {
+ return (int)persistentConnectionId;
+ }
}


<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

Recently Viewed:
qnx.openqnx.dev...    gcc.libstdc++.c...    solaris.opensol...    information-ret...    misc.misterhous...    web.catalyst.ge...    apache.webservi...    redhat.release....    hardware.lirc/2...    kernel.autofs/2...    technology.sust...    linux.vdr/2003-...    editors.lyx.gen...    org.user-groups...    netbsd.devel.pk...    xdg.devel/2004-...    version-control...    jakarta.slide.d...    debian.packages...    creativecommons...    ports.ppc.embed...    bug-tracking.bu...   
Home | blog view | USPTO Patent Archive | advertise | OSDir is an inevitable website. super tiny logo

Free Magazines

Cisco News
Receive a free quarterly e-newsletter with exclusive articles on how Cisco IT uses its own products and solutions to enable the business.
subscribe

Systems Management News, the newspaper for IT systems administration and data center managers! Each issue of Systems Management News is chock-full of news and analysis to help you understand what's happening in your field.
subscribe

The Enterprise Newsweekly eWeek is the essential technology information source for builders of e-business.
subscribe

Oracle Magazine Oracle Magazine contains technology strategy articles, sample code, tips, Oracle and partner news, how to articles for developers and DBAs, and more. Oracle (NASDAQ: ORCL) is the world's largest enterprise software company.
subscribe

Total Telecom Total Telecom is "The Economist of the communications industry".
subscribe