Java Doc for RecoveryLog.java in  » Database-JDBC-Connection-Pool » sequoia-2.10.9 » org » continuent » sequoia » controller » recoverylog » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » Database JDBC Connection Pool » sequoia 2.10.9 » org.continuent.sequoia.controller.recoverylog 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   org.continuent.sequoia.controller.recoverylog.RecoveryLog

RecoveryLog
public class RecoveryLog implements XmlComponent(Code)
Recovery Log using a database accessed through JDBC.
author:
   Emmanuel Cecchet
author:
   Julie Marguerite
author:
   Nicolas Modrzyk *
author:
   Jean-Bernard van Zuylen
author:
  

version:
   1.0

Inner Class :abstract class QueryHandler

Field Summary
final static  StringBEGIN
    
final public static  intCOLUMN_INDEX_AUTO_CONN_TRAN
    
final public static  intCOLUMN_INDEX_EXEC_STATUS
    
final public static  intCOLUMN_INDEX_EXEC_TIME
    
final public static  intCOLUMN_INDEX_LOG_ID
    
final public static  intCOLUMN_INDEX_REQUEST_ID
    
final public static  intCOLUMN_INDEX_SQL
    
final public static  intCOLUMN_INDEX_SQL_PARAMS
    
final public static  intCOLUMN_INDEX_TRANSACTION_ID
    
final public static  intCOLUMN_INDEX_UPDATE_COUNT
    
final public static  intCOLUMN_INDEX_VLOGIN
    
final public static  StringUNKNOWN_USER
    
static  TraceendUserLogger
    
static  Tracelogger
    
protected  intrecoveryBatchSize
    

Constructor Summary
public  RecoveryLog(String driverName, String driverClassName, String url, String login, String password, int requestTimeout, int recoveryBatchSize)
     Creates a new RecoveryLog instance.

Method Summary
public synchronized  voidbeginRecovery()
     Notify the recovery log that a recovery process has started.
 voidcheckDatabaseConnection()
     Checks that the connection to the recoverylog database is still valid and if it is not attempts one reconnect.
public  voidcheckRecoveryLogConsistency()
     Check the recovery log consistency for the first controller starting in a cluster (might come back from a complete cluster outage).
public  voidcheckRecoveryLogTables()
     Checks if the recovery log and checkpoint tables exist, and create them if they do not exist.
public  voidcleanRecoveryLog()
     Possibly clean the recovery log after all recovery process are done.
public  voidclearLastManDown()
    
public  voiddeleteLogEntriesAndCheckpointBetween(long fromId, long toId)
     Delete the log entries from the fromId id to toId.
public  voiddeleteLogEntriesBeforeCheckpoint(String checkpointName)
     Deletes recovery log entries that are older than specified checkpoint.
public synchronized  voidendRecovery()
     Notify the recovery log that a recovery process has finished.
 ObjectexecuteQuery(String query, QueryHandler handler)
    
public  booleanfindCloseForPersistentConnection(long persistentConnectionId)
     Tries to find a close for a given persistent connection ID.
public  booleanfindCommitForTransaction(long transactionId)
     Tries to find a commit for a given transaction ID.
public  booleanfindRollbackForTransaction(long transactionId)
     Tries to find a rollback for a given transaction ID.
public  StringgetAssociatedString()
    
public  BackendRecoveryInfogetBackendRecoveryInfo(String databaseName, String backendName)
     Retrieve recovery information on a backend.
public  StringgetBackendTableName()
     Returns the backendTableName value.
public  CheckpointLogEntrygetCheckpointLogEntry(String checkpointName)
     Get the log entry corresponding to a given checkpoint.
public  longgetCheckpointLogId(String checkpointName)
     Get the log id corresponding to a given checkpoint.
public  String[]getCheckpointNameAliases(String checkpointName)
     Returns a list of checkpoint names (strings) that all represent the same point in time (same log id) as specified 'checkpointName'.
public  ArrayListgetCheckpointNames()
     Returns a time-ordered odered (most recent first) array of names of all the checkpoint available in the recovery log.
public  StringgetCheckpointTableName()
     Returns the checkpointTableName value.
 MapgetCheckpoints()
     Returns a Map<String, String> of checkpoints where the keys are the checkpoint names and the values are the corresponding log IDs.
 String[]getColumnNames()
    
public  StringgetCommitStatusForTransaction(long transactionId)
     Tries to find a commit for a given transaction ID.
protected  longgetCurrentLogId()
     Return the current log id.
public  String[][]getData()
    
protected synchronized  ConnectiongetDatabaseConnection()
     Gets a connection to the database.
public  DumpInfogetDumpInfo(String dumpName)
     Get the DumpInfo element corresponding to the given dump name.
public  ArrayListgetDumpList()
     Retrieve the list of available dumps.
 long[]getIndexes()
    
public  longgetLastConnectionId(long controllerId)
     Get the id of the last transaction logged in the recovery log.
public  longgetLastRequestId(long controllerId)
     Get the id of the last request logged in the recovery log.
