~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to plugin/transaction_log/transaction_log.h

Merge Joe, plus I updated the tests.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/* - mode: c; c-basic-offset: 2; indent-tabs-mode: nil; -*-
2
2
 *  vim:expandtab:shiftwidth=2:tabstop=2:smarttab:
3
3
 *
4
 
 *  Copyright (C) 2008-2009 Sun Microsystems, Inc.
5
 
 *  Copyright (C) 2010 Jay Pipes <jaypipes@gmail.com>
 
4
 *  Copyright (C) 2008-2009 Sun Microsystems
 
5
 *  Copyright (c) 2010 Jay Pipes <jaypipes@gmail.com>
6
6
 *
7
7
 *  Authors:
8
8
 *
61
61
    ONLINE,
62
62
    WRITING
63
63
  };
64
 
  static const uint32_t FLUSH_FREQUENCY_OS= 0; ///< Rely on operating system to sync log file
65
 
  static const uint32_t FLUSH_FREQUENCY_EVERY_WRITE= 1; //< Sync on every write to the log file
66
 
  static const uint32_t FLUSH_FREQUENCY_EVERY_SECOND= 2; ///< Sync no more than once a second
 
64
  static const uint32_t SYNC_METHOD_OS= 0; ///< Rely on operating system to sync log file
 
65
  static const uint32_t SYNC_METHOD_EVERY_WRITE= 1; //< Sync on every write to the log file
 
66
  static const uint32_t SYNC_METHOD_EVERY_SECOND= 2; ///< Sync no more than once a second
67
67
public:
68
68
  TransactionLog(const std::string in_log_file_path,
69
 
                 uint32_t in_flush_frequency,
 
69
                 uint32_t in_sync_method,
70
70
                 bool in_do_checksum);
71
71
 
72
72
  /** Destructor */
189
189
  void clearError();
190
190
  /**
191
191
   * Helper method which synchronizes/flushes the transaction log file
192
 
   * according to the transaction_log_flush_frequency system variable
 
192
   * according to the transaction_log_sync_method system variable
193
193
   *
194
194
   * @retval
195
195
   *   0 == Success
205
205
  drizzled::atomic<off_t> log_offset; ///< Offset in log file where log will write next command
206
206
  bool has_error; ///< Is the log in error?
207
207
  std::string error_message; ///< Current error message
208
 
  uint32_t flush_frequency; ///< Determines behaviour of syncing log file
209
 
  time_t last_sync_time; ///< Last time the log file was synced (only set in FLUSH_FREQUENCY_EVERY_SECOND)
 
208
  uint32_t sync_method; ///< Determines behaviour of syncing log file
 
209
  time_t last_sync_time; ///< Last time the log file was synced (only set in SYNC_METHOD_EVERY_SECOND)
210
210
  bool do_checksum; ///< Do a CRC32 checksum when writing Transaction message to log?
211
211
};
212
212