Commit 5b5ef176 authored by unknown's avatar unknown

Merge mysql.com:/home/ram/work/mysql-5.1-maint

into  mysql.com:/home/ram/work/b19328/b19328.5.1

parents 71631a05 d7282f13
......@@ -655,7 +655,8 @@ void **thd_ha_data(const MYSQL_THD thd, const struct handlerton *hton);
int thd_tx_isolation(const MYSQL_THD thd);
char *thd_security_context(MYSQL_THD thd, char *buffer, unsigned int length,
unsigned int max_query_len);
/* Increments the row counter, see THD::row_count */
void thd_inc_row_count(MYSQL_THD thd);
#ifdef __cplusplus
}
......
......@@ -5,7 +5,6 @@
-- source include/have_log_bin.inc
-- source include/not_embedded.inc
-- source include/have_innodb.inc
-- source include/have_log_bin.inc
-- source include/have_debug.inc
--disable_warnings
......@@ -139,6 +138,37 @@ show binlog events from 0;
set session autocommit = @ac;
# now show that nothing breaks if we need to read from the cache more
# than once, resulting in split event-headers
set @bcs = @@binlog_cache_size;
set @ac = @@autocommit;
set global binlog_cache_size=4096;
set autocommit= 0;
reset master;
create table t1 (a int) engine=innodb;
let $1=400;
disable_query_log;
begin;
while ($1)
{
eval insert into t1 values( $1 );
dec $1;
}
commit;
enable_query_log;
--replace_regex /\/\* xid=.* \*\//\/* XID *\// /table_id: [0-9]+/table_id: #/ /Server ver: [^,]*,/Server version,/
show binlog events from 0;
drop table t1;
set global binlog_cache_size=@bcs;
set session autocommit = @ac;
--echo End of 5.0 tests
# Test of a too big SET INSERT_ID: see if the truncated value goes
......
......@@ -5276,7 +5276,7 @@ drop table t1;
create table t1(a int, b int) engine=csv;
repair table t1;
Table Op Msg_type Msg_text
test.t1 repair Warning Data truncated for column 'a' at row 1
test.t1 repair Warning Data truncated for column 'a' at row 5
test.t1 repair status OK
check table t1;
Table Op Msg_type Msg_text
......
......@@ -48,7 +48,7 @@ where ABS(t1.col_a - t1_slave.col_a) < 0.0001 ;
SELECT @aux;
@aux
12
DROP TABLE t1, t1_slave;
DROP PROCEDURE test_replication_sp1;
DROP PROCEDURE test_replication_sp2;
DROP FUNCTION test_replication_sf;
DROP TABLE t1, t1_slave;
......@@ -104,10 +104,10 @@ if (`SELECT @aux <> 12 OR @aux IS NULL`)
# Cleanup
connection master;
DROP TABLE t1, t1_slave;
DROP PROCEDURE test_replication_sp1;
DROP PROCEDURE test_replication_sp2;
DROP FUNCTION test_replication_sf;
DROP TABLE t1, t1_slave;
--sync_slave_with_master
......@@ -26,7 +26,7 @@ connection con1;
--send
update t1 set n = 3;
connection con2;
sleep 0.5;
sleep 1;
unlock tables;
connection con1;
reap;
......
......@@ -4,6 +4,6 @@
#
# Bug #24924: shared-memory-base-name that is too long causes buffer overflow
#
--exec $MYSQLADMIN --no-defaults --shared-memory-base-name=HeyMrBaseNameXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX ping
--exec $MYSQLADMIN --no-defaults --user=root --host=127.0.0.1 --port=$MASTER_MYPORT --shared-memory-base-name=HeyMrBaseNameXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX ping
--echo End of 5.0 tests.
......@@ -1360,6 +1360,18 @@ bool Field::send_binary(Protocol *protocol)
}
int Field::store(const char *to, uint length, CHARSET_INFO *cs,
enum_check_fields check_level)
{
int res;
enum_check_fields old_check_level= table->in_use->count_cuted_fields;
table->in_use->count_cuted_fields= check_level;
res= store(to, length, cs);
table->in_use->count_cuted_fields= old_check_level;
return res;
}
my_decimal *Field::val_decimal(my_decimal *decimal)
{
/* This never have to be called */
......
......@@ -100,6 +100,8 @@ class Field
virtual int store(longlong nr, bool unsigned_val)=0;
virtual int store_decimal(const my_decimal *d)=0;
virtual int store_time(MYSQL_TIME *ltime, timestamp_type t_type);
int store(const char *to, uint length, CHARSET_INFO *cs,
enum_check_fields check_level);
virtual double val_real(void)=0;
virtual longlong val_int(void)=0;
virtual my_decimal *val_decimal(my_decimal *);
......
......@@ -3995,58 +3995,61 @@ int MYSQL_BIN_LOG::write_cache(IO_CACHE *cache, bool lock_log, bool sync_log)
memcpy((char *)cache->read_pos, &header[carry], LOG_EVENT_HEADER_LEN - carry);
/* next event header at ... */
hdr_offs = LOG_EVENT_HEADER_LEN - carry +
uint4korr(&header[EVENT_LEN_OFFSET]);
hdr_offs = uint4korr(&header[EVENT_LEN_OFFSET]) - carry;
carry= 0;
}
/* if there is anything to write, process it. */
if(likely(bytes > 0))
if (likely(bytes > 0))
{
/*
next header beyond current read-buffer? we'll get it later
(though not necessarily in the very next iteration).
process all event-headers in this (partial) cache.
if next header is beyond current read-buffer,
we'll get it later (though not necessarily in the
very next iteration, just "eventually").
*/
if (hdr_offs >= bytes)
hdr_offs -= bytes;
else
while (hdr_offs < bytes)
{
/*
partial header only? save what we can get, process once
we get the rest.
*/
/* process all event-headers in this (partial) cache. */
do {
/*
partial header only? save what we can get, process once
we get the rest.
*/
if (hdr_offs + LOG_EVENT_HEADER_LEN > bytes)
{
carry= bytes - hdr_offs;
memcpy(header, (char *)cache->read_pos + hdr_offs, carry);
bytes= hdr_offs;
}
else
{
/* we've got a full event-header, and it came in one piece */
if (hdr_offs + LOG_EVENT_HEADER_LEN > bytes)
{
carry= bytes - hdr_offs;
memcpy(header, (char *)cache->read_pos + hdr_offs, carry);
bytes= hdr_offs;
}
else
{
/* we've got a full event-header, and it came in one piece */
uchar *log_pos= (uchar *)cache->read_pos + hdr_offs + LOG_POS_OFFSET;
uchar *log_pos= (uchar *)cache->read_pos + hdr_offs + LOG_POS_OFFSET;
/* fix end_log_pos */
val= uint4korr(log_pos) + group;
int4store(log_pos, val);
/* fix end_log_pos */
val= uint4korr(log_pos) + group;
int4store(log_pos, val);
/* next event header at ... */
log_pos= (uchar *)cache->read_pos + hdr_offs + EVENT_LEN_OFFSET;
hdr_offs += uint4korr(log_pos);
/* next event header at ... */
log_pos= (uchar *)cache->read_pos + hdr_offs + EVENT_LEN_OFFSET;
hdr_offs += uint4korr(log_pos);
}
} while (hdr_offs < bytes);
}
}
/*
Adjust hdr_offs. Note that this doesn't mean it will necessarily
be valid in the next iteration; if the current event is very long,
it may take a couple of read-iterations (and subsequent fixings
of hdr_offs) for it to become valid again.
if we had a split header, hdr_offs was already fixed above.
*/
if (carry == 0)
hdr_offs -= bytes;
}
/* Write data to the binary log file */
......
......@@ -494,6 +494,13 @@ enum enum_parsing_place
struct st_table;
class THD;
enum enum_check_fields
{
CHECK_FIELD_IGNORE,
CHECK_FIELD_WARN,
CHECK_FIELD_ERROR_FOR_NULL
};
/* Struct to handle simple linked lists */
typedef struct st_sql_list {
......
......@@ -253,6 +253,11 @@ int thd_tx_isolation(const THD *thd)
return (int) thd->variables.tx_isolation;
}
extern "C"
void thd_inc_row_count(THD *thd)
{
thd->row_count++;
}
/*
Dumps a text description of a thread, its security context
......
......@@ -39,8 +39,6 @@ enum enum_ha_read_modes { RFIRST, RNEXT, RPREV, RLAST, RKEY, RNEXT_SAME };
enum enum_duplicates { DUP_ERROR, DUP_REPLACE, DUP_UPDATE };
enum enum_delay_key_write { DELAY_KEY_WRITE_NONE, DELAY_KEY_WRITE_ON,
DELAY_KEY_WRITE_ALL };
enum enum_check_fields
{ CHECK_FIELD_IGNORE, CHECK_FIELD_WARN, CHECK_FIELD_ERROR_FOR_NULL };
enum enum_mark_columns
{ MARK_COLUMNS_NONE, MARK_COLUMNS_READ, MARK_COLUMNS_WRITE};
......
......@@ -45,8 +45,6 @@
#pragma implementation // gcc: Class implementation
#endif
#define MYSQL_SERVER 1
#include "mysql_priv.h"
#include <mysql/plugin.h>
#include "ha_tina.h"
......@@ -675,7 +673,8 @@ int ha_tina::find_current_row(uchar *buf)
if (bitmap_is_set(table->read_set, (*field)->field_index))
{
if ((*field)->store(buffer.ptr(), buffer.length(), buffer.charset()))
if ((*field)->store(buffer.ptr(), buffer.length(), buffer.charset(),
CHECK_FIELD_WARN))
goto err;
}
}
......@@ -1002,7 +1001,6 @@ int ha_tina::delete_row(const uchar * buf)
int ha_tina::rnd_init(bool scan)
{
THD *thd= table ? table->in_use : current_thd;
DBUG_ENTER("ha_tina::rnd_init");
/* set buffer to the beginning of the file */
......@@ -1014,7 +1012,6 @@ int ha_tina::rnd_init(bool scan)
stats.records= 0;
records_is_known= 0;
chain_ptr= chain;
thd->count_cuted_fields= CHECK_FIELD_WARN; // To find wrong values
DBUG_RETURN(0);
}
......@@ -1298,9 +1295,9 @@ int ha_tina::repair(THD* thd, HA_CHECK_OPT* check_opt)
current_position= next_position= 0;
/* Read the file row-by-row. If everything is ok, repair is not needed. */
thd->count_cuted_fields= CHECK_FIELD_WARN; // To find wrong values
while (!(rc= find_current_row(buf)))
{
thd_inc_row_count(thd);
rows_repaired++;
current_position= next_position;
}
......@@ -1464,9 +1461,9 @@ int ha_tina::check(THD* thd, HA_CHECK_OPT* check_opt)
/* set current position to the beginning of the file */
current_position= next_position= 0;
/* Read the file row-by-row. If everything is ok, repair is not needed. */
thd->count_cuted_fields= CHECK_FIELD_WARN; // To find wrong values
while (!(rc= find_current_row(buf)))
{
thd_inc_row_count(thd);
count--;
current_position= next_position;
}
......
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