public  longgetLastTransactionId(long controllerId)
     Get the id of the last transaction logged in the recovery log.
 String[][]getLogEntries(long from, int maxrows)
    
 String[][]getLogEntriesInTransaction(long tid)
    
public  StringgetLogTableName()
     Returns the logTableName value.
public  StringgetLogTableSqlColumnName()
     Returns the logTableSqlColumnName value.
public  LogEntrygetNextLogEntry(long previousLogEntryId)
     Get the next log entry from the recovery log given the id of the previous log entry.
public  longgetNumberOfLogEntries(long lowerLogId, long upperLogId)
     Return the real number of log entries between 2 log ids (usually matching checkpoint indices).
 longgetNumberOfLogEntries()
     Returns the number of log entries currently in the log table.
public  longgetRecoveringNb()
     Returns the recoveringNb value.
public  intgetRecoveryBatchSize()
    
public  intgetRecoveryLogSize()
    
public  StringgetRollbackStatusForTransaction(long transactionId)
     Tries to find a rollback for a given transaction ID and returns its status if found.
public  intgetUpdateCountResultForQuery(long requestId)
     Get the update count result for the execution of the query that has the provided unique id.
public  StringgetXml()
    
public  booleanhasLoggedBeginForTransaction(Long tid)
     Returns true if the recovery log has logged a Begin for the given transaction id.
synchronized  longincrementLogTableId()
     Increments the value of logTableId.
protected synchronized  voidinvalidateInternalConnection()
     Invalidate the connection when an error occurs so that the next call to getDatabaseConnection() re-allocates a new connection.
public  booleanisLastManDown()
    
public synchronized  booleanisRecovering()
     Returns true if at least one backend has started a recover process.
public  longlogAbort(TransactionMetaData tm)
     Log a transaction abort.
public  longlogBegin(TransactionMetaData tm)
     Log the beginning of a new transaction (always as a SUCCESS not EXECUTING).
public  longlogClosePersistentConnection(String login, long persistentConnectionId)
     Log the closing of the given persistent connection (always as a SUCCESS).
public  longlogCommit(TransactionMetaData tm)
     Log a transaction commit.
public  voidlogLogEntry(LogEntry logEntry)
     Log a log entry in the recovery log.
public  longlogOpenPersistentConnection(String login, long persistentConnectionId)
     Log the opening of the given persistent connection (always as a SUCCESS).
public  longlogReleaseSavepoint(TransactionMetaData tm, String name)
     Log a transaction savepoint removal.
public  voidlogRequestCompletion(long logId, boolean success, long execTime)
     Update the completion status of a request completion in the recovery log given its id.
public  voidlogRequestCompletion(long logId, boolean success, long execTimeInMs, int updateCount)
     Update the completion status of a request completion in the recovery log given its id.
public  voidlogRequestExecuteUpdateCompletion(long logId, boolean success, int updateCount, long execTime)
     Update the completion status of a request executed with executeUpdate().
public  longlogRequestExecuting(AbstractRequest request)
     Log a request (read or write) that is going to execute and set the logId on the request object.
public  longlogRollback(TransactionMetaData tm)
     Log a transaction rollback.
public  longlogRollbackToSavepoint(TransactionMetaData tm, String savepointName)
    
public  longlogSetSavepoint(TransactionMetaData tm, String name)
     Log a transaction savepoint.
public  voidmoveEntries(long fromId, long shift)
     Shift the log entries from the given checkpoint id by the shift factor provided.
public  RecoveryTaskrecoverNextRequest(long previousRequestId, AbstractScheduler scheduler)
     Get the next request (begin/commit/rollback or WriteRequest) from the recovery log given the id of the previously recovered request.
public  voidremoveCheckpoint(String checkpointName)
     Remove a checkpoint from the recovery.
public  voidremoveDump(DumpInfo dumpInfo)
     Remove a dump information from the dump table base.
public  voidresetLogTableIdAndDeleteRecoveryLog(String checkpointName, long newCheckpointId)
     Reset the current log table id and delete the recovery log information older than the given checkpoint.
public  voidresetRecoveryLog(boolean resetLogId)
     Reset the recovery log by deleting the log table and checkpoint table.
 voidscheduleCloserTask()
    
public  voidsetAutoCloseTimeout(int seconds)
     used by vdb.xml parser (element Recoverylog) to enable and set optional autoclosing mechanism.
public  voidsetBackendTableCreateStatement(String createTable, String tableName, String checkpointNameType, String backendNameType, String backendStateType, String databaseNameType, String extraStatement)
    
public  voidsetCheckConnectionValidity()
    
public  voidsetCheckpointTableCreateStatement(String createTable, String tableName, String nameType, String logIdType, String extraStatement)
     Sets the checkpoint table name and create statement.
public  voidsetDumpInfo(DumpInfo dumpInfo)
     Set DumpInfo, thereby making a new dump available for restore.
public  voidsetDumpTableCreateStatement(String createTable, String tableName, String dumpNameColumnType, String dumpDateColumnType, String dumpPathColumnType, String dumpFormatColumnType, String checkpointNameColumnType, String backendNameColumnType, String tablesColumnName, String tablesColumnType, String extraStatement)
     Sets the dump table name and create statement.
public  voidsetLastManDown()
    
public  voidsetLogTableCreateStatement(String createTable, String tableName, String idType, String vloginType, String sqlName, String sqlType, String sqlParamsType, String autoConnTranColumnType, String transactionIdType, String requestIdType, String execTimeType, String updateCountType, String extraStatement)
     Sets the log table name and create statement.
public  voidshutdown()
     Shutdown the recovery log and all its threads by enqueueing a log shutdown event and waiting until it is processed.
public  voidstoreBackendRecoveryInfo(String databaseName, BackendRecoveryInfo backendRecoveryInfo)
    
public  voidstoreCheckpoint(String checkpointName)
     Store a Checkpoint using the current log state.
public  voidstoreCheckpoint(String checkpointName, long logId)
     Store a Checkpoint with the given log id.
public  voidstoreDump(DumpInfo dump)
    
public  voidstoreDumpCheckpointName(String dumpCheckpointName, long checkpointId)
    
public  voidupdateDumpCheckpoint(String dumpName, String checkpointName)
     Update the checkpoint name for specified dump, making it available for restore operations.
public  voidupdateDumpPath(String dumpName, String newPath)
     Update the path name for a given checkpoint.
 voidupdateDumpTableColumn(String dumpName, String columnName, String value)
     Updates specified DumpTable entry column with specified value.

Field Detail
BEGIN
final static String BEGIN(Code)



COLUMN_INDEX_AUTO_CONN_TRAN
final public static int COLUMN_INDEX_AUTO_CONN_TRAN(Code)
Index of the auto_conn_tran column in the log table



COLUMN_INDEX_EXEC_STATUS
final public static int COLUMN_INDEX_EXEC_STATUS(Code)
Index of the exec_status column in the log table



COLUMN_INDEX_EXEC_TIME
final public static int COLUMN_INDEX_EXEC_TIME(Code)
Index of the exec_time column in the log table



COLUMN_INDEX_LOG_ID
final public static int COLUMN_INDEX_LOG_ID(Code)
Index of the log id column in the log table



COLUMN_INDEX_REQUEST_ID
final public static int COLUMN_INDEX_REQUEST_ID(Code)
Index of the request id column in the log table



COLUMN_INDEX_SQL
final public static int COLUMN_INDEX_SQL(Code)
Index of the sql column in the log table



COLUMN_INDEX_SQL_PARAMS
final public static int COLUMN_INDEX_SQL_PARAMS(Code)
Index of the sql_param column in the log table



COLUMN_INDEX_TRANSACTION_ID
final public static int COLUMN_INDEX_TRANSACTION_ID(Code)
Index of the transaction id column in the log table



COLUMN_INDEX_UPDATE_COUNT
final public static int COLUMN_INDEX_UPDATE_COUNT(Code)
Index of the update_count column in the log table



COLUMN_INDEX_VLOGIN
final public static int COLUMN_INDEX_VLOGIN(Code)
Index of the vlogin column in the log table



UNKNOWN_USER
final public static String UNKNOWN_USER(Code)
Unkown user used for transaction abort when the transactional context cannot be retrieved



endUserLogger
static Trace endUserLogger(Code)



logger
static Trace logger(Code)



recoveryBatchSize
protected int recoveryBatchSize(Code)
Size of the pendingRecoveryTasks queue used by the recover thread




Constructor Detail
RecoveryLog
public RecoveryLog(String driverName, String driverClassName, String url, String login, String password, int requestTimeout, int recoveryBatchSize)(Code)
Creates a new RecoveryLog instance.
Parameters:
  driverName - the driverClassName name.
Parameters:
  driverClassName - the driverClassName class name.
Parameters:
  url - the JDBC URL.
Parameters:
  login - the login to use to connect to the database.
Parameters:
  password - the password to connect to the database.
Parameters:
  requestTimeout - timeout in seconds for update queries.
Parameters:
  recoveryBatchSize - number of queries that can be accumulated into abatch when recovering




Method Detail
beginRecovery
public synchronized void beginRecovery()(Code)
Notify the recovery log that a recovery process has started.



checkDatabaseConnection
void checkDatabaseConnection() throws SQLException(Code)
Checks that the connection to the recoverylog database is still valid and if it is not attempts one reconnect.
throws:
  SQLException - if an error happens at re-connection



checkRecoveryLogConsistency
public void checkRecoveryLogConsistency() throws SQLException(Code)
Check the recovery log consistency for the first controller starting in a cluster (might come back from a complete cluster outage).
throws:
  SQLException - if a recovery log access error occurs



checkRecoveryLogTables
public void checkRecoveryLogTables()(Code)
Checks if the recovery log and checkpoint tables exist, and create them if they do not exist. This method also starts the logger thread.



cleanRecoveryLog
public void cleanRecoveryLog() throws SQLException(Code)
Possibly clean the recovery log after all recovery process are done. This removes all failed statements or transactions without side effect from the recovery log.
exception:
  SQLException - if an error occurs.



