As explained in the persistent database recovery page the eXtremeDB runtime uses the transaction log file to perform recovery automatically in the case of a prior application crash. The Persistent Database I/O page explains the different log types and how to choose the appropriate type for different application profiles. The manner in which transactions are written to the log is determined by the transaction commit policy. The following sections explain how to set the log type and commit policy in C# applications.
Log type
The log type is specified in the
Database.Parameters.LogType. For example:Database.Parameters parameters = new Database.Parameters(); ... // Set log file type parameters.LogType = Database.LogType.UndoLog;Commit Policy
As explained in the Persistent Database I/O page, eXtremeDB offers four distinct commit policy options for log types
RedoLogandUndoLog. The commit policy is set in parameterDatabase.Parameters.DefaultCommitPolicybefore calling Database methodOpen().The
NoSuncpolicy causes all transactions to be held in the cache until the application explicitly forces the cache to be flushed to the media with the Connection methodDiskFlush().There are additional parameters to consider for the
RedoLoglog type. For theDelayedpolicy, the database disk manager keeps the transaction in memory until a specified percentage of the log file size is reached. The threshold valuesDatabase.Parameters.RedoLogLimit,Database.Parameters.DelayedCommitThresholdandDatabase.Parameters.MaxDelayedTransactionscan be specified in the parameters passed to Database methodOpen(). By default, the threshold is set to be a half of the available page pool size.For example, the following code snippet demonstrates setting the log type, commit policy and parameters:
Database.Parameters parameters = new Database.Parameters(); ... parameters.LogType = Database.LogType.RedoLog; parameters.DefaultCommitPolicy = Database.CommitPolicy.Delayed; parameters.MaxDelayedTransactions = 100; ... db.Open("operations-db", parameters, DATABASE_SIZE);