~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to server/log_event.cc

  • Committer: Brian Aker
  • Date: 2008-07-23 00:11:39 UTC
  • Revision ID: brian@tangent.org-20080723001139-967ewfngqqotwb6e
Removed final uint dead types.

Show diffs side-by-side

added added

removed removed

Lines of Context:
413
413
*/
414
414
 
415
415
static inline int read_str(const char **buf, const char *buf_end,
416
 
                           const char **str, uint8 *len)
 
416
                           const char **str, uint8_t *len)
417
417
{
418
418
  if (*buf + ((uint) (uchar) **buf) >= buf_end)
419
419
    return 1;
420
 
  *len= (uint8) **buf;
 
420
  *len= (uint8_t) **buf;
421
421
  *str= (*buf)+1;
422
422
  (*buf)+= (uint) *len+1;
423
423
  return 0;
549
549
*/
550
550
 
551
551
#ifndef MYSQL_CLIENT
552
 
Log_event::Log_event(THD* thd_arg, uint16 flags_arg, bool using_trans)
 
552
Log_event::Log_event(THD* thd_arg, uint16_t flags_arg, bool using_trans)
553
553
  :log_pos(0), temp_buf(0), exec_time(0), flags(flags_arg), thd(thd_arg)
554
554
{
555
555
  server_id=    thd->server_id;
1771
1771
{
1772
1772
  ulong data_len;
1773
1773
  uint32_t tmp;
1774
 
  uint8 common_header_len, post_header_len;
 
1774
  uint8_t common_header_len, post_header_len;
1775
1775
  Log_event::Byte *start;
1776
1776
  const Log_event::Byte *end;
1777
1777
  bool catalog_nz= 1;
2650
2650
*/
2651
2651
 
2652
2652
Format_description_log_event::
2653
 
Format_description_log_event(uint8 binlog_ver, const char* server_ver)
 
2653
Format_description_log_event(uint8_t binlog_ver, const char* server_ver)
2654
2654
  :Start_log_event_v3(), event_type_permutation(0)
2655
2655
{
2656
2656
  binlog_version= binlog_ver;
2660
2660
    common_header_len= LOG_EVENT_HEADER_LEN;
2661
2661
    number_of_event_types= LOG_EVENT_TYPES;
2662
2662
    /* we'll catch my_malloc() error in is_valid() */
2663
 
    post_header_len=(uint8*) my_malloc(number_of_event_types*sizeof(uint8),
 
2663
    post_header_len=(uint8_t*) my_malloc(number_of_event_types*sizeof(uint8_t),
2664
2664
                                       MYF(MY_ZEROFILL));
2665
2665
    /*
2666
2666
      This long list of assignments is not beautiful, but I see no way to
2710
2710
      make the slave detect less corruptions).
2711
2711
    */
2712
2712
    number_of_event_types= FORMAT_DESCRIPTION_EVENT - 1;
2713
 
    post_header_len=(uint8*) my_malloc(number_of_event_types*sizeof(uint8),
 
2713
    post_header_len=(uint8_t*) my_malloc(number_of_event_types*sizeof(uint8_t),
2714
2714
                                       MYF(0));
2715
2715
    if (post_header_len)
2716
2716
    {
2770
2770
  number_of_event_types=
2771
2771
    event_len-(LOG_EVENT_MINIMAL_HEADER_LEN+ST_COMMON_HEADER_LEN_OFFSET+1);
2772
2772
  /* If alloc fails, we'll detect it in is_valid() */
2773
 
  post_header_len= (uint8*) my_memdup((uchar*)buf+ST_COMMON_HEADER_LEN_OFFSET+1,
 
2773
  post_header_len= (uint8_t*) my_memdup((uchar*)buf+ST_COMMON_HEADER_LEN_OFFSET+1,
2774
2774
                                      number_of_event_types*
2775
2775
                                      sizeof(*post_header_len), MYF(0));
2776
2776
  calc_server_version_split();
2849
2849
      post_header_len= NULL;
2850
2850
      return;
2851
2851
    }
2852
 
    static const uint8 perm[23]=
 
2852
    static const uint8_t perm[23]=
2853
2853
      {
2854
2854
        UNKNOWN_EVENT, START_EVENT_V3, QUERY_EVENT, STOP_EVENT, ROTATE_EVENT,
2855
2855
        INTVAR_EVENT, LOAD_EVENT, SLAVE_EVENT, CREATE_FILE_EVENT,
2870
2870
      Since we use (permuted) event id's to index the post_header_len
2871
2871
      array, we need to permute the post_header_len array too.
2872
2872
    */
2873
 
    uint8 post_header_len_temp[23];
 
2873
    uint8_t post_header_len_temp[23];
2874
2874
    for (int i= 1; i < 23; i++)
2875
2875
      post_header_len_temp[perm[i] - 1]= post_header_len[i - 1];
2876
2876
    for (int i= 0; i < 22; i++)
3215
3215
  table_name_len = (uint32_t) strlen(table_name);
3216
3216
  fname_len = (fname) ? (uint) strlen(fname) : 0;
3217
3217
  sql_ex.field_term = (char*) ex->field_term->ptr();
3218
 
  sql_ex.field_term_len = (uint8) ex->field_term->length();
 
3218
  sql_ex.field_term_len = (uint8_t) ex->field_term->length();
3219
3219
  sql_ex.enclosed = (char*) ex->enclosed->ptr();
3220
 
  sql_ex.enclosed_len = (uint8) ex->enclosed->length();
 
3220
  sql_ex.enclosed_len = (uint8_t) ex->enclosed->length();
3221
3221
  sql_ex.line_term = (char*) ex->line_term->ptr();
3222
 
  sql_ex.line_term_len = (uint8) ex->line_term->length();
 
3222
  sql_ex.line_term_len = (uint8_t) ex->line_term->length();
3223
3223
  sql_ex.line_start = (char*) ex->line_start->ptr();
3224
 
  sql_ex.line_start_len = (uint8) ex->line_start->length();
 
3224
  sql_ex.line_start_len = (uint8_t) ex->line_start->length();
3225
3225
  sql_ex.escaped = (char*) ex->escaped->ptr();
3226
 
  sql_ex.escaped_len = (uint8) ex->escaped->length();
 
3226
  sql_ex.escaped_len = (uint8_t) ex->escaped->length();
3227
3227
  sql_ex.opt_flags = 0;
3228
3228
  sql_ex.cached_new_format = -1;
3229
3229
    
3843
3843
  :Log_event(buf, description_event) ,new_log_ident(0), flags(DUP_NAME)
3844
3844
{
3845
3845
  // The caller will ensure that event_len is what we have at EVENT_LEN_OFFSET
3846
 
  uint8 header_size= description_event->common_header_len;
3847
 
  uint8 post_header_len= description_event->post_header_len[ROTATE_EVENT-1];
 
3846
  uint8_t header_size= description_event->common_header_len;
 
3847
  uint8_t post_header_len= description_event->post_header_len[ROTATE_EVENT-1];
3848
3848
  uint ident_offset;
3849
3849
  if (event_len < header_size)
3850
3850
    return;
4964
4964
{
4965
4965
  uint block_offset;
4966
4966
  uint header_len= description_event->common_header_len;
4967
 
  uint8 load_header_len= description_event->post_header_len[LOAD_EVENT-1];
4968
 
  uint8 create_file_header_len= description_event->post_header_len[CREATE_FILE_EVENT-1];
 
4967
  uint8_t load_header_len= description_event->post_header_len[LOAD_EVENT-1];
 
4968
  uint8_t create_file_header_len= description_event->post_header_len[CREATE_FILE_EVENT-1];
4969
4969
  if (!(event_buf= (char*) my_memdup(buf, len, MYF(MY_WME))) ||
4970
4970
      copy_log_event(event_buf,len,
4971
4971
                     ((buf[EVENT_TYPE_OFFSET] == LOAD_EVENT) ?
5172
5172
                                               const Format_description_log_event* description_event)
5173
5173
  :Log_event(buf, description_event),block(0)
5174
5174
{
5175
 
  uint8 common_header_len= description_event->common_header_len; 
5176
 
  uint8 append_block_header_len=
 
5175
  uint8_t common_header_len= description_event->common_header_len; 
 
5176
  uint8_t append_block_header_len=
5177
5177
    description_event->post_header_len[APPEND_BLOCK_EVENT-1];
5178
5178
  uint total_header_len= common_header_len+append_block_header_len;
5179
5179
  if (len < total_header_len)
5320
5320
                                             const Format_description_log_event* description_event)
5321
5321
  :Log_event(buf, description_event),file_id(0)
5322
5322
{
5323
 
  uint8 common_header_len= description_event->common_header_len;
5324
 
  uint8 delete_file_header_len= description_event->post_header_len[DELETE_FILE_EVENT-1];
 
5323
  uint8_t common_header_len= description_event->common_header_len;
 
5324
  uint8_t delete_file_header_len= description_event->post_header_len[DELETE_FILE_EVENT-1];
5325
5325
  if (len < (uint)(common_header_len + delete_file_header_len))
5326
5326
    return;
5327
5327
  file_id= uint4korr(buf + common_header_len + DF_FILE_ID_OFFSET);
5417
5417
                                               const Format_description_log_event* description_event)
5418
5418
  :Log_event(buf, description_event), file_id(0)
5419
5419
{
5420
 
  uint8 common_header_len= description_event->common_header_len;
5421
 
  uint8 exec_load_header_len= description_event->post_header_len[EXEC_LOAD_EVENT-1];
 
5420
  uint8_t common_header_len= description_event->common_header_len;
 
5421
  uint8_t exec_load_header_len= description_event->post_header_len[EXEC_LOAD_EVENT-1];
5422
5422
  if (len < (uint)(common_header_len+exec_load_header_len))
5423
5423
    return;
5424
5424
  file_id= uint4korr(buf + common_header_len + EL_FILE_ID_OFFSET);
5952
5952
    , m_curr_row(NULL), m_curr_row_end(NULL), m_key(NULL)
5953
5953
#endif
5954
5954
{
5955
 
  uint8 const common_header_len= description_event->common_header_len;
5956
 
  uint8 const post_header_len= description_event->post_header_len[event_type-1];
 
5955
  uint8_t const common_header_len= description_event->common_header_len;
 
5956
  uint8_t const post_header_len= description_event->post_header_len[event_type-1];
5957
5957
 
5958
5958
  const char *post_start= buf + common_header_len;
5959
5959
  post_start+= RW_MAPID_OFFSET;
6723
6723
  (e.g. values > 255), the endian-safe methods are used to properly encode 
6724
6724
  the values on the master and decode them on the slave. When the field
6725
6725
  metadata values are captured on the slave, they are stored in an array of
6726
 
  type uint16. This allows the least number of casts to prevent casting bugs
 
6726
  type uint16_t. This allows the least number of casts to prevent casting bugs
6727
6727
  when the field metadata is used in comparisons of field attributes. When
6728
6728
  the field metadata is used for calculating addresses in pointer math, the
6729
6729
  type used is uint32_t. 
6771
6771
#if !defined(MYSQL_CLIENT)
6772
6772
Table_map_log_event::Table_map_log_event(THD *thd, TABLE *tbl, ulong tid,
6773
6773
                                         bool is_transactional __attribute__((__unused__)),
6774
 
                                         uint16 flags)
 
6774
                                         uint16_t flags)
6775
6775
  : Log_event(thd, 0, true),
6776
6776
    m_table(tbl),
6777
6777
    m_dbnam(tbl->s->db.str),
6871
6871
{
6872
6872
  unsigned int bytes_read= 0;
6873
6873
 
6874
 
  uint8 common_header_len= description_event->common_header_len;
6875
 
  uint8 post_header_len= description_event->post_header_len[TABLE_MAP_EVENT-1];
 
6874
  uint8_t common_header_len= description_event->common_header_len;
 
6875
  uint8_t post_header_len= description_event->post_header_len[TABLE_MAP_EVENT-1];
6876
6876
 
6877
6877
  /* Read the post-header */
6878
6878
  const char *post_start= buf + common_header_len;
8122
8122
                                       const Format_description_log_event *descr_event)
8123
8123
  : Log_event(buf, descr_event)
8124
8124
{
8125
 
  uint8 const common_header_len=
 
8125
  uint8_t const common_header_len=
8126
8126
    descr_event->common_header_len;
8127
 
  uint8 const post_header_len=
 
8127
  uint8_t const post_header_len=
8128
8128
    descr_event->post_header_len[INCIDENT_EVENT-1];
8129
8129
 
8130
8130
  m_incident= static_cast<Incident>(uint2korr(buf + common_header_len));
8131
8131
  char const *ptr= buf + common_header_len + post_header_len;
8132
8132
  char const *const str_end= buf + event_len;
8133
 
  uint8 len= 0;                   // Assignment to keep compiler happy
 
8133
  uint8_t len= 0;                   // Assignment to keep compiler happy
8134
8134
  const char *str= NULL;          // Assignment to keep compiler happy
8135
8135
  read_str(&ptr, str_end, &str, &len);
8136
8136
  m_message.str= const_cast<char*>(str);
8204
8204
bool
8205
8205
Incident_log_event::write_data_header(IO_CACHE *file)
8206
8206
{
8207
 
  uchar buf[sizeof(int16)];
8208
 
  int2store(buf, (int16) m_incident);
 
8207
  uchar buf[sizeof(int16_t)];
 
8208
  int2store(buf, (int16_t) m_incident);
8209
8209
  return(my_b_safe_write(file, buf, sizeof(buf)));
8210
8210
}
8211
8211
 
8220
8220
                    const Format_description_log_event* description_event)
8221
8221
  :Log_event(buf, description_event)
8222
8222
{
8223
 
  uint8 header_size= description_event->common_header_len;
 
8223
  uint8_t header_size= description_event->common_header_len;
8224
8224
  ident_len = event_len - header_size;
8225
8225
  set_if_smaller(ident_len,FN_REFLEN-1);
8226
8226
  log_ident= buf + header_size;