clearLastManDown
public void clearLastManDown() throws SQLException(Code)



deleteLogEntriesAndCheckpointBetween
public void deleteLogEntriesAndCheckpointBetween(long fromId, long toId)(Code)
Delete the log entries from the fromId id to toId.
Parameters:
  fromId - id where to start the move
Parameters:
  toId - increment to add to log entries id



deleteLogEntriesBeforeCheckpoint
public void deleteLogEntriesBeforeCheckpoint(String checkpointName) throws SQLException(Code)
Deletes recovery log entries that are older than specified checkpoint. The log entry pointed to by 'checkpointName' is kept in the recovery log to make sure that logId numbering is not reset in case of full clearance. (upon vdb restart, member logTableId is initialized with max(log_id) found in the database, see code in intializeDatabase()).
Parameters:
  checkpointName - the name of the checkpoint uptil which log entriesshould be removed
throws:
  SQLException - in case of error.



endRecovery
public synchronized void endRecovery()(Code)
Notify the recovery log that a recovery process has finished. If this is the last recovery process to finish, the cleanRecoveryLog method is called
See Also:   RecoveryLog.cleanRecoveryLog()



executeQuery
Object executeQuery(String query, QueryHandler handler) throws SQLException(Code)



findCloseForPersistentConnection
public boolean findCloseForPersistentConnection(long persistentConnectionId) throws SQLException(Code)
Tries to find a close for a given persistent connection ID.
Parameters:
  persistentConnectionId - the persistent connection ID to look for true if close was found in recovery log, false otherwise
throws:
  SQLException - if there was a problem while searching the recoverylog



findCommitForTransaction
public boolean findCommitForTransaction(long transactionId) throws SQLException(Code)
Tries to find a commit for a given transaction ID.
Parameters:
  transactionId - the transaction id to look for true if commit was found in recovery log, false otherwise
throws:
  SQLException - if there was a problem while searching the recoverylog



findRollbackForTransaction
public boolean findRollbackForTransaction(long transactionId) throws SQLException(Code)
Tries to find a rollback for a given transaction ID.
Parameters:
  transactionId - the transaction id to look for true if rollback was found in recovery log, false otherwise
throws:
  SQLException - if there was a problem while searching the recoverylog



getAssociatedString
public String getAssociatedString()(Code)

See Also:   org.continuent.sequoia.controller.jmx.AbstractStandardMBean.getAssociatedString



getBackendRecoveryInfo
public BackendRecoveryInfo getBackendRecoveryInfo(String databaseName, String backendName) throws SQLException(Code)
Retrieve recovery information on a backend. This includes, the last known state of the backend, and the last known checkpoint
Parameters:
  databaseName - the virtual database name
Parameters:
  backendName - the backend name BackendRecoveryInfo instance or null if the backend does not exist
throws:
  SQLException - if a database access error occurs



getBackendTableName
public String getBackendTableName()(Code)
Returns the backendTableName value. Returns the backendTableName.



getCheckpointLogEntry
public CheckpointLogEntry getCheckpointLogEntry(String checkpointName) throws SQLException(Code)
Get the log entry corresponding to a given checkpoint. This is used to set a checkpoint globally cluster-wide using the unique log entry.
Parameters:
  checkpointName - Name of the checkpoint a CheckpointLogEntry corresponding to this checkpoint.
exception:
  SQLException - if an error occurs or the checkpoint does not exist
See Also:   RecoveryLog.recoverNextRequest(long)



getCheckpointLogId
public long getCheckpointLogId(String checkpointName) throws SQLException(Code)
Get the log id corresponding to a given checkpoint. This is the first step in a recovery process. Following steps consist in calling recoverNextRequest.
Parameters:
  checkpointName - Name of the checkpoint long the log identifier corresponding to this checkpoint.
exception:
  SQLException - if an error occurs or the checkpoint does not exist
See Also:   RecoveryLog.recoverNextRequest(long)



getCheckpointNameAliases
public String[] getCheckpointNameAliases(String checkpointName) throws SQLException(Code)
Returns a list of checkpoint names (strings) that all represent the same point in time (same log id) as specified 'checkpointName'. The list is never null and includes the specified 'checkpointName'.
Parameters:
  checkpointName - the checkpoint name a list of checkpoint names (strings) that all represent the samepoint in time (same log id)
throws:
  SQLException - if no such checkpoint exists of if there is an error



getCheckpointNames
public ArrayList getCheckpointNames() throws SQLException(Code)
Returns a time-ordered odered (most recent first) array of names of all the checkpoint available in the recovery log. this method may not return the exact list of checkpoint names (since it is called concurrently to events posted to the recovery log queue). a time-ordered odered (most recent first) ArrayListof String checkpoint names
throws:
  SQLException - if fails



getCheckpointTableName
public String getCheckpointTableName()(Code)
Returns the checkpointTableName value. Returns the checkpointTableName.



