Setting Log File Types and Parameters in Python

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 call of method exdb.open_database(). For example:

     
    // Set log file type
    db = exdb.open_database(..., db_log_type = 'UNDO_LOG';
     

Commit Policy

As explained in the Persistent Database I/O page, eXtremeDB offers four distinct commit policy options for log types REDO_LOG and UNDO_LOG. The commit policy and parameters are set in a log_params structure that is then used as a parameter passed to exdb.open_database(). The commit policy is set in DefaultCommitPolicy, and for the REDO_LOG type RedoLogLimit. Also, for policy Delayed, the DelayedCommitThreshold can be specified.

For example, the following code snippet demonstrates setting the log type, commit policy and parameters:

 
    log_params = exdb.LogParams( RedoLogLimit = 1L*1024*1024*1024,
                DefaultCommitPolicy = exdb.CommitPolicy.Delayed,
                DelayedCommitThreshold = hw_conf['CACHE_SIZE']*8/10)
    ...
     
    db = exdb.open_database(...,
                is_disk=true,
                db_log_type = ‘UNDO_LOG’,
                log_params = log_params,
                ...);