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

Minor refactoring to remove compile warnings and possibly fix the
Solaris test failures.
parent 11fc097e
......@@ -6412,7 +6412,7 @@ const int Table_map_log_event::calc_field_metadata_size()
case MYSQL_TYPE_VARCHAR:
case MYSQL_TYPE_SET:
{
size= size + sizeof(short int); // Store short int here.
size= size + 2; // Store short int here.
break;
}
default:
......@@ -6515,7 +6515,7 @@ int Table_map_log_event::save_field_metadata()
{
char *ptr= (char *)&m_field_metadata[index];
int2store(ptr, m_table->s->field[i]->field_length);
index= index + sizeof(short int);
index= index + 2;
break;
}
case MYSQL_TYPE_STRING:
......@@ -6709,6 +6709,7 @@ Table_map_log_event::Table_map_log_event(const char *buf, uint event_len,
if (bytes_read < event_len)
{
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;
m_meta_memory= (uchar *)my_multi_malloc(MYF(MY_WME),
&m_null_bits, num_null_bytes,
......@@ -6934,8 +6935,7 @@ bool Table_map_log_event::write_data_body(IO_CACHE *file)
Store the size of the field metadata.
*/
uchar mbuf[sizeof(m_field_metadata_size)];
uchar *const mbuf_end= net_store_length(mbuf,
(size_t) m_field_metadata_size);
uchar *const mbuf_end= net_store_length(mbuf, m_field_metadata_size);
return (my_b_safe_write(file, dbuf, sizeof(dbuf)) ||
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)
{
uint from_len= (m_field_metadata[col] >> 8U) & 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);
break;
}
......@@ -121,7 +121,6 @@ uint32 table_def::calc_field_size(uint col, uchar *master_data)
default:
length= -1;
}
DBUG_ASSERT(length >= 0);
return length;
}
......
......@@ -123,7 +123,7 @@ public:
*/
char *ptr= (char *)&field_metadata[index];
m_field_metadata[i]= sint2korr(ptr);
index= index + sizeof(short int);
index= index + 2;
break;
}
case MYSQL_TYPE_NEWDECIMAL:
......@@ -238,7 +238,7 @@ public:
private:
ulong m_size; // Number of elements in the types array
field_type *m_type; // Array of type descriptors
short int *m_field_metadata;
uint16 *m_field_metadata;
uchar *m_null_bits;
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