getCheckpoints
Map getCheckpoints() throws SQLException(Code)
Returns a Map<String, String> of checkpoints where the keys are the checkpoint names and the values are the corresponding log IDs. The Map is orderered by log IDs (newest first). a Map<String, String> of checkpoints (key=checkpoint name, value = log id)
throws:
  SQLException - if an error occurs while retrieving the checkpointsinformation from the checkpoint table



getColumnNames
String[] getColumnNames()(Code)



getCommitStatusForTransaction
public String getCommitStatusForTransaction(long transactionId) throws SQLException(Code)
Tries to find a commit for a given transaction ID.
Parameters:
  transactionId - the transaction id to look for commit status if found in recovery log, "" otherwise
throws:
  SQLException - if there was a problem while searching the recoverylog



getCurrentLogId
protected long getCurrentLogId()(Code)
Return the current log id. the current log id.



getData
public String[][] getData()(Code)
Allow to get the content of the recovery log for viewing String[][]
See Also:   org.continuent.sequoia.controller.monitoring.datacollector.DataCollector.retrieveRecoveryLogData(String)



getDatabaseConnection
protected synchronized Connection getDatabaseConnection() throws SQLException(Code)
Gets a connection to the database. a connection to the database
exception:
  SQLException - if an error occurs.
See Also:   RecoveryLog.invalidateInternalConnection()



getDumpInfo
public DumpInfo getDumpInfo(String dumpName) throws SQLException(Code)
Get the DumpInfo element corresponding to the given dump name. Returns null if no information is found for this dump name.
Parameters:
  dumpName - the name of the dump to look for a DumpInfo object or null if not found in the table
throws:
  SQLException - if a recovery log database access error occurs



getDumpList
public ArrayList getDumpList() throws SQLException(Code)
Retrieve the list of available dumps. an ArrayList of DumpInfo objects
throws:
  SQLException - if a recovery log database access error occurs



getIndexes
long[] getIndexes() throws SQLException(Code)
returns an long[2] for min and max log_id in the log table an long[2] for min and max log_id in the log table
throws:
  SQLException - if an error occurs while computing the index of thelog table



getLastConnectionId
public long getLastConnectionId(long controllerId) throws SQLException(Code)
Get the id of the last transaction logged in the recovery log.
Parameters:
  controllerId - the controller ID which determines the search space fortransaction IDs the last transaction id.
throws:
  SQLException - if an error occured while retrieving the id.



getLastRequestId
public long getLastRequestId(long controllerId) throws SQLException(Code)
Get the id of the last request logged in the recovery log.
Parameters:
  controllerId - the controller ID which determines the search space forrequest IDs the last request id.
throws:
  SQLException - if an error occured while retrieving the id.



getLastTransactionId
public long getLastTransactionId(long controllerId) throws SQLException(Code)
Get the id of the last transaction logged in the recovery log.
Parameters:
  controllerId - the controller ID which determines the search space fortransaction IDs the last transaction id.
throws:
  SQLException - if an error occured while retrieving the id.



getLogEntries
String[][] getLogEntries(long from, int maxrows)(Code)
Exposes the contents of the recovery log table as a matrix of String.
this method should be only used for management/debugging purpose
Parameters:
  from - the starting index from which the log entries are retrieved(corresponds to the log_id column)
Parameters:
  maxrows - the maximum number of rows to retrieve a matrix of String representing the content of the recovery logtable



getLogEntriesInTransaction
String[][] getLogEntriesInTransaction(long tid)(Code)



getLogTableName
public String getLogTableName()(Code)
Returns the logTableName value. Returns the logTableName.



getLogTableSqlColumnName
public String getLogTableSqlColumnName()(Code)
Returns the logTableSqlColumnName value. Returns the logTableSqlColumnName.



getNextLogEntry
public LogEntry getNextLogEntry(long previousLogEntryId) throws SQLException(Code)
Get the next log entry from the recovery log given the id of the previous log entry.
Parameters:
  previousLogEntryId - previous log entry identifier the next log entry from the recovery log or null if no furtherentry can be found
throws:
  SQLException - if an error occurs while accesing the recovery log



getNumberOfLogEntries
public long getNumberOfLogEntries(long lowerLogId, long upperLogId) throws SQLException(Code)
Return the real number of log entries between 2 log ids (usually matching checkpoint indices). The SELECT includes both boundaries. The value is retrieved through an event posted in the logger thread queue (makes sure that all previous entries have been flushed to the log).
Parameters:
  lowerLogId - the lower log id
Parameters:
  upperLogId - the upper log id the number of entries between the 2 ids
throws:
  SQLException - if an error occurs querying the recovery log



getNumberOfLogEntries
long getNumberOfLogEntries() throws SQLException(Code)
Returns the number of log entries currently in the log table. The method is not accurate since this number can change very quickly but it is correct enough for management purposes. the number of log entries currently in the log table
throws:
  SQLException - if an error occurs while counting the number of logentries in the log table



getRecoveringNb
public long getRecoveringNb()(Code)
Returns the recoveringNb value. Returns the recoveringNb.



getRecoveryBatchSize
public int getRecoveryBatchSize()(Code)
Number of queries that can be accumulated into a batch when recovering the recovery batch size



getRecoveryLogSize
public int getRecoveryLogSize() throws SQLException(Code)



getRollbackStatusForTransaction
public String getRollbackStatusForTransaction(long transactionId) throws SQLException(Code)
Tries to find a rollback for a given transaction ID and returns its status if found.
Parameters:
  transactionId - the transaction id to look for commit status if found in recovery log, "" otherwise
throws:
  SQLException - if there was a problem while searching the recoverylog



getUpdateCountResultForQuery
public int getUpdateCountResultForQuery(long requestId) throws SQLException(Code)
Get the update count result for the execution of the query that has the provided unique id.
Parameters:
  requestId - request result to look for update count or -1 if not found
throws:
  SQLException - if an error occured



getXml
public String getXml()(Code)
Gives the log as an XML String the XML representation of the log



hasLoggedBeginForTransaction
public boolean hasLoggedBeginForTransaction(Long tid) throws SQLException(Code)
Returns true if the recovery log has logged a Begin for the given transaction id.
Parameters:
  tid - the transaction identifier true if begin has been logged for this transaction
throws:
  SQLException - if the query fails on the recovery database



incrementLogTableId
synchronized long incrementLogTableId()(Code)
Increments the value of logTableId.



invalidateInternalConnection
protected synchronized void invalidateInternalConnection()(Code)
Invalidate the connection when an error occurs so that the next call to getDatabaseConnection() re-allocates a new connection.
See Also:   RecoveryLog.getDatabaseConnection()



isLastManDown
public boolean isLastManDown() throws SQLException(Code)



isRecovering
public synchronized boolean isRecovering()(Code)
Returns true if at least one backend has started a recover process. boolean



logAbort
public long logAbort(TransactionMetaData tm)(Code)
Log a transaction abort. This is used only for transaction that were started but where no request was executed, which is in fact an empty transaction. The underlying implementation might safely discard the corresponding begin from the log as an optimization.
Parameters:
  tm - The transaction marker metadata the identifier of the entry in the recovery log



logBegin
public long logBegin(TransactionMetaData tm)(Code)
Log the beginning of a new transaction (always as a SUCCESS not EXECUTING).
Parameters:
  tm - The transaction marker metadata the identifier of the entry in the recovery log



logClosePersistentConnection
public long logClosePersistentConnection(String login, long persistentConnectionId)(Code)
Log the closing of the given persistent connection (always as a SUCCESS).
Parameters:
  login - the login executing the request
Parameters:
  persistentConnectionId - the id of the persistent connection to close the identifier of the entry in the recovery log



logCommit
public long logCommit(TransactionMetaData tm)(Code)
Log a transaction commit.
Parameters:
  tm - The transaction marker metadata the identifier of the entry in the recovery log



logLogEntry
public void logLogEntry(LogEntry logEntry)(Code)
Log a log entry in the recovery log.
Parameters:
  logEntry - the log entry to to be written in the recovery log.



logOpenPersistentConnection
public long logOpenPersistentConnection(String login, long persistentConnectionId)(Code)
Log the opening of the given persistent connection (always as a SUCCESS).
Parameters:
  login - the login executing the request
Parameters:
  persistentConnectionId - the id of the persistent connection to open the identifier of the entry in the recovery log



logReleaseSavepoint
public long logReleaseSavepoint(TransactionMetaData tm, String name)(Code)
Log a transaction savepoint removal.
Parameters:
  tm - The transaction marker metadata
Parameters:
  name - The name of the savepoint to log the identifier of the entry in the recovery log



logRequestCompletion
public void logRequestCompletion(long logId, boolean success, long execTime)(Code)
Update the completion status of a request completion in the recovery log given its id.
Parameters:
  logId - recovery log id for this request as it was originally logged
Parameters:
  success - true if the request execution was successful
Parameters:
  execTime - request execution time in ms



logRequestCompletion
public void logRequestCompletion(long logId, boolean success, long execTimeInMs, int updateCount)(Code)
Update the completion status of a request completion in the recovery log given its id.
Parameters:
  logId - recovery log id for this request as it was originally logged
Parameters:
  success - true if the request execution was successful
Parameters:
  execTimeInMs - request execution time in ms
Parameters:
  updateCount - request update count when successful



logRequestExecuteUpdateCompletion
public void logRequestExecuteUpdateCompletion(long logId, boolean success, int updateCount, long execTime)(Code)
Update the completion status of a request executed with executeUpdate().
Parameters:
  logId - recovery log id for this request as it was originally logged
Parameters:
  success - true if the request execution was successful
Parameters:
  updateCount - the number of updated rows returned by executeUpdate()(meaningful only if success)
Parameters:
  execTime - request execution time in ms



logRequestExecuting
public long logRequestExecuting(AbstractRequest request)(Code)
Log a request (read or write) that is going to execute and set the logId on the request object.
Parameters:
  request - The request to log (read or write) the identifier of the entry in the recovery log



logRollback
public long logRollback(TransactionMetaData tm)(Code)
Log a transaction rollback.
Parameters:
  tm - The transaction marker metadata the identifier of the entry in the recovery log



