Drizzled Public API Documentation

transaction_log.cc File Reference

#include <config.h>
#include "transaction_log.h"
#include <sys/stat.h>
#include <fcntl.h>
#include <unistd.h>
#include <errno.h>
#include <vector>
#include <string>
#include <drizzled/internal/my_sys.h>
#include <drizzled/errmsg_print.h>
#include <drizzled/gettext.h>
#include <drizzled/message/transaction.pb.h>
#include <drizzled/transaction_services.h>
#include <drizzled/algorithm/crc32.h>
#include <google/protobuf/io/coded_stream.h>

Go to the source code of this file.

Variables

TransactionLogtransaction_log = NULL

Detailed Description

Defines the implementation of the transaction log file descriptor.

Currently, the transaction log file uses a simple, single-file, append-only format.

We have an atomic off_t called log_offset which keeps track of the offset into the log file for writing the next log entry. The log entries are written, one after the other, in the following way:

 --------------------------------------
 |<- 4 bytes ->|<- # Bytes of Entry ->|
 --------------------------------------
 |  Entry Type |  Serialized Entry    |
 --------------------------------------
 

The Entry Type is an integer defined as an enumeration in the /drizzled/message/transaction.proto file called TransactionLogEntry::Type.

Each transaction log entry type is written to the log differently. Here, we cover the format of each log entry type.

Committed and Prepared Transaction Log Entries -----------------------------------------------

 ------------------------------------------------------------------
 |<- 4 bytes ->|<- # Bytes of Transaction Message ->|<- 4 bytes ->|
 ------------------------------------------------------------------
 |   Length    |   Serialized Transaction Message   |   Checksum  |
 ------------------------------------------------------------------
 
Todo:

Possibly look at a scoreboard approach with multiple file segments. For right now, though, this is just a quick simple implementation to serve as a skeleton and a springboard.

Definition in file transaction_log.cc.


Variable Documentation

Defined in transaction_log.cc

Definition at line 96 of file transaction_log.cc.