Below is the list of changes that have just been committed into a local
5.1 repository of mats. When mats does a push these changes will
be propagated to the main repository and, within 24 hours after the
push, to the public repository.
For information on how to access the public repository
see http://dev.mysql.com/doc/mysql/en/installing-source-tree.html
ChangeSet@stripped, 2007-10-09 16:08:00+02:00, mats@stripped +3 -0
BUG#29549 (Endians: rpl_ndb_myisam2ndb,rpl_ndb_innodb2ndb and rpl_ndb_mix_innodb
failed on):
Adding Field::max_data_length() to give the maximum number of bytes that
Field::pack() will write.
sql/field.cc@stripped, 2007-10-09 16:07:55+02:00, mats@stripped +16 -12
Adding max_data_length() to denote the maximum number of bytes that
pack() will write.
Adding casts to remove warnings for debug printouts.
sql/field.h@stripped, 2007-10-09 16:07:56+02:00, mats@stripped +14 -1
Adding max_data_length() to denote the maximum number of bytes that
pack() will write.
sql/rpl_record.cc@stripped, 2007-10-09 16:07:56+02:00, mats@stripped +12
-6
Using max_data_length() when packing field into row.
Adding casts to debug printouts.
diff -Nrup a/sql/field.cc b/sql/field.cc
--- a/sql/field.cc 2007-10-05 18:16:00 +02:00
+++ b/sql/field.cc 2007-10-09 16:07:55 +02:00
@@ -1462,16 +1462,18 @@ Field::unpack(uchar* to, const uchar *fr
from_type= (param_data & 0xff00) >> 8U; // real_type.
param_data= param_data & 0x00ff; // length.
}
- uint len= (param_data && (param_data < length)) ?
- param_data : length;
- if ((length == param_data) ||
- (param_data == 0) ||
+ if ((param_data == 0) ||
+ (length == param_data) ||
(from_type != real_type()))
{
memcpy(to, from, length);
return from+length;
}
+
+ uint len= (param_data && (param_data < length)) ?
+ param_data : length;
+
memcpy(to, from, param_data > length ? length : len);
return from+len;
}
@@ -2778,14 +2780,10 @@ const uchar *
Field_new_decimal::unpack(uchar* to,
const uchar *from,
uint param_data,
- bool low_byte_first __attribute__((unused)))
+ bool low_byte_first)
{
if (param_data == 0)
- {
- uint const length= pack_length();
- memcpy(to, from, pack_length());
- return from + length;
- }
+ return Field::unpack(to, from, param_data, low_byte_first);
uint from_precision= (param_data & 0xff00) >> 8U;
uint from_decimal= param_data & 0x00ff;
@@ -6323,6 +6321,11 @@ int Field_longstr::store_decimal(const m
return store(str.ptr(), str.length(), str.charset());
}
+uint32 Field_longstr::max_data_length() const
+{
+ return field_length + (field_length > 255 ? 2 : 1);
+}
+
double Field_string::val_real(void)
{
@@ -7718,7 +7721,8 @@ uchar *Field_blob::pack(uchar *to, const
DBUG_ENTER("Field_blob::pack");
DBUG_PRINT("enter", ("to: 0x%lx; from: 0x%lx;"
" max_length: %u; low_byte_first: %d",
- to, from, max_length, low_byte_first));
+ (ulong) to, (ulong) from,
+ max_length, low_byte_first));
DBUG_DUMP("record", from, table->s->reclength);
uchar *save= ptr;
ptr= (uchar*) from;
@@ -7767,7 +7771,7 @@ const uchar *Field_blob::unpack(uchar *t
DBUG_ENTER("Field_blob::unpack");
DBUG_PRINT("enter", ("to: 0x%lx; from: 0x%lx;"
" param_data: %u; low_byte_first: %d",
- to, from, param_data, low_byte_first));
+ (ulong) to, (ulong) from, param_data, low_byte_first));
uint const master_packlength=
param_data > 0 ? param_data & 0xFF : packlength;
uint32 const length= get_length(from, master_packlength, low_byte_first);
diff -Nrup a/sql/field.h b/sql/field.h
--- a/sql/field.h 2007-10-05 18:16:00 +02:00
+++ b/sql/field.h 2007-10-09 16:07:56 +02:00
@@ -157,6 +157,17 @@ public:
*/
virtual uint32 data_length() { return pack_length(); }
virtual uint32 sort_length() const { return pack_length(); }
+
+ /**
+ Get the maximum size of the data in packed format.
+
+ @return Maximum data length of the field when packed using the
+ Field::pack() function.
+ */
+ virtual uint32 max_data_length() const {
+ return pack_length();
+ };
+
virtual int reset(void) { bzero(ptr,pack_length()); return 0; }
virtual void reset_fields() {}
virtual void set_default()
@@ -549,6 +560,7 @@ public:
{}
int store_decimal(const my_decimal *d);
+ uint32 max_data_length() const;
};
/* base class for float and double and decimal (old one) */
@@ -1520,7 +1532,7 @@ public:
uint32 pack_length_no_ptr() const
{ return (uint32) (packlength); }
uint32 sort_length() const;
- inline uint32 max_data_length() const
+ virtual uint32 max_data_length() const
{
return (uint32) (((ulonglong) 1 << (packlength*8)) -1);
}
@@ -1749,6 +1761,7 @@ public:
enum_field_types type() const { return MYSQL_TYPE_BIT; }
enum ha_base_keytype key_type() const { return HA_KEYTYPE_BIT; }
uint32 key_length() const { return (uint32) (field_length + 7) / 8; }
+ uint32 max_data_length() const { return (field_length + 7) / 8; }
uint32 max_display_length() { return field_length; }
uint size_of() const { return sizeof(*this); }
Item_result result_type () const { return INT_RESULT; }
diff -Nrup a/sql/rpl_record.cc b/sql/rpl_record.cc
--- a/sql/rpl_record.cc 2007-10-05 18:16:01 +02:00
+++ b/sql/rpl_record.cc 2007-10-09 16:07:56 +02:00
@@ -100,9 +100,12 @@ pack_row(TABLE *table, MY_BITMAP const*
format used for the binlog.
*/
const uchar *old_pack_ptr= pack_ptr;
- pack_ptr= field->pack(pack_ptr, field->ptr + offset, UINT_MAX, TRUE);
- DBUG_PRINT("debug", ("field: %s; pack_ptr: 0x%lx; pack_ptr':0x%lx; bytes: %d",
- field->field_name, old_pack_ptr, pack_ptr, pack_ptr -
old_pack_ptr));
+ pack_ptr= field->pack(pack_ptr, field->ptr + offset,
+ field->max_data_length(), TRUE);
+ DBUG_PRINT("debug", ("field: %s; pack_ptr: 0x%lx;"
+ " pack_ptr':0x%lx; bytes: %d",
+ field->field_name, (ulong) old_pack_ptr,
+ (ulong) pack_ptr, pack_ptr - old_pack_ptr));
}
null_mask <<= 1;
@@ -232,8 +235,11 @@ unpack_row(RELAY_LOG_INFO const *rli,
uint16 const metadata= tabledef->field_metadata(i);
uchar const *const old_pack_ptr= pack_ptr;
pack_ptr= f->unpack(f->ptr, pack_ptr, metadata, TRUE);
- DBUG_PRINT("debug", ("field: %s; metadata: 0x%x; pack_ptr: 0x%lx; pack_ptr': 0x%lx;
bytes: %d",
- f->field_name, metadata, old_pack_ptr, pack_ptr, pack_ptr
- old_pack_ptr));
+ DBUG_PRINT("debug", ("field: %s; metadata: 0x%x;"
+ " pack_ptr: 0x%lx; pack_ptr': 0x%lx; bytes: %d",
+ f->field_name, metadata,
+ (ulong) old_pack_ptr, (ulong) pack_ptr,
+ pack_ptr - old_pack_ptr));
}
null_mask <<= 1;
@@ -260,7 +266,7 @@ unpack_row(RELAY_LOG_INFO const *rli,
if (!((null_bits & null_mask) && tabledef->maybe_null(i)))
pack_ptr+= tabledef->calc_field_size(i, (uchar *) pack_ptr);
- DBUG_PRINT("debug", ("pack_ptr: 0x%lx", pack_ptr));
+ DBUG_PRINT("debug", ("pack_ptr: 0x%lx", (ulong) pack_ptr));
null_mask <<= 1;
}
}
| Thread |
|---|
| • bk commit into 5.1 tree (mats:1.2572) BUG#29549 | Mats Kindahl | 9 Oct |