logRollbackToSavepoint
public long logRollbackToSavepoint(TransactionMetaData tm, String savepointName)(Code)
Log a transaction rollback to a savepoint
Parameters:
  tm - The transaxtion marker metadata
Parameters:
  savepointName - The name of the savepoint the identifier of the entry in the recovery log



logSetSavepoint
public long logSetSavepoint(TransactionMetaData tm, String name)(Code)
Log a transaction savepoint.
Parameters:
  tm - The transaction marker metadata
Parameters:
  name - The name of the savepoint to log the identifier of the entry in the recovery log



moveEntries
public void moveEntries(long fromId, long shift)(Code)
Shift the log entries from the given checkpoint id by the shift factor provided. All entries with an id below nowCheckpointId and all the others will have their id increased by shift.
Parameters:
  fromId - id where to start the move
Parameters:
  shift - increment to add to log entries id



recoverNextRequest
public RecoveryTask recoverNextRequest(long previousRequestId, AbstractScheduler scheduler) throws SQLException(Code)
Get the next request (begin/commit/rollback or WriteRequest) from the recovery log given the id of the previously recovered request.

The id of the request before the first one to recover is given by getCheckpointRequestId.
Parameters:
  previousRequestId - id of the previously recovered request
Parameters:
  scheduler - Scheduler that will be used to generate fake TransactionIdwhen recovering requests in autocommit mode AbstractTask task corresponding to the next request to recover ornull if no such request exists
exception:
  SQLException - if an error occurs
See Also:   RecoveryLog.getCheckpointLogId(String)




removeCheckpoint
public void removeCheckpoint(String checkpointName)(Code)
Remove a checkpoint from the recovery. This is useful for recovery maintenance
Parameters:
  checkpointName - to remove



removeDump
public void removeDump(DumpInfo dumpInfo) throws SQLException(Code)
Remove a dump information from the dump table base.
Parameters:
  dumpInfo - the DumpInfo to remove
throws:
  SQLException - if the dump has has not been removed from the dumptable



resetLogTableIdAndDeleteRecoveryLog
public void resetLogTableIdAndDeleteRecoveryLog(String checkpointName, long newCheckpointId) throws SQLException(Code)
Reset the current log table id and delete the recovery log information older than the given checkpoint. This method also deletes all entries in the checkpoint table. This method is asynchronous: the delete is performed via a post to the logger thread.
Parameters:
  checkpointName - the checkpoint name to delete from.
Parameters:
  newCheckpointId - the new checkpoint identifier
throws:
  SQLException - if an error occurs



resetRecoveryLog
public void resetRecoveryLog(boolean resetLogId) throws SQLException(Code)
Reset the recovery log by deleting the log table and checkpoint table. This method also clears checkpoint names in the dump table. This method should only be used to re-initialize the virtual database at initial startup or after a complete cluster outage.
Parameters:
  resetLogId - True if the logId has to be reset. This is used only with"initialize force" command.
throws:
  SQLException - if a database access error occurs



scheduleCloserTask
void scheduleCloserTask()(Code)



setAutoCloseTimeout
public void setAutoCloseTimeout(int seconds)(Code)
used by vdb.xml parser (element Recoverylog) to enable and set optional autoclosing mechanism. Default value is 0 (no auto-close).



setBackendTableCreateStatement
public void setBackendTableCreateStatement(String createTable, String tableName, String checkpointNameType, String backendNameType, String backendStateType, String databaseNameType, String extraStatement)(Code)
Sets the backend table create statement
Parameters:
  createTable - statement to create the table
Parameters:
  tableName - the backend table name
Parameters:
  checkpointNameType - type for the checkpointName column
Parameters:
  backendNameType - type for the backendName column
Parameters:
  backendStateType - type for the backendState column
Parameters:
  databaseNameType - type for the databaseName column
Parameters:
  extraStatement - like primary keys



setCheckConnectionValidity
public void setCheckConnectionValidity()(Code)



setCheckpointTableCreateStatement
public void setCheckpointTableCreateStatement(String createTable, String tableName, String nameType, String logIdType, String extraStatement)(Code)
Sets the checkpoint table name and create statement.
Parameters:
  createTable - statement to create the table
Parameters:
  tableName - name of the checkpoint table.
Parameters:
  nameType - type for the name column
Parameters:
  logIdType - type for the log_id column
Parameters:
  extraStatement - like primary keys



setDumpInfo
public void setDumpInfo(DumpInfo dumpInfo) throws VirtualDatabaseException(Code)
Set DumpInfo, thereby making a new dump available for restore.
Parameters:
  dumpInfo - the dump info to create.
throws:
  VirtualDatabaseException - if an error occurs



setDumpTableCreateStatement
public void setDumpTableCreateStatement(String createTable, String tableName, String dumpNameColumnType, String dumpDateColumnType, String dumpPathColumnType, String dumpFormatColumnType, String checkpointNameColumnType, String backendNameColumnType, String tablesColumnName, String tablesColumnType, String extraStatement)(Code)
Sets the dump table name and create statement.
Parameters:
  createTable - statement to create the table
Parameters:
  tableName - name of the checkpoint table.
Parameters:
  dumpNameColumnType - the dump name column type
Parameters:
  dumpDateColumnType - the dump data column type
Parameters:
  dumpPathColumnType - the dump path column type
Parameters:
  dumpFormatColumnType - the dump tpe column type
Parameters:
  checkpointNameColumnType - the checkpoint name column type
Parameters:
  backendNameColumnType - the backend name column type
Parameters:
  tablesColumnName - the database tables column name
Parameters:
  tablesColumnType - the database tables column type
Parameters:
  extraStatement - like primary keys



setLastManDown
public void setLastManDown() throws SQLException(Code)



setLogTableCreateStatement
public void setLogTableCreateStatement(String createTable, String tableName, String idType, String vloginType, String sqlName, String sqlType, String sqlParamsType, String autoConnTranColumnType, String transactionIdType, String requestIdType, String execTimeType, String updateCountType, String extraStatement)(Code)
Sets the log table name and create statement.
Parameters:
  createTable - statement to create the table
Parameters:
  tableName - name of the log table
Parameters:
  idType - type of the id column
Parameters:
  vloginType - type of the login column
Parameters:
  sqlName - name of the sql statement column
Parameters:
  sqlType - type of the sql column
Parameters:
  sqlParamsType - type of the sql_param column
Parameters:
  autoConnTranColumnType - type of the auto_conn_tran column
Parameters:
  transactionIdType - type of the transaction column
Parameters:
  extraStatement - extra statement like primary keys ...
Parameters:
  requestIdType - request id column type
Parameters:
  execTimeType - execution time in ms column type
Parameters:
  updateCountType - update count column type



shutdown
public void shutdown()(Code)
Shutdown the recovery log and all its threads by enqueueing a log shutdown event and waiting until it is processed.



storeBackendRecoveryInfo
public void storeBackendRecoveryInfo(String databaseName, BackendRecoveryInfo backendRecoveryInfo) throws SQLException(Code)
Store the state of the backend in the recovery log
Parameters:
  databaseName - the virtual database name
Parameters:
  backendRecoveryInfo - the backend recovery information to store
throws:
  SQLException - if cannot proceed



storeCheckpoint
public void storeCheckpoint(String checkpointName) throws SQLException(Code)
Store a Checkpoint using the current log state.
Parameters:
  checkpointName - Name of the checkpoint
exception:
  SQLException - if an error occurs



storeCheckpoint
public void storeCheckpoint(String checkpointName, long logId) throws SQLException(Code)
Store a Checkpoint with the given log id.
Parameters:
  checkpointName - Name of the checkpoint
Parameters:
  logId - log id this checkpoint points to
exception:
  SQLException - if an error occurs



storeDump
public void storeDump(DumpInfo dump) throws SQLException(Code)
Store the given dump information in the dump table
Parameters:
  dump - the DumpInfo to store
throws:
  SQLException - if a recovery log database access error occurs



storeDumpCheckpointName
public void storeDumpCheckpointName(String dumpCheckpointName, long checkpointId)(Code)

See Also:   StoreCheckpointWithLogIdEvent
Parameters:
  dumpCheckpointName - name of the checkpoint to store
Parameters:
  checkpointId - id of the checkpoint



updateDumpCheckpoint
public void updateDumpCheckpoint(String dumpName, String checkpointName) throws SQLException(Code)
Update the checkpoint name for specified dump, making it available for restore operations.
Parameters:
  dumpName - the dump name
Parameters:
  checkpointName - the new chekpoint to set
throws:
  SQLException - if a recovery log database access error occurs



updateDumpPath
public void updateDumpPath(String dumpName, String newPath) throws SQLException(Code)
Update the path name for a given checkpoint.
Parameters:
  dumpName - the dump name
Parameters:
  newPath - the new path to set
throws:
  SQLException - if a recovery log database access error occurs



updateDumpTableColumn
void updateDumpTableColumn(String dumpName, String columnName, String value) throws SQLException(Code)
Updates specified DumpTable entry column with specified value.
Parameters:
  dumpName - the name of the dump record to update
Parameters:
  columnName - the name of the column to update
Parameters:
  value - the value to set
throws:
  SQLException - if any error occurs (invalid dump name, sql querysyntax errors, hsqldb access errors, ...)



Methods inherited from java.lang.Object
native protected Object clone() throws CloneNotSupportedException(Code)(Java Doc)
public boolean equals(Object obj)(Code)(Java Doc)
protected void finalize() throws Throwable(Code)(Java Doc)
final native public Class getClass()(Code)(Java Doc)
native public int hashCode()(Code)(Java Doc)
final native public void notify()(Code)(Java Doc)
final native public void notifyAll()(Code)(Java Doc)
public String toString()(Code)(Java Doc)
final native public void wait(long timeout) throws InterruptedException(Code)(Java Doc)
final public void wait(long timeout, int nanos) throws InterruptedException(Code)(Java Doc)
final public void wait() throws InterruptedException(Code)(Java Doc)

www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.