~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to plugin/transaction_log/transaction_log.cc

  • Committer: Jay Pipes
  • Date: 2010-04-08 16:27:25 UTC
  • mfrom: (1405.6.10 replication-pairs)
  • mto: This revision was merged to the branch mainline in revision 1457.
  • Revision ID: jpipes@serialcoder-20100408162725-sugbgn38oxjqclq2
Merge trunk and replication-pairs with conflict resolution

Show diffs side-by-side

added added

removed removed

Lines of Context:
37
37
 * offset into the log file for writing the next log entry.  The log
38
38
 * entries are written, one after the other, in the following way:
39
39
 *
 
40
 * <pre>
40
41
 * --------------------------------------
41
42
 * |<- 4 bytes ->|<- # Bytes of Entry ->|
42
43
 * --------------------------------------
43
44
 * |  Entry Type |  Serialized Entry    |
44
45
 * --------------------------------------
 
46
 * </pre>
45
47
 *
46
48
 * The Entry Type is an integer defined as an enumeration in the 
47
49
 * /drizzled/message/transaction.proto file called TransactionLogEntry::Type.
51
53
 *
52
54
 * Committed and Prepared Transaction Log Entries
53
55
 * -----------------------------------------------
54
 
 *
 
56
 * 
 
57
 * <pre>
55
58
 * ------------------------------------------------------------------
56
59
 * |<- 4 bytes ->|<- # Bytes of Transaction Message ->|<- 4 bytes ->|
57
60
 * ------------------------------------------------------------------
58
61
 * |   Length    |   Serialized Transaction Message   |   Checksum  |
59
62
 * ------------------------------------------------------------------
 
63
 * </pre>
60
64
 *
61
65
 * @todo
62
66
 *
80
84
#include <drizzled/errmsg_print.h>
81
85
#include <drizzled/gettext.h>
82
86
#include <drizzled/message/transaction.pb.h>
 
87
#include <drizzled/transaction_services.h>
83
88
#include <drizzled/algorithm/crc32.h>
84
89
 
85
90
#include <google/protobuf/io/coded_stream.h>
188
193
   */
189
194
  off_t cur_offset= log_offset.fetch_and_add(static_cast<off_t>(data_length));
190
195
 
191
 
  /*
192
 
   * We adjust cur_offset back to the original log_offset before
193
 
   * the increment above...
194
 
   */
195
 
  cur_offset-= static_cast<off_t>(data_length);
196
 
 
197
196
  /* 
198
197
   * Quick safety...if an error occurs above in another writer, the log 
199
198
   * file will be in a crashed state.
289
288
    result= ftruncate(log_file, log_offset);
290
289
  }
291
290
  while (result == -1 && errno == EINTR);
 
291
  drizzled::TransactionServices::singleton().resetTransactionId();
292
292
}
293
293
 
294
294
bool TransactionLog::findLogFilenameContainingTransactionId(const ReplicationServices::GlobalTransactionId&,