|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object javax.management.StandardMBean org.objectweb.cjdbc.controller.jmx.AbstractStandardMBean org.objectweb.cjdbc.controller.requestmanager.RequestManager org.objectweb.cjdbc.controller.requestmanager.distributed.DistributedRequestManager
This class defines a Distributed Request Manager.
The DRM is composed of a Request Scheduler, an optional Query Cache, and a Load Balancer and an optional Recovery Log. Unlike a non-dsitributed Request Manager, this implementation is responsible for synchronizing the different controllers components (schedulers, ...). Functions that are RAIDb level dependent are implemented in sub-classes.
Nested Class Summary |
Nested classes inherited from class javax.management.StandardMBean |
|
Field Summary | |
static long |
CONTROLLER_ID_BIT_MASK
Effective controllerIds are on the upper 16 bits of a long (64 bits). |
static long |
CONTROLLER_ID_BITS
|
static int |
CONTROLLER_ID_SHIFT_BITS
|
private long |
controllerId
Unique controller identifier |
private java.util.ArrayList |
distributedTransactions
List of transactions that have executed on multiple controllers |
protected DistributedVirtualDatabase |
dvdb
|
private java.util.Vector |
failedOnAllBackends
List of queries that failed on all backends |
protected static int |
NO_RESULT
|
static long |
TRANSACTION_ID_BIT_MASK
TRANSACTION_ID_BIT_MASK is used to get the transaction id local to the originating controller |
Fields inherited from class org.objectweb.cjdbc.controller.requestmanager.RequestManager |
backupManager, beginTimeout, commitTimeout, dbs, loadBalancer, logger, parsingCache, recoveryLog, requiredParsingGranularity, resultCache, rollbackTimeout, scheduler, schedulerParsingranularity, tidLoginTable, tidSavepoints, vdb |
Fields inherited from class org.objectweb.cjdbc.controller.jmx.AbstractStandardMBean |
|
Fields inherited from class javax.management.StandardMBean |
|
Fields inherited from interface org.objectweb.cjdbc.common.xml.XmlComponent |
DOCTYPE_CONTROLLER, DOCTYPE_DB, XML_VERSION |
Constructor Summary | |
DistributedRequestManager(DistributedVirtualDatabase vdb,
AbstractScheduler scheduler,
AbstractResultCache cache,
AbstractLoadBalancer loadBalancer,
RecoveryLog recoveryLog,
long beginTimeout,
long commitTimeout,
long rollbackTimeout)
Builds a new DistributedRequestManager instance without
cache. |
Method Summary | |
void |
addFailedOnAllBackends(AbstractRequest request)
Add a request that failed on all backends. |
long |
begin(java.lang.String login)
Begin a new transaction and return the corresponding transaction identifier. |
void |
commit(long transactionId,
boolean logCommit)
Commit a transaction given its id. |
void |
completeFailedOnAllBackends(AbstractRequest request,
boolean success)
Notify completion of a request that failed on all backends. |
void |
disableBackend(DatabaseBackend db)
Disable a backend that is currently enabled on this virtual database. |
void |
disableBackendForCheckpoint(DatabaseBackend db,
java.lang.String checkpointName)
The backend must belong to this virtual database and be in the enabled state. |
abstract void |
distributedCommit(java.lang.String login,
long transactionId)
Distributed implementation of a commit |
abstract void |
distributedReleaseSavepoint(long transactionId,
java.lang.String name)
Distributed implementation of releasing a savepoint from a transaction |
abstract void |
distributedRollback(long transactionId,
java.lang.String savepointName)
Distributed implementation of a rollback to a savepoint |
abstract void |
distributedRollback(java.lang.String login,
long transactionId)
Distributed implementation of a rollback |
abstract void |
distributedSetSavepoint(long transactionId,
java.lang.String name)
Distributed implementation of setting a savepoint to a transaction |
void |
enableBackend(DatabaseBackend db)
Enable a backend that has been previously added to this virtual database and that is in the disabled state. |
abstract ControllerResultSet |
execDistributedReadStoredProcedure(StoredProcedure proc)
Distributed implementation of a read stored procedure execution. |
abstract int |
execDistributedWriteRequest(AbstractWriteRequest request)
Distributed implementation of a write request execution. |
abstract ControllerResultSet |
execDistributedWriteRequestWithKeys(AbstractWriteRequest request)
Distributed implementation of a write request execution that returns auto-generated keys. |
abstract int |
execDistributedWriteStoredProcedure(StoredProcedure proc)
Distributed implementation of a write stored procedure execution. |
int |
execDistributedWriteStoredProcedureLocally(StoredProcedure proc)
Once the request has been dispatched, it can be executed using the code from RequestManager |
ControllerResultSet |
execLocalReadRequest(SelectRequest request)
Performs a local read operation, as opposed to execReadRequest() which attempts to use distributed reads when there is NoMoreBackendException. |
ControllerResultSet |
execReadRequest(SelectRequest request)
Perform a read request and return the reply. |
ControllerResultSet |
execReadStoredProcedure(StoredProcedure proc)
Call a stored procedure that returns a ResultSet. |
ControllerResultSet |
execReadStoredProcedureLocally(StoredProcedure proc)
Once the request has been dispatched, it can be executed using the code from RequestManager |
abstract ControllerResultSet |
execRemoteReadRequest(SelectRequest request)
Execute a read request on some remote controller - one in the group. |
int |
execWriteRequest(AbstractWriteRequest request)
Perform a write request and return the number of rows affected Call first the scheduler (if defined), then notify the cache (if defined) and finally call the load balancer. |
ControllerResultSet |
execWriteRequestWithKeys(AbstractWriteRequest request)
Perform a write request and return the auto generated keys. |
int |
execWriteStoredProcedure(StoredProcedure proc)
Call a stored procedure that performs an update. |
long |
getControllerId()
Returns the unique controller identifier. |
Trace |
getLogger()
Get the trace logger of this DistributedRequestManager |
VirtualDatabase |
getVirtualDatabase()
Returns the vdb value. |
void |
lazyTransactionStart(AbstractRequest request)
Check if the transaction corresponding to the given query has been started remotely and start the transaction locally in a lazy manner if needed. |
void |
releaseSavepoint(long transactionId,
java.lang.String name)
Releases a savepoint given its name from a transaction given its id. |
void |
removeFailedCommitFromRecoveryLog(TransactionMarkerMetaData tm)
Remove a commit call that was logged because no backend was available locally to execute it but that finally ended up in failing at all other controllers. |
void |
removeFailedRequestFromRecoveryLog(AbstractWriteRequest request,
long recoveryLogId)
Remove a request that was logged because no backend was available locally to execute it but that finally ended up in failing at all other controllers. |
void |
removeFailedRollbackFromRecoveryLog(TransactionMarkerMetaData tm)
Remove a rollback call that was logged because no backend was available locally to execute it but that finally ended up in failing at all other controllers. |
void |
removeFailedStoredProcedureFromRecoveryLog(StoredProcedure proc)
Remove a stored procedure call that was logged because no backend was available locally to execute it but that finally ended up in failing at all other controllers. |
void |
rollback(long transactionId,
boolean logRollback)
Rollback a transaction given its id. |
void |
rollback(long transactionId,
java.lang.String savepointName)
Rollback a transaction given its id to a savepoint given its name. |
void |
scheduleExecWriteRequest(AbstractWriteRequest request)
Schedule a request for execution. |
void |
setControllerId(long id)
Sets the controller identifier value (this id must be unique). |
int |
setSavepoint(long transactionId)
Sets a unnamed savepoint to a transaction given its id. |
void |
setSavepoint(long transactionId,
java.lang.String name)
Sets a savepoint given its desired name to a transaction given its id. |
void |
setScheduler(AbstractScheduler scheduler)
Set the Request Scheduler to use in this Request Controller. |
Methods inherited from class org.objectweb.cjdbc.controller.jmx.AbstractStandardMBean |
addNotificationListener, getDescription, getDescription, getDescription, getDescription, getDescription, getDescription, getNotificationInfo, getParameterName, getParameterName, removeNotificationListener, removeNotificationListener, sendNotification |
Methods inherited from class javax.management.StandardMBean |
cacheMBeanInfo, getAttribute, getAttributes, getCachedMBeanInfo, getClassName, getConstructors, getDescription, getImpact, getImplementation, getImplementationClass, getMBeanInfo, getMBeanInterface, invoke, setAttribute, setAttributes, setImplementation |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
protected DistributedVirtualDatabase dvdb
private java.util.Vector failedOnAllBackends
private long controllerId
private java.util.ArrayList distributedTransactions
protected static final int NO_RESULT
public static final long CONTROLLER_ID_BIT_MASK
public static final long TRANSACTION_ID_BIT_MASK
public static final int CONTROLLER_ID_SHIFT_BITS
CONTROLLER_ID_BIT_MASK
,
Constant Field Valuespublic static final long CONTROLLER_ID_BITS
CONTROLLER_ID_BIT_MASK
,
Constant Field ValuesConstructor Detail |
public DistributedRequestManager(DistributedVirtualDatabase vdb, AbstractScheduler scheduler, AbstractResultCache cache, AbstractLoadBalancer loadBalancer, RecoveryLog recoveryLog, long beginTimeout, long commitTimeout, long rollbackTimeout) throws java.sql.SQLException, javax.management.NotCompliantMBeanException
DistributedRequestManager
instance without
cache.
vdb
- the virtual database this request manager belongs toscheduler
- the Request Scheduler to usecache
- a Query Cache implementationloadBalancer
- the Request Load Balancer to userecoveryLog
- the Log Recovery to usebeginTimeout
- timeout in seconds for begincommitTimeout
- timeout in seconds for commitrollbackTimeout
- timeout in seconds for rollback
java.sql.SQLException
- if an error occurs
javax.management.NotCompliantMBeanException
- if this class is not a compliant JMX
MBeanMethod Detail |
public long getControllerId()
public void setControllerId(long id)
id
- The controllerId to set.public Trace getLogger()
Trace
objectpublic VirtualDatabase getVirtualDatabase()
getVirtualDatabase
in class RequestManager
public void setScheduler(AbstractScheduler scheduler)
RequestManager
setScheduler
in class RequestManager
scheduler
- a Request Scheduler implementationRequestManager.setScheduler(org.objectweb.cjdbc.controller.scheduler.AbstractScheduler)
public void enableBackend(DatabaseBackend db) throws java.sql.SQLException
enableBackend
in class RequestManager
db
- The database backend to enable
java.sql.SQLException
- if an error occurspublic void disableBackend(DatabaseBackend db) throws java.sql.SQLException
RequestManager
The backend is disabled without further check.
The load balancer disabled method is called on the specified backend.
disableBackend
in class RequestManager
db
- The database backend to disable
java.sql.SQLException
- if an error occursRequestManager.disableBackend(org.objectweb.cjdbc.controller.backend.DatabaseBackend)
public void disableBackendForCheckpoint(DatabaseBackend db, java.lang.String checkpointName) throws java.sql.SQLException
The backend is disabled once all the pending write queries are executed. A checkpoint is inserted in the recovery log.
disableBackendForCheckpoint
in class RequestManager
db
- The database backend to enablecheckpointName
- The checkpoint name to restart from
java.sql.SQLException
- if an error occurspublic void addFailedOnAllBackends(AbstractRequest request)
request
- the request that failedcompleteFailedOnAllBackends(AbstractRequest, boolean)
public void completeFailedOnAllBackends(AbstractRequest request, boolean success)
request
- request that completedsuccess
- true if completion is successfuladdFailedOnAllBackends(AbstractRequest)
public void removeFailedRequestFromRecoveryLog(AbstractWriteRequest request, long recoveryLogId)
request
- request that was logged but failed at all controllersrecoveryLogId
- request identifier in the recovery log on controller
where the request should be unloggedpublic void removeFailedStoredProcedureFromRecoveryLog(StoredProcedure proc)
proc
- stored procedure that was logged but failed at all controllerspublic void removeFailedCommitFromRecoveryLog(TransactionMarkerMetaData tm)
tm
- the identifier of the transaction that failed to commitpublic void removeFailedRollbackFromRecoveryLog(TransactionMarkerMetaData tm)
tm
- the identifier of the transaction that failed to rollbackpublic long begin(java.lang.String login) throws java.sql.SQLException
RequestManager
Note that the transaction begin is not logged in the recovery log by this method, you will have to call logLazyTransactionBegin.
begin
in class RequestManager
login
- the login used by the connection
java.sql.SQLException
- if an error occursRequestManager.begin(java.lang.String)
public void lazyTransactionStart(AbstractRequest request) throws java.sql.SQLException
request
- query to execute
java.sql.SQLException
- if an error occurspublic void commit(long transactionId, boolean logCommit) throws java.sql.SQLException
RequestManager
commit
in class RequestManager
transactionId
- the transaction idlogCommit
- true if the commit should be logged in the recovery log
java.sql.SQLException
- if an error occursRequestManager.commit(long,
boolean)
public void rollback(long transactionId, boolean logRollback) throws java.sql.SQLException
RequestManager
rollback
in class RequestManager
transactionId
- the transaction idlogRollback
- true if the rollback should be logged in the recovery
log
java.sql.SQLException
- if an error occursRequestManager.rollback(long,
boolean)
public void rollback(long transactionId, java.lang.String savepointName) throws java.sql.SQLException
RequestManager
rollback
in class RequestManager
transactionId
- the transaction idsavepointName
- the name of the savepoint
java.sql.SQLException
- if an error occursRequestManager.rollback(long,
String)
public int setSavepoint(long transactionId) throws java.sql.SQLException
RequestManager
setSavepoint
in class RequestManager
transactionId
- the transaction id
java.sql.SQLException
- if an error occursRequestManager.setSavepoint(long)
public void setSavepoint(long transactionId, java.lang.String name) throws java.sql.SQLException
RequestManager
setSavepoint
in class RequestManager
transactionId
- the transaction idname
- the desired name of the savepoint
java.sql.SQLException
- if an error occursRequestManager.setSavepoint(long,
String)
public void releaseSavepoint(long transactionId, java.lang.String name) throws java.sql.SQLException
RequestManager
releaseSavepoint
in class RequestManager
transactionId
- the transaction idname
- the name of the savepoint
java.sql.SQLException
- if an error occursRequestManager.releaseSavepoint(long,
String)
public void scheduleExecWriteRequest(AbstractWriteRequest request) throws java.sql.SQLException
RequestManager
scheduleExecWriteRequest
in class RequestManager
request
- the request to execute
java.sql.SQLException
- if an error occursRequestManager.scheduleExecWriteRequest(org.objectweb.cjdbc.common.sql.AbstractWriteRequest)
public ControllerResultSet execReadRequest(SelectRequest request) throws java.sql.SQLException
RequestManager
execReadRequest
in class RequestManager
request
- the request to execute
ControllerResultSet
value
java.sql.SQLException
- if an error occursRequestManager.execReadRequest(org.objectweb.cjdbc.common.sql.SelectRequest)
public abstract ControllerResultSet execRemoteReadRequest(SelectRequest request) throws java.sql.SQLException
request
- the request to execute
java.sql.SQLException
- in case of bad requestpublic int execWriteRequest(AbstractWriteRequest request) throws java.sql.SQLException
RequestManager
execWriteRequest
in class RequestManager
request
- the request to execute
java.sql.SQLException
- if an error occursRequestManager.execWriteRequest(org.objectweb.cjdbc.common.sql.AbstractWriteRequest)
public ControllerResultSet execWriteRequestWithKeys(AbstractWriteRequest request) throws java.sql.SQLException
RequestManager
execWriteRequestWithKeys
in class RequestManager
request
- the request to execute
java.sql.SQLException
- if an error occursRequestManager.execWriteRequestWithKeys(org.objectweb.cjdbc.common.sql.AbstractWriteRequest)
public ControllerResultSet execReadStoredProcedure(StoredProcedure proc) throws java.sql.SQLException
RequestManager
execReadStoredProcedure
in class RequestManager
proc
- the stored procedure call
ControllerResultSet
value
java.sql.SQLException
- if an error occursRequestManager.execReadStoredProcedure(StoredProcedure)
public int execWriteStoredProcedure(StoredProcedure proc) throws java.sql.SQLException
RequestManager
execWriteStoredProcedure
in class RequestManager
proc
- the stored procedure call
java.sql.SQLException
- if an error occursRequestManager.execWriteStoredProcedure(org.objectweb.cjdbc.common.sql.StoredProcedure)
public abstract void distributedCommit(java.lang.String login, long transactionId) throws java.sql.SQLException
login
- login that commit the transactiontransactionId
- id of the commiting transaction
java.sql.SQLException
- if an error occurspublic abstract void distributedRollback(java.lang.String login, long transactionId) throws java.sql.SQLException
login
- login that rollback the transactiontransactionId
- id of the rollbacking transaction
java.sql.SQLException
- if an error occurspublic abstract void distributedRollback(long transactionId, java.lang.String savepointName) throws java.sql.SQLException
transactionId
- id of the transactionsavepointName
- name of the savepoint
java.sql.SQLException
- if an error occurspublic abstract void distributedSetSavepoint(long transactionId, java.lang.String name) throws java.sql.SQLException
transactionId
- id of the transactionname
- name of the savepoint to set
java.sql.SQLException
- if an error occurspublic abstract void distributedReleaseSavepoint(long transactionId, java.lang.String name) throws java.sql.SQLException
transactionId
- id of the transactionname
- name of the savepoint to release
java.sql.SQLException
- if an error occurspublic abstract int execDistributedWriteRequest(AbstractWriteRequest request) throws java.sql.SQLException
request
- request to execute
java.sql.SQLException
- if an error occurspublic abstract ControllerResultSet execDistributedWriteRequestWithKeys(AbstractWriteRequest request) throws java.sql.SQLException
request
- request to execute
java.sql.SQLException
- if an error occurspublic abstract ControllerResultSet execDistributedReadStoredProcedure(StoredProcedure proc) throws java.sql.SQLException
proc
- stored procedure to execute
java.sql.SQLException
- if an error occurspublic abstract int execDistributedWriteStoredProcedure(StoredProcedure proc) throws java.sql.SQLException
proc
- stored procedure to execute
java.sql.SQLException
- if an error occurspublic ControllerResultSet execReadStoredProcedureLocally(StoredProcedure proc) throws AllBackendsFailedException, java.sql.SQLException
RequestManager
proc
- stored procedure to execute
AllBackendsFailedException
- if all backends failed to execute the
stored procedure
java.sql.SQLException
- if an error occurspublic int execDistributedWriteStoredProcedureLocally(StoredProcedure proc) throws AllBackendsFailedException, java.sql.SQLException
RequestManager
proc
- stored procedure to execute
AllBackendsFailedException
- if all backends failed to execute the
stored procedure
java.sql.SQLException
- if an error occurspublic ControllerResultSet execLocalReadRequest(SelectRequest request) throws NoMoreBackendException, java.sql.SQLException
request
- the read request to perform
NoMoreBackendException
- when no more local backends are available to
execute the request
java.sql.SQLException
- in case of error
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |