merge from 5.5 main

This commit is contained in:
Bjorn Munch 2011-03-31 12:09:03 +02:00
commit 906c5703ab
62 changed files with 982 additions and 441 deletions

View file

@ -9,6 +9,7 @@
*.core
*.d
*.da
*.dir
*.dll
*.dylib
*.exe
@ -31,6 +32,7 @@
*.pdb
*.reject
*.res
*.rule
*.sbr
*.so
*.so.*
@ -38,6 +40,8 @@
*.user
*.vcproj
*.vcproj.cmake
*.vcxproj
*.vcxproj.filters
*/*.dir/*
*/*_pure_*warnings
*/.deps
@ -46,7 +50,7 @@
*/debug/*
*/minsizerel/*
*/release/*
*/relwithdebinfo/*
RelWithDebInfo
*~
.*.swp
./CMakeCache.txt

View file

@ -714,10 +714,18 @@ Exit_status process_event(PRINT_EVENT_INFO *print_event_info, Log_event *ev,
*/
start_datetime= 0;
offset= 0; // print everything and protect against cycling rec_count
/*
Skip events according to the --server-id flag. However, don't
skip format_description or rotate events, because they they
are really "global" events that are relevant for the entire
binlog, even if they have a server_id. Also, we have to read
the format_description event so that we can parse subsequent
events.
*/
if (ev_type != ROTATE_EVENT &&
server_id && (server_id != ev->server_id))
goto end;
}
if (server_id && (server_id != ev->server_id))
/* skip just this event, continue processing the log. */
goto end;
if (((my_time_t)(ev->when) >= stop_datetime)
|| (pos >= stop_position_mot))
{

View file

@ -32,7 +32,7 @@ static my_bool verbose, print_all_codes;
#include "../include/my_base.h"
#include "../mysys/my_handler_errors.h"
#include "../include/my_handler.h"
// #include "../include/my_compare.h"
#ifdef WITH_NDBCLUSTER_STORAGE_ENGINE
static my_bool ndb_code;
@ -240,7 +240,39 @@ static my_bool print_win_error_msg(DWORD error, my_bool verbose)
}
#endif
/*
Register handler error messages for usage with my_error()
NOTES
This is safe to call multiple times as my_error_register()
will ignore calls to register already registered error numbers.
*/
static const char **get_handler_error_messages()
{
return handler_error_messages;
}
void my_handler_error_register(void)
{
/*
If you got compilation error here about compile_time_assert array, check
that every HA_ERR_xxx constant has a corresponding error message in
handler_error_messages[] list (check mysys/ma_handler_errors.h and
include/my_base.h).
*/
compile_time_assert(HA_ERR_FIRST + array_elements(handler_error_messages) ==
HA_ERR_LAST + 1);
my_error_register(get_handler_error_messages, HA_ERR_FIRST,
HA_ERR_FIRST+ array_elements(handler_error_messages)-1);
}
void my_handler_error_unregister(void)
{
my_error_unregister(HA_ERR_FIRST,
HA_ERR_FIRST+ array_elements(handler_error_messages)-1);
}
int main(int argc,char *argv[])
{

View file

@ -30,7 +30,7 @@ extern "C" {
#include <my_pthread.h>
#include <thr_lock.h>
#include "my_handler.h"
#include "my_compare.h"
#include "my_tree.h"
/* defines used by heap-funktions */

View file

@ -1,22 +1,20 @@
/* Copyright (C) 2002-2006 MySQL AB
/* Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; version 2
of the License.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; version 2 of the License.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU Library General Public
License along with this library; if not, write to the Free
Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
MA 02111-1307, USA */
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
#ifndef _my_handler_h
#define _my_handler_h
#ifndef _my_compare_h
#define _my_compare_h
#include "myisampack.h"
#ifdef __cplusplus
@ -114,9 +112,6 @@ extern int ha_key_cmp(register HA_KEYSEG *keyseg, register uchar *a,
register uchar *b, uint key_length, uint nextflag,
uint *diff_pos);
extern HA_KEYSEG *ha_find_null(HA_KEYSEG *keyseg, uchar *a);
extern void my_handler_error_register(void);
extern void my_handler_error_unregister(void);
/*
Inside an in-memory data record, memory pointers to pieces of the
record (like BLOBs) are stored in their native byte order and in
@ -127,4 +122,4 @@ extern void my_handler_error_unregister(void);
}
#endif
#endif /* _my_handler_h */
#endif /* _my_compare_h */

View file

@ -1,4 +1,4 @@
/* Copyright (C) 2000-2003 MySQL AB, 2009 Sun Microsystems, Inc
/* Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@ -285,7 +285,7 @@ C_MODE_END
#define ulonglong2double(A) my_ulonglong2double(A)
#define my_off_t2double(A) my_ulonglong2double(A)
C_MODE_START
double my_ulonglong2double(unsigned long long A);
inline double my_ulonglong2double(unsigned long long A) { return (double A); }
C_MODE_END
#endif /* _AIX */

View file

@ -1,4 +1,4 @@
/* Copyright (C) 2000 MySQL AB
/* Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@ -73,38 +73,6 @@ C_MODE_START
#define in_addr_t uint32
#endif
/*
Handling of gethostbyname_r()
*/
#if !defined(HAVE_GETHOSTBYNAME_R)
struct hostent *my_gethostbyname_r(const char *name,
struct hostent *result, char *buffer,
int buflen, int *h_errnop);
void my_gethostbyname_r_free();
#elif defined(HAVE_PTHREAD_ATTR_CREATE) || defined(_AIX) || defined(HAVE_GETHOSTBYNAME_R_GLIBC2_STYLE)
struct hostent *my_gethostbyname_r(const char *name,
struct hostent *result, char *buffer,
int buflen, int *h_errnop);
#define my_gethostbyname_r_free()
#if !defined(HAVE_GETHOSTBYNAME_R_GLIBC2_STYLE) && !defined(HPUX10)
#define GETHOSTBYNAME_BUFF_SIZE sizeof(struct hostent_data)
#endif /* !defined(HAVE_GETHOSTBYNAME_R_GLIBC2_STYLE) */
#elif defined(HAVE_GETHOSTBYNAME_R_RETURN_INT)
#define GETHOSTBYNAME_BUFF_SIZE sizeof(struct hostent_data)
struct hostent *my_gethostbyname_r(const char *name,
struct hostent *result, char *buffer,
int buflen, int *h_errnop);
#define my_gethostbyname_r_free()
#else
#define my_gethostbyname_r(A,B,C,D,E) gethostbyname_r((A),(B),(C),(D),(E))
#define my_gethostbyname_r_free()
#endif /* !defined(HAVE_GETHOSTBYNAME_R) */
#ifndef GETHOSTBYNAME_BUFF_SIZE
#define GETHOSTBYNAME_BUFF_SIZE 2048
#endif
C_MODE_END
#endif

View file

@ -1,4 +1,5 @@
/* Copyright (C) 2000 MySQL AB, 2008-2009 Sun Microsystems, Inc
/* Copyright (C) 2000, 2011, Oracle and/or its affiliates. All rights
reserved
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@ -30,7 +31,7 @@ extern "C" {
#ifndef _keycache_h
#include "keycache.h"
#endif
#include "my_handler.h"
#include "my_compare.h"
#include <mysql/plugin.h>
/*

View file

@ -114,6 +114,10 @@ enum enum_server_command
#define FIELD_IN_PART_FUNC_FLAG (1 << 19)/* Field part of partition func */
#define FIELD_IN_ADD_INDEX (1<< 20) /* Intern: Field used in ADD INDEX */
#define FIELD_IS_RENAMED (1<< 21) /* Intern: Field is being renamed */
#define FIELD_FLAGS_STORAGE_MEDIA 22 /* Field storage media, bit 22-23,
reserved by MySQL Cluster */
#define FIELD_FLAGS_COLUMN_FORMAT 24 /* Field column format, bit 24-25,
reserved by MySQL Cluster */
#define REFRESH_GRANT 1 /* Refresh grant tables */
#define REFRESH_LOG 2 /* Start on new log file */

View file

@ -62,4 +62,24 @@ UPDATE t1 SET c1= 0;
DROP TABLE t1;
-- sync_slave_with_master
#
# BUG#11766865: 60091: RBR + NO PK + UPDATE NULL VALUE --> SLAVE BREAK WITH ERROR HA_ERR_END_OF_
#
--connection master
--source include/rpl_reset.inc
--connection master
--eval CREATE TABLE t1 (c1 int(11) NOT NULL, c2 int(11) NOT NULL, c3 int(11) DEFAULT '-1') ENGINE=$engine DEFAULT CHARSET=latin1
INSERT INTO t1 VALUES (1,2,NULL);
UPDATE t1 SET c1=1, c2=2, c3=-1 WHERE c1=1 AND c2=2 AND ISNULL(c3);
--sync_slave_with_master
--let $diff_tables=master:test.t1, slave:test.t1
--source include/diff_tables.inc
--connection master
DROP TABLE t1;
--sync_slave_with_master

View file

@ -6,3 +6,15 @@ set @my_max_allowed_packet= @@max_allowed_packet;
set global max_allowed_packet=100*@@max_allowed_packet;
set global max_allowed_packet=@my_max_allowed_packet;
drop table t1;
End of 5.1 tests
#
# Bug #11766306: 59393: HAVE_INNODB=YES WHEN MYSQLD
# STARTED WITH --SKIP-INNODB
#
SHOW VARIABLES LIKE 'have_innodb';
Variable_name Value
have_innodb DISABLED
SELECT SUPPORT FROM INFORMATION_SCHEMA.ENGINES WHERE engine='innodb';
SUPPORT
NO
End of 5.5 tests

View file

@ -747,15 +747,15 @@ event_name originator
ev1 4294967295
DROP EVENT ev1;
SET GLOBAL server_id = @old_server_id;
CREATE DATABASE event_test12;
USE event_test12;
CREATE EVENT ev1 ON SCHEDULE EVERY 1 DAY DO SELECT 1;
CREATE DATABASE event_test1;
USE event_test1;
CREATE EVENT ev1 ON SCHEDULE EVERY 1 DAY DO SELECT 1;
CREATE DATABASE event_test2;
USE event_test2;
SHOW EVENTS;
Db Name Definer Time zone Type Execute at Interval value Interval field Starts Ends Status Originator character_set_client collation_connection Database Collation
DROP DATABASE event_test1;
DROP DATABASE event_test2;
DROP DATABASE event_test12;
DROP DATABASE events_test;
SET GLOBAL event_scheduler= 'ON';
SET @@global.concurrent_insert= @concurrent_insert;

View file

@ -514,6 +514,13 @@ t1 CREATE TABLE `t1` (
`C` varchar(23) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
DROP TABLE t1;
#
# Bug#11764994 57900: CREATE TABLE .. SELECT ASSERTS SCALE >= 0 && PRECISION > 0 && SCALE <= PR
#
CREATE TABLE t1 SELECT CEIL(LINESTRINGFROMWKB(1) DIV NULL);
DROP TABLE t1;
CREATE TABLE t1 SELECT FLOOR(LINESTRINGFROMWKB(1) DIV NULL);
DROP TABLE t1;
End of 5.1 tests
#
# Bug #8433: Overflow must be an error

View file

@ -1347,6 +1347,36 @@ Warning 1292 Truncated incorrect time value: ''
Warning 1292 Truncated incorrect time value: ''
Warning 1292 Truncated incorrect time value: ''
DROP TABLE t1;
#
# Bug#11766112 59151:UNINITIALIZED VALUES IN EXTRACT_DATE_TIME WITH STR_TO_DATE(SPACE(..) ...
#
SELECT STR_TO_DATE(SPACE(2),'1');
STR_TO_DATE(SPACE(2),'1')
0000-00-00
#
# Bug#11765216 58154: UNINITIALIZED VARIABLE FORMAT IN STR_TO_DATE FUNCTION
#
SET GLOBAL SQL_MODE='';
DO STR_TO_DATE((''), FROM_DAYS(@@GLOBAL.SQL_MODE));
SET GLOBAL SQL_MODE=DEFAULT;
#
# Bug#11766087 59125: VALGRIND UNINITIALISED VALUE WARNING IN ULL2DEC, LONGLONG2DECIMAL
#
SELECT FORMAT(YEAR(STR_TO_DATE('',GET_FORMAT(TIME,''))),1);
FORMAT(YEAR(STR_TO_DATE('',GET_FORMAT(TIME,''))),1)
NULL
#
# Bug#11766126 59166: ANOTHER DATETIME VALGRIND UNINITIALIZED WARNING
#
SELECT CAST((MONTH(FROM_UNIXTIME(@@GLOBAL.SQL_MODE))) AS BINARY(1025));
CAST((MONTH(FROM_UNIXTIME(@@GLOBAL.SQL_MODE))) AS BINARY(1025))
NULL
#
# Bug#11766124 59164: VALGRIND: UNINITIALIZED VALUE IN NUMBER_TO_DATETIME
#
SELECT ADDDATE(MONTH(FROM_UNIXTIME(NULL)),INTERVAL 1 HOUR);
ADDDATE(MONTH(FROM_UNIXTIME(NULL)),INTERVAL 1 HOUR)
NULL
End of 5.1 tests
#
# Bug#57039: constant subtime expression returns incorrect result.

View file

@ -903,3 +903,15 @@ master-bin.000002 # Query # # CREATE DATABASE test1
master-bin.000002 # Query # # use `test1`; CREATE TABLE t1(id int)
master-bin.000002 # Query # # use `test1`; DROP TABLE `t1` /* generated by server */
master-bin.000002 # Query # # DROP DATABASE test1
RESET MASTER;
USE test;
CREATE TABLE t1 (a INT);
SET GLOBAL SERVER_ID = 2;
DROP TABLE t1;
FLUSH LOGS;
SHOW TABLES IN test;
Tables_in_test
t1
SHOW TABLES IN test;
Tables_in_test
SET GLOBAL SERVER_ID = 1;

View file

@ -3,6 +3,7 @@ set @net_buffer_length=@@global.net_buffer_length;
set global max_allowed_packet=100;
Warnings:
Warning 1292 Truncated incorrect max_allowed_packet value: '100'
Warning 1708 The value of 'max_allowed_packet' should be no less than the value of 'net_buffer_length'
set global net_buffer_length=100;
Warnings:
Warning 1292 Truncated incorrect net_buffer_length value: '100'

View file

@ -2155,6 +2155,8 @@ mysqld is alive
SET @max_allowed_packet= @@global.max_allowed_packet;
SET @net_buffer_length= @@global.net_buffer_length;
SET GLOBAL max_allowed_packet= 1024;
Warnings:
Warning 1708 The value of 'max_allowed_packet' should be no less than the value of 'net_buffer_length'
SET GLOBAL net_buffer_length= 1024;
ERROR 1153 (08S01) at line 1: Got a packet bigger than 'max_allowed_packet' bytes
SET GLOBAL max_allowed_packet= @max_allowed_packet;

View file

@ -0,0 +1,112 @@
CREATE TABLE t1(a int) TABLESPACE ts ENGINE=MyISAM;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` int(11) DEFAULT NULL
) /*!50100 TABLESPACE ts */ ENGINE=MyISAM DEFAULT CHARSET=latin1
DROP TABLE t1;
CREATE TABLE t1(a int) TABLESPACE ts STORAGE DISK ENGINE=MyISAM;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` int(11) DEFAULT NULL
) /*!50100 TABLESPACE ts STORAGE DISK */ ENGINE=MyISAM DEFAULT CHARSET=latin1
DROP TABLE t1;
CREATE TABLE t1(a int) TABLESPACE ts STORAGE MEMORY ENGINE=MyISAM;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` int(11) DEFAULT NULL
) /*!50100 TABLESPACE ts STORAGE MEMORY */ ENGINE=MyISAM DEFAULT CHARSET=latin1
DROP TABLE t1;
CREATE TABLE t1(a int) STORAGE MEMORY ENGINE=MyISAM;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` int(11) DEFAULT NULL
) /*!50100 STORAGE MEMORY */ ENGINE=MyISAM DEFAULT CHARSET=latin1
DROP TABLE t1;
CREATE TABLE t1(a int) STORAGE DISK ENGINE=MyISAM;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` int(11) DEFAULT NULL
) /*!50100 STORAGE DISK */ ENGINE=MyISAM DEFAULT CHARSET=latin1
DROP TABLE t1;
CREATE TABLE t1(a int) TABLESPACE ts ENGINE=MyISAM;
ALTER TABLE t1 ADD COLUMN b int;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` int(11) DEFAULT NULL,
`b` int(11) DEFAULT NULL
) /*!50100 TABLESPACE ts */ ENGINE=MyISAM DEFAULT CHARSET=latin1
DROP TABLE t1;
CREATE TABLE t1(a int) TABLESPACE ts STORAGE DISK ENGINE=MyISAM;
ALTER TABLE t1 ADD COLUMN b int;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` int(11) DEFAULT NULL,
`b` int(11) DEFAULT NULL
) /*!50100 TABLESPACE ts STORAGE DISK */ ENGINE=MyISAM DEFAULT CHARSET=latin1
DROP TABLE t1;
CREATE TABLE t1(a int) ENGINE=MyISAM;
ALTER TABLE t1 TABLESPACE ts;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` int(11) DEFAULT NULL
) /*!50100 TABLESPACE ts */ ENGINE=MyISAM DEFAULT CHARSET=latin1
ALTER TABLE t1 TABLESPACE ts2;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` int(11) DEFAULT NULL
) /*!50100 TABLESPACE ts2 */ ENGINE=MyISAM DEFAULT CHARSET=latin1
DROP TABLE t1;
CREATE TABLE t1(a int) ENGINE=MyISAM;
ALTER TABLE t1 STORAGE MEMORY;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` int(11) DEFAULT NULL
) /*!50100 STORAGE MEMORY */ ENGINE=MyISAM DEFAULT CHARSET=latin1
ALTER TABLE t1 STORAGE DISK;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` int(11) DEFAULT NULL
) /*!50100 STORAGE DISK */ ENGINE=MyISAM DEFAULT CHARSET=latin1
DROP TABLE t1;
CREATE TABLE t1(a int) ENGINE=MyISAM;
ALTER TABLE t1 STORAGE MEMORY TABLESPACE ts;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` int(11) DEFAULT NULL
) /*!50100 TABLESPACE ts STORAGE MEMORY */ ENGINE=MyISAM DEFAULT CHARSET=latin1
ALTER TABLE t1 STORAGE DISK TABLESPACE ts2;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` int(11) DEFAULT NULL
) /*!50100 TABLESPACE ts2 STORAGE DISK */ ENGINE=MyISAM DEFAULT CHARSET=latin1
DROP TABLE t1;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` int(11) NOT NULL,
`b` int(11) DEFAULT NULL,
`c` int(11) DEFAULT NULL,
`d` int(11) NOT NULL,
`e` int(11) DEFAULT NULL,
`f` int(11) DEFAULT NULL,
`g` int(11) DEFAULT NULL,
`h` int(11) NOT NULL,
`i` int(11) DEFAULT NULL,
`j` int(11) DEFAULT NULL,
`k` int(11) DEFAULT NULL,
PRIMARY KEY (`a`)
) /*!50100 TABLESPACE the_tablespacename STORAGE DISK */ ENGINE=MyISAM DEFAULT CHARSET=latin1
DROP TABLE t1;

View file

@ -108,3 +108,27 @@ SET @@session.slave_skip_errors= 7;
ERROR HY000: Variable 'slave_skip_errors' is a read only variable
SET @@global.slave_skip_errors= 7;
ERROR HY000: Variable 'slave_skip_errors' is a read only variable
#
# Bug #11766769 : 59959: SMALL VALUES OF --MAX-ALLOWED-PACKET
# ARE NOT BEING HONORED
#
CREATE TABLE t1 (a MEDIUMTEXT);
SET GLOBAL max_allowed_packet=2048;
Warnings:
Warning 1708 The value of 'max_allowed_packet' should be no less than the value of 'net_buffer_length'
SET GLOBAL net_buffer_length=4096;
Warnings:
Warning 1708 The value of 'max_allowed_packet' should be no less than the value of 'net_buffer_length'
SHOW SESSION VARIABLES LIKE 'max_allowed_packet';
Variable_name Value
max_allowed_packet 2048
SHOW SESSION VARIABLES LIKE 'net_buffer_length';
Variable_name Value
net_buffer_length 4096
ERROR 08S01: Got a packet bigger than 'max_allowed_packet' bytes
SELECT LENGTH(a) FROM t1;
LENGTH(a)
SET GLOBAL max_allowed_packet=default;
SET GLOBAL net_buffer_length=default;
DROP TABLE t1;
End of 5.1 tests

View file

@ -505,6 +505,7 @@ set low_priority_updates=1;
set global max_allowed_packet=100;
Warnings:
Warning 1292 Truncated incorrect max_allowed_packet value: '100'
Warning 1708 The value of 'max_allowed_packet' should be no less than the value of 'net_buffer_length'
set global max_binlog_cache_size=100;
Warnings:
Warning 1292 Truncated incorrect max_binlog_cache_size value: '100'
@ -1059,6 +1060,8 @@ set global max_write_lock_count =default;
set global myisam_data_pointer_size =@my_myisam_data_pointer_size;
set global myisam_max_sort_file_size =@my_myisam_max_sort_file_size;
set global net_buffer_length =@my_net_buffer_length;
Warnings:
Warning 1708 The value of 'max_allowed_packet' should be no less than the value of 'net_buffer_length'
set global net_write_timeout =@my_net_write_timeout;
set global net_read_timeout =@my_net_read_timeout;
set global query_cache_limit =@my_query_cache_limit;
@ -1543,6 +1546,22 @@ Warning 1292 Truncated incorrect key_cache_block_size value: '0'
select @@max_long_data_size;
@@max_long_data_size
1048576
#
# Bug#11766424 59527: DECIMAL_BIN_SIZE: ASSERTION `SCALE >= 0 && PRECISION > 0 && SCALE <= PRE
#
CREATE TABLE t1(f1 DECIMAL(1,1) UNSIGNED);
INSERT INTO t1 VALUES (0.2),(0.1);
SELECT 1 FROM t1 GROUP BY @a:= (SELECT ROUND(f1) FROM t1 WHERE @a=f1);
1
1
DROP TABLE t1;
CREATE TABLE t1 AS SELECT @a:= CAST(1 AS UNSIGNED) AS a;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` int(1) unsigned NOT NULL DEFAULT '0'
) ENGINE=MyISAM DEFAULT CHARSET=latin1
DROP TABLE t1;
SET @@global.max_binlog_cache_size=DEFAULT;
SET @@global.max_join_size=DEFAULT;
SET @@global.key_buffer_size=@kbs;

Binary file not shown.

Binary file not shown.

View file

@ -11,4 +11,3 @@
##############################################################################
binlog_truncate_innodb : BUG#57291 2010-10-20 anitha Originally disabled due to BUG#42643. Product bug fixed, but test changes needed
binlog_spurious_ddl_errors : BUG#54195 2010-06-03 alik binlog_spurious_ddl_errors.test fails, thus disabled
binlog_row_failure_mixing_engines : BUG#58416 2010-11-23 ramil Fails on win x86 debug_max

View file

@ -49,6 +49,8 @@ SET @max_allowed_packet_2= @@session.max_allowed_packet;
==== clean up ====
DROP TABLE t1;
SET @@global.max_allowed_packet= 1024;
Warnings:
Warning 1708 The value of 'max_allowed_packet' should be no less than the value of 'net_buffer_length'
SET @@global.net_buffer_length= 1024;
DROP TABLE t1;
RESET SLAVE;

View file

@ -25,4 +25,10 @@ INSERT INTO t1(c1) VALUES (NULL);
UPDATE t1 SET c1= 0;
include/diff_tables.inc [master:t1, slave:t1]
DROP TABLE t1;
include/rpl_reset.inc
CREATE TABLE t1 (c1 int(11) NOT NULL, c2 int(11) NOT NULL, c3 int(11) DEFAULT '-1') ENGINE=InnoDB DEFAULT CHARSET=latin1;
INSERT INTO t1 VALUES (1,2,NULL);
UPDATE t1 SET c1=1, c2=2, c3=-1 WHERE c1=1 AND c2=2 AND ISNULL(c3);
include/diff_tables.inc [master:test.t1, slave:test.t1]
DROP TABLE t1;
include/rpl_end.inc

View file

@ -1,5 +1,14 @@
include/master-slave.inc
[connection master]
## coverage purposes - Field_bits
## 1 X bit + 2 Null bits + 5 bits => last_null_bit_pos==0
include/rpl_reset.inc
CREATE TABLE t1 (c1 bigint(20) DEFAULT 0, c2 bit(5)) ENGINE=MyISAM DEFAULT CHARSET=latin1;
INSERT INTO t1(c1,c2) VALUES (10, b'1');
INSERT INTO t1(c1,c2) VALUES (NULL, b'1');
UPDATE t1 SET c1= 0;
include/diff_tables.inc [master:t1, slave:t1]
DROP TABLE t1;
## case #1 - last_null_bit_pos==0 in record_compare without X bit
include/rpl_reset.inc
CREATE TABLE t1 (c1 bigint(20) DEFAULT 0, c2 bigint(20) DEFAULT 0, c3 bigint(20) DEFAULT 0, c4 varchar(1) DEFAULT '', c5 bigint(20) DEFAULT 0, c6 bigint(20) DEFAULT 0, c7 bigint(20) DEFAULT 0, c8 bigint(20) DEFAULT 0) ENGINE=MyISAM DEFAULT CHARSET=latin1;
@ -25,13 +34,10 @@ INSERT INTO t1(c1) VALUES (NULL);
UPDATE t1 SET c1= 0;
include/diff_tables.inc [master:t1, slave:t1]
DROP TABLE t1;
## coverage purposes - Field_bits
## 1 X bit + 2 Null bits + 5 bits => last_null_bit_pos==0
include/rpl_reset.inc
CREATE TABLE t1 (c1 bigint(20) DEFAULT 0, c2 bit(5)) ENGINE=MyISAM DEFAULT CHARSET=latin1;
INSERT INTO t1(c1,c2) VALUES (10, b'1');
INSERT INTO t1(c1,c2) VALUES (NULL, b'1');
UPDATE t1 SET c1= 0;
include/diff_tables.inc [master:t1, slave:t1]
CREATE TABLE t1 (c1 int(11) NOT NULL, c2 int(11) NOT NULL, c3 int(11) DEFAULT '-1') ENGINE=MyISAM DEFAULT CHARSET=latin1;
INSERT INTO t1 VALUES (1,2,NULL);
UPDATE t1 SET c1=1, c2=2, c3=-1 WHERE c1=1 AND c2=2 AND ISNULL(c3);
include/diff_tables.inc [master:test.t1, slave:test.t1]
DROP TABLE t1;
include/rpl_end.inc

View file

@ -1 +1 @@
--read_buffer_size=12K --max_allowed_packet=8K
--read_buffer_size=12K --max_allowed_packet=8K --net-buffer-length=8K

View file

@ -1 +1 @@
--max_allowed_packet=8K
--max_allowed_packet=8K --net-buffer-length=8K

View file

@ -1,12 +1,11 @@
-- source include/have_binlog_format_row.inc
-- source include/master-slave.inc
-- let $engine= MyISAM
#
# BUG#52868 Wrong handling of NULL value during update, replication out of sync
#
-- let $engine= MyISAM
-- source extra/rpl_tests/rpl_record_compare.test
-- echo ## coverage purposes - Field_bits
-- echo ## 1 X bit + 2 Null bits + 5 bits => last_null_bit_pos==0
@ -28,4 +27,7 @@ UPDATE t1 SET c1= 0;
-- connection master
DROP TABLE t1;
-- sync_slave_with_master
-- source extra/rpl_tests/rpl_record_compare.test
--source include/rpl_end.inc

View file

@ -15,6 +15,7 @@ call mtr.add_suppression("Unsafe statement written to the binary log using state
connection slave;
call mtr.add_suppression("Master server does not support semi-sync");
call mtr.add_suppression("Semi-sync slave .* reply");
call mtr.add_suppression("Slave SQL.*Request to stop slave SQL Thread received while applying a group that has non-transactional changes; waiting for completion of the group");
enable_query_log;
connection master;

View file

@ -7,6 +7,7 @@ SET @@global.max_allowed_packet = DEFAULT;
SET @@global.max_allowed_packet = 1000;
Warnings:
Warning 1292 Truncated incorrect max_allowed_packet value: '1000'
Warning 1708 The value of 'max_allowed_packet' should be no less than the value of 'net_buffer_length'
SET @@global.max_allowed_packet = DEFAULT;
SELECT @@global.max_allowed_packet;
@@global.max_allowed_packet
@ -25,12 +26,15 @@ SELECT @@global.max_allowed_packet = 1048576;
1
'#--------------------FN_DYNVARS_070_03-------------------------#'
SET @@global.max_allowed_packet = 1024;
Warnings:
Warning 1708 The value of 'max_allowed_packet' should be no less than the value of 'net_buffer_length'
SELECT @@global.max_allowed_packet;
@@global.max_allowed_packet
1024
SET @@global.max_allowed_packet = 1025;
Warnings:
Warning 1292 Truncated incorrect max_allowed_packet value: '1025'
Warning 1708 The value of 'max_allowed_packet' should be no less than the value of 'net_buffer_length'
SELECT @@global.max_allowed_packet;
@@global.max_allowed_packet
1024
@ -74,18 +78,21 @@ SELECT @@session.max_allowed_packet;
SET @@global.max_allowed_packet = 0;
Warnings:
Warning 1292 Truncated incorrect max_allowed_packet value: '0'
Warning 1708 The value of 'max_allowed_packet' should be no less than the value of 'net_buffer_length'
SELECT @@global.max_allowed_packet;
@@global.max_allowed_packet
1024
SET @@global.max_allowed_packet = -1024;
Warnings:
Warning 1292 Truncated incorrect max_allowed_packet value: '-1024'
Warning 1708 The value of 'max_allowed_packet' should be no less than the value of 'net_buffer_length'
SELECT @@global.max_allowed_packet;
@@global.max_allowed_packet
1024
SET @@global.max_allowed_packet = 1023;
Warnings:
Warning 1292 Truncated incorrect max_allowed_packet value: '1023'
Warning 1708 The value of 'max_allowed_packet' should be no less than the value of 'net_buffer_length'
SELECT @@global.max_allowed_packet;
@@global.max_allowed_packet
1024
@ -148,17 +155,21 @@ WHERE VARIABLE_NAME='max_allowed_packet';
SET @@global.max_allowed_packet = TRUE;
Warnings:
Warning 1292 Truncated incorrect max_allowed_packet value: '1'
Warning 1708 The value of 'max_allowed_packet' should be no less than the value of 'net_buffer_length'
SELECT @@global.max_allowed_packet;
@@global.max_allowed_packet
1024
SET @@global.max_allowed_packet = FALSE;
Warnings:
Warning 1292 Truncated incorrect max_allowed_packet value: '0'
Warning 1708 The value of 'max_allowed_packet' should be no less than the value of 'net_buffer_length'
SELECT @@global.max_allowed_packet;
@@global.max_allowed_packet
1024
'#---------------------FN_DYNVARS_070_09----------------------#'
SET @@global.max_allowed_packet = 2048;
Warnings:
Warning 1708 The value of 'max_allowed_packet' should be no less than the value of 'net_buffer_length'
SELECT @@max_allowed_packet = @@global.max_allowed_packet;
@@max_allowed_packet = @@global.max_allowed_packet
0

View file

@ -23,6 +23,8 @@ SELECT @@session.net_buffer_length;
'#--------------------FN_DYNVARS_070_02-------------------------#'
## Setting value of max_allowed packet and net_buffer_length to 1024 ##
SET @@global.max_allowed_packet = 1024;
Warnings:
Warning 1708 The value of 'max_allowed_packet' should be no less than the value of 'net_buffer_length'
SET @@global.net_buffer_length = 1024;
SELECT @@global.max_allowed_packet;
@@global.max_allowed_packet

View file

@ -49,3 +49,15 @@ remove_file $MYSQLTEST_VARDIR/tmp/long_query.sql;
set global max_allowed_packet=@my_max_allowed_packet;
drop table t1;
--echo End of 5.1 tests
--echo #
--echo # Bug #11766306: 59393: HAVE_INNODB=YES WHEN MYSQLD
--echo # STARTED WITH --SKIP-INNODB
--echo #
# need the --skip-innodb option present for the test to succeed
SHOW VARIABLES LIKE 'have_innodb';
SELECT SUPPORT FROM INFORMATION_SCHEMA.ENGINES WHERE engine='innodb';
--echo End of 5.5 tests

View file

@ -1225,15 +1225,15 @@ SET GLOBAL server_id = @old_server_id;
# Bug#11751148: show events shows events in other schema
#
CREATE DATABASE event_test12;
USE event_test12;
CREATE EVENT ev1 ON SCHEDULE EVERY 1 DAY DO SELECT 1;
CREATE DATABASE event_test1;
USE event_test1;
CREATE EVENT ev1 ON SCHEDULE EVERY 1 DAY DO SELECT 1;
CREATE DATABASE event_test2;
USE event_test2;
# Following show events should not show ev1
SHOW EVENTS;
DROP DATABASE event_test1;
DROP DATABASE event_test2;
DROP DATABASE event_test12;
###########################################################################

View file

@ -345,6 +345,15 @@ CREATE TABLE t1 SELECT CAST((CASE(('')) WHEN (CONVERT(1, CHAR(1))) THEN (('' / 1
SHOW CREATE TABLE t1;
DROP TABLE t1;
--echo #
--echo # Bug#11764994 57900: CREATE TABLE .. SELECT ASSERTS SCALE >= 0 && PRECISION > 0 && SCALE <= PR
--echo #
CREATE TABLE t1 SELECT CEIL(LINESTRINGFROMWKB(1) DIV NULL);
DROP TABLE t1;
CREATE TABLE t1 SELECT FLOOR(LINESTRINGFROMWKB(1) DIV NULL);
DROP TABLE t1;
--echo End of 5.1 tests
--echo #

View file

@ -862,6 +862,38 @@ INSERT INTO t1 VALUES (''),('');
SELECT COUNT(*) FROM t1 GROUP BY TIME_TO_SEC(a);
DROP TABLE t1;
--echo #
--echo # Bug#11766112 59151:UNINITIALIZED VALUES IN EXTRACT_DATE_TIME WITH STR_TO_DATE(SPACE(..) ...
--echo #
SELECT STR_TO_DATE(SPACE(2),'1');
--echo #
--echo # Bug#11765216 58154: UNINITIALIZED VARIABLE FORMAT IN STR_TO_DATE FUNCTION
--echo #
SET GLOBAL SQL_MODE='';
DO STR_TO_DATE((''), FROM_DAYS(@@GLOBAL.SQL_MODE));
SET GLOBAL SQL_MODE=DEFAULT;
--echo #
--echo # Bug#11766087 59125: VALGRIND UNINITIALISED VALUE WARNING IN ULL2DEC, LONGLONG2DECIMAL
--echo #
SELECT FORMAT(YEAR(STR_TO_DATE('',GET_FORMAT(TIME,''))),1);
--echo #
--echo # Bug#11766126 59166: ANOTHER DATETIME VALGRIND UNINITIALIZED WARNING
--echo #
SELECT CAST((MONTH(FROM_UNIXTIME(@@GLOBAL.SQL_MODE))) AS BINARY(1025));
--echo #
--echo # Bug#11766124 59164: VALGRIND: UNINITIALIZED VALUE IN NUMBER_TO_DATETIME
--echo #
SELECT ADDDATE(MONTH(FROM_UNIXTIME(NULL)),INTERVAL 1 HOUR);
--echo End of 5.1 tests
--echo #

View file

@ -527,3 +527,23 @@ exec $MYSQL_BINLOG $MYSQLD_DATADIR/$master_binlog | $MYSQL test 2>&1;
let $binlog_file= query_get_value(SHOW MASTER STATUS, File, 1);
source include/show_binlog_events.inc;
#
# BUG#11766427 BUG#59530: Filter by server id in mysqlbinlog fails
# This test checks that the format description log event is not
# filtered out by the --server-id option.
#
RESET MASTER;
USE test;
CREATE TABLE t1 (a INT);
--let $old_server_id= `SELECT @@GLOBAL.SERVER_ID`
SET GLOBAL SERVER_ID = 2;
DROP TABLE t1;
--let $master_binlog= query_get_value(SHOW MASTER STATUS, File, 1)
FLUSH LOGS;
# The following should only create t1, not drop it.
--exec $MYSQL_BINLOG --server-id=1 $MYSQLD_DATADIR/$master_binlog | $MYSQL
SHOW TABLES IN test;
# The following should only drop t1, not create it.
--exec $MYSQL_BINLOG --server-id=2 $MYSQLD_DATADIR/$master_binlog | $MYSQL
SHOW TABLES IN test;
eval SET GLOBAL SERVER_ID = $old_server_id;

View file

@ -0,0 +1,122 @@
#
# BUG#60111 storage type for table not saved in .frm
#
#
# Check that the table options for TABLESPACE and STORAGE
# are printed in SHOW CREATE TABLE
#
# TABLESPACE only
CREATE TABLE t1(a int) TABLESPACE ts ENGINE=MyISAM;
SHOW CREATE TABLE t1;
DROP TABLE t1;
# TABLESPACE + STORAGE DISK
CREATE TABLE t1(a int) TABLESPACE ts STORAGE DISK ENGINE=MyISAM;
SHOW CREATE TABLE t1;
DROP TABLE t1;
# TABLESPACE + STORAGE MEMORY
CREATE TABLE t1(a int) TABLESPACE ts STORAGE MEMORY ENGINE=MyISAM;
SHOW CREATE TABLE t1;
DROP TABLE t1;
# STORAGE MEMORY only
CREATE TABLE t1(a int) STORAGE MEMORY ENGINE=MyISAM;
SHOW CREATE TABLE t1;
DROP TABLE t1;
# STORAGE DISK only
CREATE TABLE t1(a int) STORAGE DISK ENGINE=MyISAM;
SHOW CREATE TABLE t1;
DROP TABLE t1;
#
# Check that the table options for TABLESPACE and STORAGE
# are kept in an ALTER
#
# TABLESPACE only
CREATE TABLE t1(a int) TABLESPACE ts ENGINE=MyISAM;
ALTER TABLE t1 ADD COLUMN b int;
SHOW CREATE TABLE t1;
DROP TABLE t1;
# TABLESPACE and STORAGE DISK
CREATE TABLE t1(a int) TABLESPACE ts STORAGE DISK ENGINE=MyISAM;
ALTER TABLE t1 ADD COLUMN b int;
SHOW CREATE TABLE t1;
DROP TABLE t1;
#
# Check that the table options for TABLESPACE and STORAGE
# can be changed with an ALTER
#
# TABLESPACE only
CREATE TABLE t1(a int) ENGINE=MyISAM;
ALTER TABLE t1 TABLESPACE ts;
SHOW CREATE TABLE t1;
ALTER TABLE t1 TABLESPACE ts2;
SHOW CREATE TABLE t1;
DROP TABLE t1;
# STORAGE only
CREATE TABLE t1(a int) ENGINE=MyISAM;
ALTER TABLE t1 STORAGE MEMORY;
SHOW CREATE TABLE t1;
ALTER TABLE t1 STORAGE DISK;
SHOW CREATE TABLE t1;
DROP TABLE t1;
# TABLESPACE and STORAGE
CREATE TABLE t1(a int) ENGINE=MyISAM;
ALTER TABLE t1 STORAGE MEMORY TABLESPACE ts;
SHOW CREATE TABLE t1;
ALTER TABLE t1 STORAGE DISK TABLESPACE ts2;
SHOW CREATE TABLE t1;
DROP TABLE t1;
#
# Check that it's possible to read a .frm fle created
# by MySQL Cluster 7.0(which introduced the new "format
# section) with this statement:
#
# CREATE TABLE cluster_7022_table
# (
# a int primary key,
# b int,
# c int STORAGE DISK,
# d int STORAGE MEMORY NOT NULL,
# e int COLUMN_FORMAT DYNAMIC,
# f int COLUMN_FORMAT FIXED,
# g int COLUMN_FORMAT DEFAULT,
# h int STORAGE DISK COLUMN_FORMAT DYNAMIC NOT NULL,
# i int STORAGE MEMORY COLUMN_FORMAT DYNAMIC,
# j int STORAGE DISK COLUMN_FORMAT FIXED,
# k int STORAGE MEMORY COLUMN_FORMAT FIXED
# ) STORAGE DISK TABLESPACE the_tablespacename ENGINE=MyISAM;
#
# NOTE! The column level properties will not yet show up
# in SHOW CREATE TABLE of MySQL Server(although they are
# visible in .trace file)
#
let $MYSQLD_DATADIR= `SELECT @@datadir`;
copy_file std_data/cluster_7022_table.frm $MYSQLD_DATADIR/test/t1.frm;
copy_file std_data/cluster_7022_table.MYD $MYSQLD_DATADIR/test/t1.MYD;
copy_file std_data/cluster_7022_table.MYI $MYSQLD_DATADIR/test/t1.MYI;
SHOW CREATE TABLE t1;
DROP TABLE t1;

File diff suppressed because one or more lines are too long

View file

@ -1286,12 +1286,26 @@ SET @@global.key_cache_block_size=0;
#
select @@max_long_data_size;
--echo #
--echo # Bug#11766424 59527: DECIMAL_BIN_SIZE: ASSERTION `SCALE >= 0 && PRECISION > 0 && SCALE <= PRE
--echo #
CREATE TABLE t1(f1 DECIMAL(1,1) UNSIGNED);
INSERT INTO t1 VALUES (0.2),(0.1);
SELECT 1 FROM t1 GROUP BY @a:= (SELECT ROUND(f1) FROM t1 WHERE @a=f1);
DROP TABLE t1;
CREATE TABLE t1 AS SELECT @a:= CAST(1 AS UNSIGNED) AS a;
SHOW CREATE TABLE t1;
DROP TABLE t1;
# cleanup
SET @@global.max_binlog_cache_size=DEFAULT;
SET @@global.max_join_size=DEFAULT;
SET @@global.key_buffer_size=@kbs;
SET @@global.key_cache_block_size=@kcbs;
--echo End of 5.1 tests
###########################################################################

View file

@ -23,8 +23,8 @@ SET(MYSYS_SOURCES array.c charset-def.c charset.c checksum.c default.c
mf_tempfile.c mf_unixpath.c mf_wcomp.c mulalloc.c my_access.c
my_aes.c my_alloc.c my_bit.c my_bitmap.c my_chsize.c
my_compress.c my_copy.c my_create.c my_delete.c
my_div.c my_error.c my_file.c my_fopen.c my_fstream.c my_gethostbyname.c
my_gethwaddr.c my_getopt.c my_getsystime.c my_getwd.c my_handler.c my_init.c
my_div.c my_error.c my_file.c my_fopen.c my_fstream.c
my_gethwaddr.c my_getopt.c my_getsystime.c my_getwd.c my_compare.c my_init.c
my_lib.c my_lock.c my_malloc.c my_mess.c
my_mkdir.c my_mmap.c my_once.c my_open.c my_pread.c my_pthread.c
my_quick.c my_read.c my_redel.c my_rename.c my_seek.c my_sleep.c
@ -64,11 +64,6 @@ IF(HAVE_MLOCK)
SET(MYSYS_SOURCES ${MYSYS_SOURCES} my_lockmem.c)
ENDIF()
IF(UNIX)
# some workarounds
SET(MYSYS_SOURCES ${MYSYS_SOURCES} my_port.c)
ENDIF()
ADD_CONVENIENCE_LIBRARY(mysys ${MYSYS_SOURCES})
TARGET_LINK_LIBRARIES(mysys dbug strings ${ZLIB_LIBRARY}
${LIBNSL} ${LIBM} ${LIBRT})

View file

@ -1,28 +1,24 @@
/* Copyright (C) 2002-2006 MySQL AB
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; version 2
of the License.
This library is distributed in the hope that it will be useful,
/* Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; version 2 of the License.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public
License along with this library; if not, write to the Free
Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
MA 02111-1307, USA */
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
#include <my_global.h>
#include <m_ctype.h>
#include <my_base.h>
#include <my_handler.h>
#include <my_compare.h>
#include <my_sys.h>
#include "my_handler_errors.h"
#define CMP_NUM(a,b) (((a) < (b)) ? -1 : ((a) == (b)) ? 0 : 1)
int ha_compare_text(CHARSET_INFO *charset_info, uchar *a, uint a_length,
@ -478,127 +474,3 @@ end:
} /* ha_key_cmp */
/*
Find the first NULL value in index-suffix values tuple
SYNOPSIS
ha_find_null()
keyseg Array of keyparts for key suffix
a Key suffix value tuple
DESCRIPTION
Find the first NULL value in index-suffix values tuple.
TODO
Consider optimizing this function or its use so we don't search for
NULL values in completely NOT NULL index suffixes.
RETURN
First key part that has NULL as value in values tuple, or the last key
part (with keyseg->type==HA_TYPE_END) if values tuple doesn't contain
NULLs.
*/
HA_KEYSEG *ha_find_null(HA_KEYSEG *keyseg, uchar *a)
{
for (; (enum ha_base_keytype) keyseg->type != HA_KEYTYPE_END; keyseg++)
{
uchar *end;
if (keyseg->null_bit)
{
if (!*a++)
return keyseg;
}
end= a+ keyseg->length;
switch ((enum ha_base_keytype) keyseg->type) {
case HA_KEYTYPE_TEXT:
case HA_KEYTYPE_BINARY:
case HA_KEYTYPE_BIT:
if (keyseg->flag & HA_SPACE_PACK)
{
int a_length;
get_key_length(a_length, a);
a += a_length;
break;
}
else
a= end;
break;
case HA_KEYTYPE_VARTEXT1:
case HA_KEYTYPE_VARTEXT2:
case HA_KEYTYPE_VARBINARY1:
case HA_KEYTYPE_VARBINARY2:
{
int a_length;
get_key_length(a_length, a);
a+= a_length;
break;
}
case HA_KEYTYPE_NUM:
if (keyseg->flag & HA_SPACE_PACK)
{
int alength= *a++;
end= a+alength;
}
a= end;
break;
case HA_KEYTYPE_INT8:
case HA_KEYTYPE_SHORT_INT:
case HA_KEYTYPE_USHORT_INT:
case HA_KEYTYPE_LONG_INT:
case HA_KEYTYPE_ULONG_INT:
case HA_KEYTYPE_INT24:
case HA_KEYTYPE_UINT24:
#ifdef HAVE_LONG_LONG
case HA_KEYTYPE_LONGLONG:
case HA_KEYTYPE_ULONGLONG:
#endif
case HA_KEYTYPE_FLOAT:
case HA_KEYTYPE_DOUBLE:
a= end;
break;
case HA_KEYTYPE_END: /* purecov: inspected */
/* keep compiler happy */
DBUG_ASSERT(0);
break;
}
}
return keyseg;
}
/*
Register handler error messages for usage with my_error()
NOTES
This is safe to call multiple times as my_error_register()
will ignore calls to register already registered error numbers.
*/
static const char **get_handler_error_messages()
{
return handler_error_messages;
}
void my_handler_error_register(void)
{
/*
If you got compilation error here about compile_time_assert array, check
that every HA_ERR_xxx constant has a corresponding error message in
handler_error_messages[] list (check mysys/ma_handler_errors.h and
include/my_base.h).
*/
compile_time_assert(HA_ERR_FIRST + array_elements(handler_error_messages) ==
HA_ERR_LAST + 1);
my_error_register(get_handler_error_messages, HA_ERR_FIRST,
HA_ERR_FIRST+ array_elements(handler_error_messages)-1);
}
void my_handler_error_unregister(void)
{
my_error_unregister(HA_ERR_FIRST,
HA_ERR_FIRST+ array_elements(handler_error_messages)-1);
}

View file

@ -1,111 +0,0 @@
/* Copyright (C) 2002, 2004 MySQL AB, 2008-2009 Sun Microsystems, Inc
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; version 2
of the License.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public
License along with this library; if not, write to the Free
Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
MA 02111-1307, USA */
/* Thread safe version of gethostbyname_r() */
#include "mysys_priv.h"
#if !defined(__WIN__)
#include <netdb.h>
#endif
#include <my_net.h>
/* This file is not needed if my_gethostbyname_r is a macro */
#if !defined(my_gethostbyname_r)
/*
Emulate SOLARIS style calls, not because it's better, but just to make the
usage of getbostbyname_r simpler.
*/
#if defined(HAVE_GETHOSTBYNAME_R)
#if defined(HAVE_GETHOSTBYNAME_R_GLIBC2_STYLE)
struct hostent *my_gethostbyname_r(const char *name,
struct hostent *result, char *buffer,
int buflen, int *h_errnop)
{
struct hostent *hp;
DBUG_ASSERT((size_t) buflen >= sizeof(*result));
if (gethostbyname_r(name,result, buffer, (size_t) buflen, &hp, h_errnop))
return 0;
return hp;
}
#elif defined(HAVE_GETHOSTBYNAME_R_RETURN_INT)
struct hostent *my_gethostbyname_r(const char *name,
struct hostent *result, char *buffer,
int buflen, int *h_errnop)
{
if (gethostbyname_r(name,result,(struct hostent_data *) buffer) == -1)
{
*h_errnop= errno;
return 0;
}
return result;
}
#else
/* gethostbyname_r with similar interface as gethostbyname() */
struct hostent *my_gethostbyname_r(const char *name,
struct hostent *result, char *buffer,
int buflen, int *h_errnop)
{
struct hostent *hp;
DBUG_ASSERT(buflen >= sizeof(struct hostent_data));
hp= gethostbyname_r(name,result,(struct hostent_data *) buffer);
*h_errnop= errno;
return hp;
}
#endif /* GLIBC2_STYLE_GETHOSTBYNAME_R */
#else /* !HAVE_GETHOSTBYNAME_R */
extern mysql_mutex_t LOCK_gethostbyname_r;
/*
No gethostbyname_r() function exists.
In this case we have to keep a mutex over the call to ensure that no
other thread is going to reuse the internal memory.
The user is responsible to call my_gethostbyname_r_free() when he
is finished with the structure.
*/
struct hostent *my_gethostbyname_r(const char *name,
struct hostent *res __attribute__((unused)),
char *buffer __attribute__((unused)),
int buflen __attribute__((unused)),
int *h_errnop)
{
struct hostent *hp;
mysql_mutex_lock(&LOCK_gethostbyname_r);
hp= gethostbyname(name);
*h_errnop= h_errno;
return hp;
}
void my_gethostbyname_r_free()
{
mysql_mutex_unlock(&LOCK_gethostbyname_r);
}
#endif /* !HAVE_GETHOSTBYNAME_R */
#endif /* !my_gethostbyname_r */

View file

@ -68,4 +68,8 @@ static const char *handler_error_messages[]=
"Too many active concurrent transactions"
};
extern void my_handler_error_register(void);
extern void my_handler_error_unregister(void);
#endif /* MYSYS_MY_HANDLER_ERRORS_INCLUDED */

View file

@ -1,40 +0,0 @@
/* Copyright (C) 2002 MySQL AB
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; version 2
of the License.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public
License along with this library; if not, write to the Free
Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
MA 02111-1307, USA */
/*
Small functions to make code portable
*/
#include "mysys_priv.h"
#ifdef _AIX
/*
On AIX, at least with gcc 3.1, the expression
'(double) (ulonglong) var' doesn't always work for big unsigned
integers like '18446744073709551615'. The end result is that the
high bit is simply dropped. (probably bug in gcc optimizations)
Handling the conversion in a sub function seems to work.
*/
double my_ulonglong2double(unsigned long long nr)
{
return (double) nr;
}
#endif /* _AIX */

View file

@ -29,7 +29,7 @@
#include "sql_cache.h"
#include "structs.h" /* SHOW_COMP_OPTION */
#include <my_handler.h>
#include <my_compare.h>
#include <ft_global.h>
#include <keycache.h>

View file

@ -997,8 +997,12 @@ bool Item::get_date(MYSQL_TIME *ltime,uint fuzzydate)
}
else
{
longlong value= val_int();
int was_cut;
longlong value= val_int();
if (null_value)
goto err;
if (number_to_datetime(value, ltime, fuzzydate, &was_cut) == LL(-1))
{
char buff[22], *end;

View file

@ -505,7 +505,10 @@ bool Item_func::is_expensive_processor(uchar *arg)
my_decimal *Item_func::val_decimal(my_decimal *decimal_value)
{
DBUG_ASSERT(fixed);
int2my_decimal(E_DEC_FATAL_ERROR, val_int(), unsigned_flag, decimal_value);
longlong nr= val_int();
if (null_value)
return 0; /* purecov: inspected */
int2my_decimal(E_DEC_FATAL_ERROR, nr, unsigned_flag, decimal_value);
return decimal_value;
}
@ -2088,9 +2091,10 @@ void Item_func_integer::fix_length_and_dec()
void Item_func_int_val::fix_num_length_and_dec()
{
max_length= args[0]->max_length - (args[0]->decimals ?
args[0]->decimals + 1 :
0) + 2;
ulonglong tmp_max_length= (ulonglong ) args[0]->max_length -
(args[0]->decimals ? args[0]->decimals + 1 : 0) + 2;
max_length= tmp_max_length > (ulonglong) 4294967295U ?
(uint32) 4294967295U : (uint32) tmp_max_length;
uint tmp= float_length(decimals);
set_if_smaller(max_length,tmp);
decimals= 0;
@ -4261,6 +4265,7 @@ Item_func_set_user_var::fix_length_and_dec()
fix_length_and_charset(args[0]->max_char_length(),
args[0]->collation.collation);
}
unsigned_flag= args[0]->unsigned_flag;
}

View file

@ -315,8 +315,8 @@ static bool extract_date_time(DATE_TIME_FORMAT *format,
for (; ptr != end && val != val_end; ptr++)
{
/* Skip pre-space between each argument */
while (val != val_end && my_isspace(cs, *val))
val++;
if ((val+= cs->cset->scan(cs, val, val_end, MY_SEQ_SPACES)) >= val_end)
break;
if (*ptr == '%' && ptr+1 != end)
{
@ -3405,6 +3405,7 @@ void Item_func_str_to_date::fix_length_and_dec()
{
maybe_null= 1;
decimals=0;
cached_format_type= DATE_TIME;
cached_field_type= MYSQL_TYPE_DATETIME;
max_length= MAX_DATETIME_FULL_WIDTH*MY_CHARSET_BIN_MB_MAXLEN;
cached_timestamp_type= MYSQL_TIMESTAMP_NONE;

View file

@ -144,8 +144,11 @@ public:
{ DBUG_ASSERT(fixed == 1); return (double) Item_func_month::val_int(); }
String *val_str(String *str)
{
str->set(val_int(), collation.collation);
return null_value ? 0 : str;
longlong nr= val_int();
if (null_value)
return 0;
str->set(nr, collation.collation);
return str;
}
const char *func_name() const { return "month"; }
enum Item_result result_type () const { return INT_RESULT; }

View file

@ -9052,7 +9052,19 @@ static bool record_compare(TABLE *table)
}
}
if (table->s->blob_fields + table->s->varchar_fields == 0)
/**
Compare full record only if:
- there are no blob fields (otherwise we would also need
to compare blobs contents as well);
- there are no varchar fields (otherwise we would also need
to compare varchar contents as well);
- there are no null fields, otherwise NULLed fields
contents (i.e., the don't care bytes) may show arbitrary
values, depending on how each engine handles internally.
*/
if ((table->s->blob_fields +
table->s->varchar_fields +
table->s->null_fields) == 0)
{
result= cmp_record(table,record[1]);
goto record_compare_exit;
@ -9067,13 +9079,22 @@ static bool record_compare(TABLE *table)
goto record_compare_exit;
}
/* Compare updated fields */
/* Compare fields */
for (Field **ptr=table->field ; *ptr ; ptr++)
{
if ((*ptr)->cmp_binary_offset(table->s->rec_buff_length))
/**
We only compare field contents that are not null.
NULL fields (i.e., their null bits) were compared
earlier.
*/
if (!(*(ptr))->is_null())
{
result= TRUE;
goto record_compare_exit;
if ((*ptr)->cmp_binary_offset(table->s->rec_buff_length))
{
result= TRUE;
goto record_compare_exit;
}
}
}

View file

@ -7282,6 +7282,14 @@ static int get_options(int *argc_ptr, char ***argv_ptr)
opt_log_slow_slave_statements) &&
!opt_slow_log)
sql_print_warning("options --log-slow-admin-statements, --log-queries-not-using-indexes and --log-slow-slave-statements have no effect if --log_slow_queries is not set");
if (global_system_variables.net_buffer_length >
global_system_variables.max_allowed_packet)
{
sql_print_warning("net_buffer_length (%lu) is set to be larger "
"than max_allowed_packet (%lu). Please rectify.",
global_system_variables.net_buffer_length,
global_system_variables.max_allowed_packet);
}
if (log_error_file_ptr != disabled_my_option)
opt_error_log= 1;

View file

@ -6402,3 +6402,6 @@ ER_MULTI_UPDATE_KEY_CONFLICT
# message as mysqlcheck parses the error message looking for ALTER TABLE.
ER_TABLE_NEEDS_REBUILD
eng "Table rebuild required. Please do \"ALTER TABLE `%-.32s` FORCE\" or dump/reload to fix it!"
WARN_OPTION_BELOW_LIMIT
eng "The value of '%s' should be no less than the value of '%s'"

View file

@ -1379,17 +1379,24 @@ int store_create_info(THD *thd, TABLE_LIST *table_list, String *packet,
if (!(thd->variables.sql_mode & MODE_NO_TABLE_OPTIONS) && !foreign_db_mode)
{
show_table_options= TRUE;
/*
Get possible table space definitions and append them
to the CREATE TABLE statement
*/
if ((for_str= file->get_tablespace_name(thd,0,0)))
/* TABLESPACE and STORAGE */
if (share->tablespace ||
share->default_storage_media != HA_SM_DEFAULT)
{
packet->append(STRING_WITH_LEN(" /*!50100 TABLESPACE "));
packet->append(for_str, strlen(for_str));
packet->append(STRING_WITH_LEN(" STORAGE DISK */"));
my_free(for_str);
packet->append(STRING_WITH_LEN(" /*!50100"));
if (share->tablespace)
{
packet->append(STRING_WITH_LEN(" TABLESPACE "));
packet->append(share->tablespace, strlen(share->tablespace));
}
if (share->default_storage_media == HA_SM_DISK)
packet->append(STRING_WITH_LEN(" STORAGE DISK"));
if (share->default_storage_media == HA_SM_MEMORY)
packet->append(STRING_WITH_LEN(" STORAGE MEMORY"));
packet->append(STRING_WITH_LEN(" */"));
}
/*
@ -5496,12 +5503,9 @@ static void store_schema_partitions_record(THD *thd, TABLE *schema_table,
strlen(part_elem->tablespace_name), cs);
else
{
char *ts= showing_table->file->get_tablespace_name(thd,0,0);
char *ts= showing_table->s->tablespace;
if(ts)
{
table->field[24]->store(ts, strlen(ts), cs);
my_free(ts);
}
else
table->field[24]->set_null();
}

View file

@ -5281,17 +5281,12 @@ mysql_prepare_alter_table(THD *thd, TABLE *table,
if (!(used_fields & HA_CREATE_USED_KEY_BLOCK_SIZE))
create_info->key_block_size= table->s->key_block_size;
if (!create_info->tablespace && create_info->storage_media != HA_SM_MEMORY)
{
char *tablespace= static_cast<char *>(thd->alloc(FN_LEN + 1));
/*
Regular alter table of disk stored table (no tablespace/storage change)
Copy tablespace name
*/
if (tablespace &&
(table->file->get_tablespace_name(thd, tablespace, FN_LEN)))
create_info->tablespace= tablespace;
}
if (!create_info->tablespace)
create_info->tablespace= table->s->tablespace;
if (create_info->storage_media == HA_SM_DEFAULT)
create_info->storage_media= table->s->default_storage_media;
restore_record(table, s->default_values); // Empty record for DEFAULT
Create_field *def;

View file

@ -1030,13 +1030,32 @@ static bool session_readonly(sys_var *self, THD *thd, set_var *var)
self->name.str, "GLOBAL");
return true;
}
static bool
check_max_allowed_packet(sys_var *self, THD *thd, set_var *var)
{
longlong val;
if (session_readonly(self, thd, var))
return true;
val= var->save_result.ulonglong_value;
if (val < (longlong) global_system_variables.net_buffer_length)
{
push_warning_printf(thd, MYSQL_ERROR::WARN_LEVEL_WARN,
WARN_OPTION_BELOW_LIMIT, ER(WARN_OPTION_BELOW_LIMIT),
"max_allowed_packet", "net_buffer_length");
}
return false;
}
static Sys_var_ulong Sys_max_allowed_packet(
"max_allowed_packet",
"Max packet length to send to or receive from the server",
SESSION_VAR(max_allowed_packet), CMD_LINE(REQUIRED_ARG),
VALID_RANGE(1024, 1024*1024*1024), DEFAULT(1024*1024),
BLOCK_SIZE(1024), NO_MUTEX_GUARD, NOT_IN_BINLOG,
ON_CHECK(session_readonly));
ON_CHECK(check_max_allowed_packet));
static Sys_var_ulonglong Sys_max_binlog_cache_size(
"max_binlog_cache_size",
@ -1267,12 +1286,29 @@ static Sys_var_mybool Sys_named_pipe(
DEFAULT(FALSE));
#endif
static bool
check_net_buffer_length(sys_var *self, THD *thd, set_var *var)
{
longlong val;
if (session_readonly(self, thd, var))
return true;
val= var->save_result.ulonglong_value;
if (val > (longlong) global_system_variables.max_allowed_packet)
{
push_warning_printf(thd, MYSQL_ERROR::WARN_LEVEL_WARN,
WARN_OPTION_BELOW_LIMIT, ER(WARN_OPTION_BELOW_LIMIT),
"max_allowed_packet", "net_buffer_length");
}
return false;
}
static Sys_var_ulong Sys_net_buffer_length(
"net_buffer_length",
"Buffer length for TCP/IP and socket communication",
SESSION_VAR(net_buffer_length), CMD_LINE(REQUIRED_ARG),
VALID_RANGE(1024, 1024*1024), DEFAULT(16384), BLOCK_SIZE(1024),
NO_MUTEX_GUARD, NOT_IN_BINLOG, ON_CHECK(session_readonly));
NO_MUTEX_GUARD, NOT_IN_BINLOG, ON_CHECK(check_net_buffer_length));
static bool fix_net_read_timeout(sys_var *self, THD *thd, enum_var_type type)
{
@ -2766,7 +2802,7 @@ static Sys_var_charptr Sys_slow_log_path(
ON_CHECK(check_log_path), ON_UPDATE(fix_slow_log_file));
/// @todo deprecate these four legacy have_PLUGIN variables and use I_S instead
export SHOW_COMP_OPTION have_csv, have_innodb;
export SHOW_COMP_OPTION have_csv, have_innodb= SHOW_OPTION_DISABLED;
export SHOW_COMP_OPTION have_ndbcluster, have_partitioning;
static Sys_var_have Sys_have_csv(
"have_csv", "have_csv",

View file

@ -750,6 +750,9 @@ static int open_binary_frm(THD *thd, TABLE_SHARE *share, uchar *head,
const char **interval_array;
enum legacy_db_type legacy_db_type;
my_bitmap_map *bitmaps;
uchar *extra_segment_buff= 0;
const uint format_section_header_size= 8;
uchar *format_section_fields= 0;
DBUG_ENTER("open_binary_frm");
new_field_pack_flag= head[27];
@ -942,27 +945,27 @@ static int open_binary_frm(THD *thd, TABLE_SHARE *share, uchar *head,
if ((n_length= uint4korr(head+55)))
{
/* Read extra data segment */
uchar *buff, *next_chunk, *buff_end;
uchar *next_chunk, *buff_end;
DBUG_PRINT("info", ("extra segment size is %u bytes", n_length));
if (!(next_chunk= buff= (uchar*) my_malloc(n_length, MYF(MY_WME))))
if (!(extra_segment_buff= (uchar*) my_malloc(n_length, MYF(MY_WME))))
goto err;
if (mysql_file_pread(file, buff, n_length, record_offset + share->reclength,
next_chunk= extra_segment_buff;
if (mysql_file_pread(file, extra_segment_buff,
n_length, record_offset + share->reclength,
MYF(MY_NABP)))
{
my_free(buff);
goto err;
}
share->connect_string.length= uint2korr(buff);
share->connect_string.length= uint2korr(next_chunk);
if (!(share->connect_string.str= strmake_root(&share->mem_root,
(char*) next_chunk + 2,
share->connect_string.
length)))
{
my_free(buff);
goto err;
}
next_chunk+= share->connect_string.length + 2;
buff_end= buff + n_length;
buff_end= extra_segment_buff + n_length;
if (next_chunk + 2 < buff_end)
{
uint str_db_type_length= uint2korr(next_chunk);
@ -979,7 +982,6 @@ static int open_binary_frm(THD *thd, TABLE_SHARE *share, uchar *head,
plugin_data(tmp_plugin, handlerton *)))
{
/* bad file, legacy_db_type did not match the name */
my_free(buff);
goto err;
}
/*
@ -1009,7 +1011,6 @@ static int open_binary_frm(THD *thd, TABLE_SHARE *share, uchar *head,
error= 8;
my_error(ER_OPTION_PREVENTS_STATEMENT, MYF(0),
"--skip-partition");
my_free(buff);
goto err;
}
plugin_unlock(NULL, share->db_plugin);
@ -1025,7 +1026,6 @@ static int open_binary_frm(THD *thd, TABLE_SHARE *share, uchar *head,
error= 8;
name.str[name.length]=0;
my_error(ER_UNKNOWN_STORAGE_ENGINE, MYF(0), name.str);
my_free(buff);
goto err;
/* purecov: end */
}
@ -1042,7 +1042,6 @@ static int open_binary_frm(THD *thd, TABLE_SHARE *share, uchar *head,
memdup_root(&share->mem_root, next_chunk + 4,
partition_info_str_len + 1)))
{
my_free(buff);
goto err;
}
}
@ -1050,7 +1049,6 @@ static int open_binary_frm(THD *thd, TABLE_SHARE *share, uchar *head,
if (partition_info_str_len)
{
DBUG_PRINT("info", ("WITH_PARTITION_STORAGE_ENGINE is not defined"));
my_free(buff);
goto err;
}
#endif
@ -1088,7 +1086,6 @@ static int open_binary_frm(THD *thd, TABLE_SHARE *share, uchar *head,
{
DBUG_PRINT("error",
("fulltext key uses parser that is not defined in .frm"));
my_free(buff);
goto err;
}
parser_name.str= (char*) next_chunk;
@ -1099,7 +1096,6 @@ static int open_binary_frm(THD *thd, TABLE_SHARE *share, uchar *head,
if (! keyinfo->parser)
{
my_error(ER_PLUGIN_IS_NOT_LOADED, MYF(0), parser_name.str);
my_free(buff);
goto err;
}
}
@ -1111,19 +1107,68 @@ static int open_binary_frm(THD *thd, TABLE_SHARE *share, uchar *head,
{
DBUG_PRINT("error",
("long table comment is not defined in .frm"));
my_free(buff);
goto err;
}
share->comment.length = uint2korr(next_chunk);
if (! (share->comment.str= strmake_root(&share->mem_root,
(char*)next_chunk + 2, share->comment.length)))
{
my_free(buff);
goto err;
}
next_chunk+= 2 + share->comment.length;
}
my_free(buff);
if (next_chunk + format_section_header_size < buff_end)
{
/*
New extra data segment called "format section" with additional
table and column properties introduced by MySQL Cluster
based on 5.1.20
Table properties:
TABLESPACE <ts> and STORAGE [DISK|MEMORY]
Column properties:
COLUMN_FORMAT [DYNAMIC|FIXED] and STORAGE [DISK|MEMORY]
*/
DBUG_PRINT("info", ("Found format section"));
/* header */
const uint format_section_length= uint2korr(next_chunk);
const uint format_section_flags= uint4korr(next_chunk+2);
/* 2 bytes unused */
if (next_chunk + format_section_length > buff_end)
{
DBUG_PRINT("error", ("format section length too long: %u",
format_section_length));
goto err;
}
DBUG_PRINT("info", ("format_section_length: %u, format_section_flags: %u",
format_section_length, format_section_flags));
share->default_storage_media=
(enum ha_storage_media) (format_section_flags & 0x7);
/* tablespace */
const char *tablespace=
(const char*)next_chunk + format_section_header_size;
const uint tablespace_length= strlen(tablespace);
if (tablespace_length &&
!(share->tablespace= strmake_root(&share->mem_root,
tablespace, tablespace_length+1)))
{
goto err;
}
DBUG_PRINT("info", ("tablespace: '%s'",
share->tablespace ? share->tablespace : "<null>"));
/* pointer to format section for fields */
format_section_fields=
next_chunk + format_section_header_size + tablespace_length + 1;
next_chunk+= format_section_length;
}
}
share->key_block_size= uint2korr(head+62);
@ -1438,6 +1483,18 @@ static int open_binary_frm(THD *thd, TABLE_SHARE *share, uchar *head,
error= 8;
goto err;
}
if (format_section_fields)
{
const uchar field_flags= format_section_fields[i];
const uchar field_storage= (field_flags & STORAGE_TYPE_MASK);
const uchar field_column_format=
((field_flags >> COLUMN_FORMAT_SHIFT)& COLUMN_FORMAT_MASK);
DBUG_PRINT("debug", ("field flags: %u, storage: %u, column_format: %u",
field_flags, field_storage, field_column_format));
(void)field_storage; /* Reserved by and used in MySQL Cluster */
(void)field_column_format; /* Reserved by and used in MySQL Cluster */
}
}
*field_ptr=0; // End marker
@ -1705,6 +1762,7 @@ static int open_binary_frm(THD *thd, TABLE_SHARE *share, uchar *head,
if (use_hash)
(void) my_hash_check(&share->name_hash);
#endif
my_free(extra_segment_buff);
DBUG_RETURN (0);
err:
@ -1712,6 +1770,7 @@ static int open_binary_frm(THD *thd, TABLE_SHARE *share, uchar *head,
share->open_errno= my_errno;
share->errarg= errarg;
my_free(disk_buff);
my_free(extra_segment_buff);
delete crypted;
delete handler_file;
my_hash_free(&share->name_hash);
@ -2687,6 +2746,8 @@ void update_create_info_from_table(HA_CREATE_INFO *create_info, TABLE *table)
create_info->default_table_charset= share->table_charset;
create_info->table_charset= 0;
create_info->comment= share->comment;
create_info->storage_media= share->default_storage_media;
create_info->tablespace= share->tablespace;
DBUG_VOID_RETURN;
}

View file

@ -651,6 +651,16 @@ struct TABLE_SHARE
*/
int cached_row_logging_check;
/*
Storage media to use for this table (unless another storage
media has been specified on an individual column - in versions
where that is supported)
*/
enum ha_storage_media default_storage_media;
/* Name of the tablespace used for this table */
char *tablespace;
#ifdef WITH_PARTITION_STORAGE_ENGINE
/* filled in when reading from frm */
bool auto_partitioned;

View file

@ -124,6 +124,9 @@ bool mysql_create_frm(THD *thd, const char *file_name,
#endif
Pack_header_error_handler pack_header_error_handler;
int error;
const uint format_section_header_size= 8;
uint format_section_length;
uint tablespace_length= 0;
DBUG_ENTER("mysql_create_frm");
DBUG_ASSERT(*fn_rext((char*)file_name)); // Check .frm extension
@ -256,6 +259,18 @@ bool mysql_create_frm(THD *thd, const char *file_name,
forminfo[46]=(uchar) create_info->comment.length;
}
/*
Add room in extra segment for "format section" with additional
table and column properties
*/
if (create_info->tablespace)
tablespace_length= strlen(create_info->tablespace);
format_section_length=
format_section_header_size +
tablespace_length + 1 +
create_fields.elements;
create_info->extra_size+= format_section_length;
if ((file=create_frm(thd, file_name, db, table, reclength, fileinfo,
create_info, keys, key_info)) < 0)
{
@ -353,6 +368,55 @@ bool mysql_create_frm(THD *thd, const char *file_name,
goto err;
}
/* "Format section" with additional table and column properties */
{
uchar *ptr, *format_section_buff;
if (!(format_section_buff=(uchar*) my_malloc(format_section_length,
MYF(MY_WME))))
goto err;
ptr= format_section_buff;
/* header */
const uint format_section_flags=
create_info->storage_media; // 3 bits
const uint format_section_unused= 0;
int2store(ptr+0, format_section_length);
int4store(ptr+2, format_section_flags);
int2store(ptr+6, format_section_unused);
ptr+= format_section_header_size;
/* tablespace name */
if (tablespace_length > 0)
memcpy(ptr, create_info->tablespace, tablespace_length);
ptr+= tablespace_length;
*ptr= 0; /* tablespace string terminating zero */
ptr++;
/* column properties */
Create_field *field;
List_iterator<Create_field> it(create_fields);
while ((field=it++))
{
const uchar field_storage= 0; /* Used in MySQL Cluster */
const uchar field_column_format= 0; /* Used in MySQL Cluster */
const uchar field_flags=
field_storage + (field_column_format << COLUMN_FORMAT_SHIFT);
*ptr= field_flags;
ptr++;
}
DBUG_ASSERT(format_section_buff + format_section_length == ptr);
if (mysql_file_write(file, format_section_buff,
format_section_length, MYF_RW))
{
my_free(format_section_buff);
goto err;
}
DBUG_PRINT("info", ("wrote format section, length: %u",
format_section_length));
my_free(format_section_buff);
}
mysql_file_seek(file, filepos, MY_SEEK_SET, MYF(0));
if (mysql_file_write(file, forminfo, 288, MYF_RW) ||
mysql_file_write(file, screen_buff, info_length, MYF_RW) ||

View file

@ -1,4 +1,4 @@
/* Copyright (C) 2000-2005 MySQL AB
/* Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@ -16,7 +16,7 @@
/* Written by Sergei A. Golubchik, who has a shared copyright to this code */
#include "ftdefs.h"
#include "my_handler.h"
#include "my_compare.h"
static CHARSET_INFO *ft_stopword_cs= NULL;

View file

@ -80,6 +80,7 @@ static SORT_KEY_BLOCKS *alloc_key_blocks(MI_CHECK *param, uint blocks,
uint buffer_length);
static ha_checksum mi_byte_checksum(const uchar *buf, uint length);
static void set_data_file_type(SORT_INFO *sort_info, MYISAM_SHARE *share);
static HA_KEYSEG *ha_find_null(HA_KEYSEG *keyseg, uchar *a);
void myisamchk_init(MI_CHECK *param)
{
@ -4729,3 +4730,92 @@ set_data_file_type(SORT_INFO *sort_info, MYISAM_SHARE *share)
share->delete_record=tmp.delete_record;
}
}
/*
Find the first NULL value in index-suffix values tuple
SYNOPSIS
ha_find_null()
keyseg Array of keyparts for key suffix
a Key suffix value tuple
DESCRIPTION
Find the first NULL value in index-suffix values tuple.
TODO
Consider optimizing this function or its use so we don't search for
NULL values in completely NOT NULL index suffixes.
RETURN
First key part that has NULL as value in values tuple, or the last key
part (with keyseg->type==HA_TYPE_END) if values tuple doesn't contain
NULLs.
*/
static HA_KEYSEG *ha_find_null(HA_KEYSEG *keyseg, uchar *a)
{
for (; (enum ha_base_keytype) keyseg->type != HA_KEYTYPE_END; keyseg++)
{
uchar *end;
if (keyseg->null_bit)
{
if (!*a++)
return keyseg;
}
end= a+ keyseg->length;
switch ((enum ha_base_keytype) keyseg->type) {
case HA_KEYTYPE_TEXT:
case HA_KEYTYPE_BINARY:
case HA_KEYTYPE_BIT:
if (keyseg->flag & HA_SPACE_PACK)
{
int a_length;
get_key_length(a_length, a);
a += a_length;
break;
}
else
a= end;
break;
case HA_KEYTYPE_VARTEXT1:
case HA_KEYTYPE_VARTEXT2:
case HA_KEYTYPE_VARBINARY1:
case HA_KEYTYPE_VARBINARY2:
{
int a_length;
get_key_length(a_length, a);
a+= a_length;
break;
}
case HA_KEYTYPE_NUM:
if (keyseg->flag & HA_SPACE_PACK)
{
int alength= *a++;
end= a+alength;
}
a= end;
break;
case HA_KEYTYPE_INT8:
case HA_KEYTYPE_SHORT_INT:
case HA_KEYTYPE_USHORT_INT:
case HA_KEYTYPE_LONG_INT:
case HA_KEYTYPE_ULONG_INT:
case HA_KEYTYPE_INT24:
case HA_KEYTYPE_UINT24:
#ifdef HAVE_LONG_LONG
case HA_KEYTYPE_LONGLONG:
case HA_KEYTYPE_ULONGLONG:
#endif
case HA_KEYTYPE_FLOAT:
case HA_KEYTYPE_DOUBLE:
a= end;
break;
case HA_KEYTYPE_END: /* purecov: inspected */
/* keep compiler happy */
DBUG_ASSERT(0);
break;
}
}
return keyseg;
}