~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/message/transaction_writer.cc

  • Committer: Jay Pipes
  • Date: 2009-10-13 18:47:53 UTC
  • mto: (1234.1.1 push) (1237.2.10 push)
  • mto: This revision was merged to the branch mainline in revision 1193.
  • Revision ID: jpipes@serialcoder-20091013184753-aw5v6tfk8x5ynej9
This patch does the following:

1) The transaction log now writes a 4-byte header containing the type of 
   message which follows the header.  This allows us to future-proof the
   transaction log in order to allow BLOBs to be written in chunks to the
   log file along with GPB Transaction messages.

2) The algorithm which writes Transaction messages to the transaction log
   has been improved.  Instead of 3 separate calls to pwrite(), I have now
   reduced that to a single call to pwrite() and a raw buffer is used to 
   construct the raw bytes that get written in bulk to the transaction log
   at the atomic offset.

3) Update the transaction_reader and transaction_writer programs for the 
   above changes.

Show diffs side-by-side

added added

removed removed

Lines of Context:
24
24
#include <drizzled/global.h>
25
25
#include <drizzled/hash/crc32.h>
26
26
#include <drizzled/gettext.h>
 
27
#include <drizzled/replication_services.h>
27
28
#include <sys/types.h>
28
29
#include <sys/stat.h>
29
30
#include <fcntl.h>
286
287
 
287
288
  size_t length= buffer.length();
288
289
 
 
290
  output->WriteLittleEndian32(static_cast<uint32_t>(ReplicationServices::TRANSACTION));
289
291
  output->WriteLittleEndian32(static_cast<uint32_t>(length));
290
292
  output->WriteString(buffer);
291
293
  output->WriteLittleEndian32(drizzled::hash::crc32(buffer.c_str(), length)); /* checksum */