Commit 21c55af5 authored by unknown's avatar unknown

WL#3228 (NDB) : RBR using different table defs on slave/master

Minor refactoring to remove compile warnings and possibly fix the
Solaris test failures.


sql/log_event.cc:
  WL#3228 (NDB) : RBR using different table defs on slave/master
  
  Minor refactoring.
sql/rpl_utility.cc:
  WL#3228 (NDB) : RBR using different table defs on slave/master
  
  Minor refactoring.
sql/rpl_utility.h:
  WL#3228 (NDB) : RBR using different table defs on slave/master
  
  Minor refactoring.
parent d605bc56
...@@ -6412,7 +6412,7 @@ const int Table_map_log_event::calc_field_metadata_size() ...@@ -6412,7 +6412,7 @@ const int Table_map_log_event::calc_field_metadata_size()
case MYSQL_TYPE_VARCHAR: case MYSQL_TYPE_VARCHAR:
case MYSQL_TYPE_SET: case MYSQL_TYPE_SET:
{ {
size= size + sizeof(short int); // Store short int here. size= size + 2; // Store short int here.
break; break;
} }
default: default:
...@@ -6515,7 +6515,7 @@ int Table_map_log_event::save_field_metadata() ...@@ -6515,7 +6515,7 @@ int Table_map_log_event::save_field_metadata()
{ {
char *ptr= (char *)&m_field_metadata[index]; char *ptr= (char *)&m_field_metadata[index];
int2store(ptr, m_table->s->field[i]->field_length); int2store(ptr, m_table->s->field[i]->field_length);
index= index + sizeof(short int); index= index + 2;
break; break;
} }
case MYSQL_TYPE_STRING: case MYSQL_TYPE_STRING:
...@@ -6709,6 +6709,7 @@ Table_map_log_event::Table_map_log_event(const char *buf, uint event_len, ...@@ -6709,6 +6709,7 @@ Table_map_log_event::Table_map_log_event(const char *buf, uint event_len,
if (bytes_read < event_len) if (bytes_read < event_len)
{ {
m_field_metadata_size= net_field_length(&ptr_after_colcnt); m_field_metadata_size= net_field_length(&ptr_after_colcnt);
DBUG_ASSERT(m_field_metadata_size <= (m_colcnt * 2));
uint num_null_bytes= (m_colcnt + 7) / 8; uint num_null_bytes= (m_colcnt + 7) / 8;
m_meta_memory= (uchar *)my_multi_malloc(MYF(MY_WME), m_meta_memory= (uchar *)my_multi_malloc(MYF(MY_WME),
&m_null_bits, num_null_bytes, &m_null_bits, num_null_bytes,
...@@ -6934,8 +6935,7 @@ bool Table_map_log_event::write_data_body(IO_CACHE *file) ...@@ -6934,8 +6935,7 @@ bool Table_map_log_event::write_data_body(IO_CACHE *file)
Store the size of the field metadata. Store the size of the field metadata.
*/ */
uchar mbuf[sizeof(m_field_metadata_size)]; uchar mbuf[sizeof(m_field_metadata_size)];
uchar *const mbuf_end= net_store_length(mbuf, uchar *const mbuf_end= net_store_length(mbuf, m_field_metadata_size);
(size_t) m_field_metadata_size);
return (my_b_safe_write(file, dbuf, sizeof(dbuf)) || return (my_b_safe_write(file, dbuf, sizeof(dbuf)) ||
my_b_safe_write(file, (const uchar*)m_dbnam, m_dblen+1) || my_b_safe_write(file, (const uchar*)m_dbnam, m_dblen+1) ||
......
...@@ -97,7 +97,7 @@ uint32 table_def::calc_field_size(uint col, uchar *master_data) ...@@ -97,7 +97,7 @@ uint32 table_def::calc_field_size(uint col, uchar *master_data)
{ {
uint from_len= (m_field_metadata[col] >> 8U) & 0x00ff; uint from_len= (m_field_metadata[col] >> 8U) & 0x00ff;
uint from_bit_len= m_field_metadata[col] & 0x00ff; uint from_bit_len= m_field_metadata[col] & 0x00ff;
DBUG_ASSERT(from_len >= 0 && from_bit_len >= 0 && from_bit_len <= 7); DBUG_ASSERT(from_bit_len >= 0 && from_bit_len <= 7);
length= from_len + ((from_bit_len > 0) ? 1 : 0); length= from_len + ((from_bit_len > 0) ? 1 : 0);
break; break;
} }
...@@ -121,7 +121,6 @@ uint32 table_def::calc_field_size(uint col, uchar *master_data) ...@@ -121,7 +121,6 @@ uint32 table_def::calc_field_size(uint col, uchar *master_data)
default: default:
length= -1; length= -1;
} }
DBUG_ASSERT(length >= 0);
return length; return length;
} }
......
...@@ -123,7 +123,7 @@ class table_def ...@@ -123,7 +123,7 @@ class table_def
*/ */
char *ptr= (char *)&field_metadata[index]; char *ptr= (char *)&field_metadata[index];
m_field_metadata[i]= sint2korr(ptr); m_field_metadata[i]= sint2korr(ptr);
index= index + sizeof(short int); index= index + 2;
break; break;
} }
case MYSQL_TYPE_NEWDECIMAL: case MYSQL_TYPE_NEWDECIMAL:
...@@ -238,7 +238,7 @@ class table_def ...@@ -238,7 +238,7 @@ class table_def
private: private:
ulong m_size; // Number of elements in the types array ulong m_size; // Number of elements in the types array
field_type *m_type; // Array of type descriptors field_type *m_type; // Array of type descriptors
short int *m_field_metadata; uint16 *m_field_metadata;
uchar *m_null_bits; uchar *m_null_bits;
uchar *m_memory; uchar *m_memory;
}; };
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment