summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--client/mysql.cc39
-rw-r--r--mysql-test/r/grant.result1
-rw-r--r--mysql-test/r/grant2.result10
-rw-r--r--mysql-test/r/heap_btree.result35
-rw-r--r--mysql-test/r/mysql_client.result48
-rw-r--r--mysql-test/r/mysqldump.result9
-rw-r--r--mysql-test/r/repair.result15
-rw-r--r--mysql-test/t/grant.test2
-rw-r--r--mysql-test/t/grant2.test18
-rw-r--r--mysql-test/t/heap_btree.test21
-rw-r--r--mysql-test/t/mysql_client.test6
-rw-r--r--mysql-test/t/mysqldump.test3
-rw-r--r--mysql-test/t/repair.test11
-rw-r--r--scripts/fill_func_tables.sh11
-rw-r--r--scripts/mysql_install_db.sh1
-rw-r--r--sql/field.cc5
-rw-r--r--sql/field.h6
-rw-r--r--sql/set_var.cc3
-rw-r--r--storage/archive/ha_archive.cc22
-rw-r--r--storage/heap/hp_delete.c3
-rw-r--r--storage/myisam/mi_update.c12
-rw-r--r--storage/myisam/sort.c12
22 files changed, 257 insertions, 36 deletions
diff --git a/client/mysql.cc b/client/mysql.cc
index 6b188271174..abd8ed75840 100644
--- a/client/mysql.cc
+++ b/client/mysql.cc
@@ -606,13 +606,13 @@ static struct my_option my_long_options[] =
{"force", 'f', "Continue even if we get an sql error.",
(gptr*) &ignore_errors, (gptr*) &ignore_errors, 0, GET_BOOL, NO_ARG, 0, 0,
0, 0, 0, 0},
- {"no-named-commands", 'g',
- "Named commands are disabled. Use \\* form only, or use named commands only in the beginning of a line ending with a semicolon (;) Since version 10.9 the client now starts with this option ENABLED by default! Disable with '-G'. Long format commands still work from the first line. WARNING: option deprecated; use --disable-named-commands instead.",
- 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
{"named-commands", 'G',
"Enable named commands. Named commands mean this program's internal commands; see mysql> help . When enabled, the named commands can be used from any line of the query, otherwise only from the first line, before an enter. Disable with --disable-named-commands. This option is disabled by default.",
(gptr*) &named_cmds, (gptr*) &named_cmds, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0,
0, 0},
+ {"no-named-commands", 'g',
+ "Named commands are disabled. Use \\* form only, or use named commands only in the beginning of a line ending with a semicolon (;) Since version 10.9 the client now starts with this option ENABLED by default! Disable with '-G'. Long format commands still work from the first line. WARNING: option deprecated; use --disable-named-commands instead.",
+ 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
{"ignore-spaces", 'i', "Ignore space after function names.", 0, 0, 0,
GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
{"local-infile", OPT_LOCAL_INFILE, "Enable/disable LOAD DATA LOCAL INFILE.",
@@ -631,13 +631,6 @@ static struct my_option my_long_options[] =
NO_ARG, 1, 0, 0, 0, 0, 0},
{"skip-line-numbers", 'L', "Don't write line number for errors. WARNING: -L is deprecated, use long version of this option instead.", 0, 0, 0, GET_NO_ARG,
NO_ARG, 0, 0, 0, 0, 0, 0},
-#ifdef USE_POPEN
- {"no-pager", OPT_NOPAGER,
- "Disable pager and print to stdout. See interactive help (\\h) also. WARNING: option deprecated; use --disable-pager instead.",
- 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
-#endif
- {"no-tee", OPT_NOTEE, "Disable outfile. See interactive help (\\h) also. WARNING: option deprecated; use --disable-tee instead", 0, 0, 0, GET_NO_ARG,
- NO_ARG, 0, 0, 0, 0, 0, 0},
{"unbuffered", 'n', "Flush buffer after each query.", (gptr*) &unbuffered,
(gptr*) &unbuffered, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
{"column-names", OPT_COLUMN_NAMES, "Write column names in results.",
@@ -657,8 +650,11 @@ static struct my_option my_long_options[] =
0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
#ifdef USE_POPEN
{"pager", OPT_PAGER,
- "Pager to use to display results. If you don't supply an option the default pager is taken from your ENV variable PAGER. Valid pagers are less, more, cat [> filename], etc. See interactive help (\\h) also. This option does not work in batch mode.",
+ "Pager to use to display results. If you don't supply an option the default pager is taken from your ENV variable PAGER. Valid pagers are less, more, cat [> filename], etc. See interactive help (\\h) also. This option does not work in batch mode. Disable with --disable-pager. This option is disabled by default.",
0, 0, 0, GET_STR, OPT_ARG, 0, 0, 0, 0, 0, 0},
+ {"no-pager", OPT_NOPAGER,
+ "Disable pager and print to stdout. See interactive help (\\h) also. WARNING: option deprecated; use --disable-pager instead.",
+ 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
#endif
{"password", 'p',
"Password to use when connecting to server. If password is not given it's asked from the tty.",
@@ -699,8 +695,10 @@ static struct my_option my_long_options[] =
{"debug-info", 'T', "Print some debug info at exit.", (gptr*) &info_flag,
(gptr*) &info_flag, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
{"tee", OPT_TEE,
- "Append everything into outfile. See interactive help (\\h) also. Does not work in batch mode.",
+ "Append everything into outfile. See interactive help (\\h) also. Does not work in batch mode. Disable with --disable-tee. This option is disabled by default.",
0, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
+ {"no-tee", OPT_NOTEE, "Disable outfile. See interactive help (\\h) also. WARNING: option deprecated; use --disable-tee instead", 0, 0, 0, GET_NO_ARG,
+ NO_ARG, 0, 0, 0, 0, 0, 0},
#ifndef DONT_ALLOW_USER_CHANGE
{"user", 'u', "User for login if not current user.", (gptr*) &current_user,
(gptr*) &current_user, 0, GET_STR_ALLOC, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
@@ -1804,7 +1802,14 @@ static int com_server_help(String *buffer __attribute__((unused)),
if (help_arg[0] != '\'')
{
- (void) strxnmov(cmd_buf, sizeof(cmd_buf), "help '", help_arg, "'", NullS);
+ char *end_arg= strend(help_arg);
+ if(--end_arg)
+ {
+ while (my_isspace(charset_info,*end_arg))
+ end_arg--;
+ *++end_arg= '\0';
+ }
+ (void) strxnmov(cmd_buf, sizeof(cmd_buf), "help '", help_arg, "'", NullS);
server_cmd= cmd_buf;
}
@@ -1890,9 +1895,13 @@ com_help(String *buffer __attribute__((unused)),
{
reg1 int i, j;
char * help_arg= strchr(line,' '), buff[32], *end;
-
if (help_arg)
- return com_server_help(buffer,line,help_arg+1);
+ {
+ while (my_isspace(charset_info,*help_arg))
+ help_arg++;
+ if (*help_arg)
+ return com_server_help(buffer,line,help_arg);
+ }
put_info("\nFor information about MySQL products and services, visit:\n"
" http://www.mysql.com/\n"
diff --git a/mysql-test/r/grant.result b/mysql-test/r/grant.result
index 82775f0735b..2a95b8effcf 100644
--- a/mysql-test/r/grant.result
+++ b/mysql-test/r/grant.result
@@ -426,6 +426,7 @@ revoke all on mysqltest_2.t1 from mysqltest_3@localhost;
revoke all on mysqltest_2.t2 from mysqltest_3@localhost;
grant all on mysqltest_2.* to mysqltest_3@localhost;
grant select on *.* to mysqltest_3@localhost;
+grant select on mysqltest_2.t1 to mysqltest_3@localhost;
flush privileges;
use mysqltest_1;
update mysqltest_2.t1, mysqltest_2.t2 set c=500,d=600;
diff --git a/mysql-test/r/grant2.result b/mysql-test/r/grant2.result
index 12d20978cf9..79ba073a856 100644
--- a/mysql-test/r/grant2.result
+++ b/mysql-test/r/grant2.result
@@ -118,6 +118,16 @@ flush privileges;
drop user mysqltest_3@host3;
drop user mysqltest_1@host1, mysqltest_2@host2, mysqltest_4@host4,
mysqltest_5@host5, mysqltest_6@host6, mysqltest_7@host7;
+create database mysqltest_1;
+grant select, insert, update on `mysqltest\_1`.* to mysqltest_1@localhost;
+set sql_log_off = 1;
+ERROR 42000: Access denied; you need the SUPER privilege for this operation
+set sql_log_bin = 0;
+ERROR 42000: Access denied; you need the SUPER privilege for this operation
+delete from mysql.user where user like 'mysqltest\_1';
+delete from mysql.db where user like 'mysqltest\_1';
+drop database mysqltest_1;
+flush privileges;
set sql_mode='maxdb';
drop table if exists t1, t2;
create table t1(c1 int);
diff --git a/mysql-test/r/heap_btree.result b/mysql-test/r/heap_btree.result
index 4c7ea0eae7b..32c8028679f 100644
--- a/mysql-test/r/heap_btree.result
+++ b/mysql-test/r/heap_btree.result
@@ -246,6 +246,41 @@ DELETE from t1 where a < 100;
SELECT * from t1;
a
DROP TABLE t1;
+create table t1(a int not null, key using btree(a)) engine=heap;
+insert into t1 values (2), (2), (2), (1), (1), (3), (3), (3), (3);
+select a from t1 where a > 2 order by a;
+a
+3
+3
+3
+3
+delete from t1 where a < 4;
+select a from t1 order by a;
+a
+insert into t1 values (2), (2), (2), (1), (1), (3), (3), (3), (3);
+select a from t1 where a > 4 order by a;
+a
+delete from t1 where a > 4;
+select a from t1 order by a;
+a
+1
+1
+2
+2
+2
+3
+3
+3
+3
+select a from t1 where a > 3 order by a;
+a
+delete from t1 where a >= 2;
+select a from t1 order by a;
+a
+1
+1
+drop table t1;
+End of 4.1 tests
CREATE TABLE t1(val INT, KEY USING BTREE(val)) ENGINE=memory;
INSERT INTO t1 VALUES(0);
SELECT INDEX_LENGTH FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA=DATABASE() AND TABLE_NAME='t1';
diff --git a/mysql-test/r/mysql_client.result b/mysql-test/r/mysql_client.result
index a20bd60aaf3..01a8c731bc9 100644
--- a/mysql-test/r/mysql_client.result
+++ b/mysql-test/r/mysql_client.result
@@ -2,6 +2,54 @@
1
ERROR 1064 (42000) at line 3: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1
ERROR at line 1: USE must be followed by a database name
+? (\?) Synonym for `help'.
+clear (\c) Clear command.
+connect (\r) Reconnect to the server. Optional arguments are db and host.
+delimiter (\d) Set statement delimiter. NOTE: Takes the rest of the line as new delimiter.
+edit (\e) Edit command with $EDITOR.
+ego (\G) Send command to mysql server, display result vertically.
+exit (\q) Exit mysql. Same as quit.
+go (\g) Send command to mysql server.
+help (\h) Display this help.
+nopager (\n) Disable pager, print to stdout.
+notee (\t) Don't write into outfile.
+pager (\P) Set PAGER [to_pager]. Print the query results via PAGER.
+print (\p) Print current command.
+prompt (\R) Change your mysql prompt.
+quit (\q) Quit mysql.
+rehash (\#) Rebuild completion hash.
+source (\.) Execute an SQL script file. Takes a file name as an argument.
+status (\s) Get status information from the server.
+system (\!) Execute a system shell command.
+tee (\T) Set outfile [to_outfile]. Append everything into given outfile.
+use (\u) Use another database. Takes database name as argument.
+charset (\C) Switch to another charset. Might be needed for processing binlog with multi-byte charsets.
+warnings (\W) Show warnings after every statement.
+nowarning (\w) Don't show warnings after every statement.
+? (\?) Synonym for `help'.
+clear (\c) Clear command.
+connect (\r) Reconnect to the server. Optional arguments are db and host.
+delimiter (\d) Set statement delimiter. NOTE: Takes the rest of the line as new delimiter.
+edit (\e) Edit command with $EDITOR.
+ego (\G) Send command to mysql server, display result vertically.
+exit (\q) Exit mysql. Same as quit.
+go (\g) Send command to mysql server.
+help (\h) Display this help.
+nopager (\n) Disable pager, print to stdout.
+notee (\t) Don't write into outfile.
+pager (\P) Set PAGER [to_pager]. Print the query results via PAGER.
+print (\p) Print current command.
+prompt (\R) Change your mysql prompt.
+quit (\q) Quit mysql.
+rehash (\#) Rebuild completion hash.
+source (\.) Execute an SQL script file. Takes a file name as an argument.
+status (\s) Get status information from the server.
+system (\!) Execute a system shell command.
+tee (\T) Set outfile [to_outfile]. Append everything into given outfile.
+use (\u) Use another database. Takes database name as argument.
+charset (\C) Switch to another charset. Might be needed for processing binlog with multi-byte charsets.
+warnings (\W) Show warnings after every statement.
+nowarning (\w) Don't show warnings after every statement.
\
\\
';
diff --git a/mysql-test/r/mysqldump.result b/mysql-test/r/mysqldump.result
index 33068cdfc2b..e7573ba48d9 100644
--- a/mysql-test/r/mysqldump.result
+++ b/mysql-test/r/mysqldump.result
@@ -2914,7 +2914,7 @@ drop view v1;
drop table t1;
drop database mysqldump_dbb;
use test;
-create user mysqltest_1;
+create user mysqltest_1@localhost;
create table t1(a int, b varchar(34));
reset master;
mysqldump: Couldn't execute 'FLUSH TABLES': Access denied; you need the RELOAD privilege for this operation (1227)
@@ -2923,6 +2923,13 @@ grant RELOAD on *.* to mysqltest_1@localhost;
mysqldump: Couldn't execute 'SHOW MASTER STATUS': Access denied; you need the SUPER,REPLICATION CLIENT privilege for this operation (1227)
mysqldump: Couldn't execute 'SHOW MASTER STATUS': Access denied; you need the SUPER,REPLICATION CLIENT privilege for this operation (1227)
grant REPLICATION CLIENT on *.* to mysqltest_1@localhost;
+CHANGE MASTER TO MASTER_LOG_FILE='master-bin.000001', MASTER_LOG_POS=537;
+CREATE TABLE `t1` (
+ `a` int(11) default NULL,
+ `b` varchar(34) default NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1;
+drop table t1;
+drop user mysqltest_1@localhost;
drop table t1;
drop user mysqltest_1;
End of 5.0 tests
diff --git a/mysql-test/r/repair.result b/mysql-test/r/repair.result
index f08dc6a8a4a..9b07281aa7b 100644
--- a/mysql-test/r/repair.result
+++ b/mysql-test/r/repair.result
@@ -41,9 +41,14 @@ Table Op Msg_type Msg_text
test.t1 repair warning Number of rows changed from 0 to 1
test.t1 repair status OK
drop table t1;
-DROP TABLE IF EXISTS tt1;
-CREATE TEMPORARY TABLE tt1 (c1 INT);
-REPAIR TABLE tt1 USE_FRM;
+CREATE TABLE t1(a INT, KEY(a));
+INSERT INTO t1 VALUES(1),(2),(3),(4),(5);
+SET myisam_repair_threads=2;
+REPAIR TABLE t1;
Table Op Msg_type Msg_text
-tt1 repair error Cannot repair temporary table from .frm file
-DROP TABLE tt1;
+test.t1 repair status OK
+SHOW INDEX FROM t1;
+Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment
+t1 1 a 1 a A 5 NULL NULL YES BTREE
+SET myisam_repair_threads=@@global.myisam_repair_threads;
+DROP TABLE t1;
diff --git a/mysql-test/t/grant.test b/mysql-test/t/grant.test
index a9d52f559ca..73857d8ab69 100644
--- a/mysql-test/t/grant.test
+++ b/mysql-test/t/grant.test
@@ -362,6 +362,8 @@ revoke all on mysqltest_2.t2 from mysqltest_3@localhost;
#test the db/table level privileges
grant all on mysqltest_2.* to mysqltest_3@localhost;
grant select on *.* to mysqltest_3@localhost;
+# Next grant is needed to trigger bug#7391. Do not optimize!
+grant select on mysqltest_2.t1 to mysqltest_3@localhost;
flush privileges;
disconnect conn1;
connect (conn2,localhost,mysqltest_3,,);
diff --git a/mysql-test/t/grant2.test b/mysql-test/t/grant2.test
index b3e2d2f7998..99da1fa1ee7 100644
--- a/mysql-test/t/grant2.test
+++ b/mysql-test/t/grant2.test
@@ -188,6 +188,24 @@ disconnect con9;
connection default;
#
+# Bug# 16180 - Setting SQL_LOG_OFF without SUPER privilege is silently ignored
+#
+create database mysqltest_1;
+grant select, insert, update on `mysqltest\_1`.* to mysqltest_1@localhost;
+connect (con10,localhost,mysqltest_1,,);
+connection con10;
+--error 1227
+set sql_log_off = 1;
+--error 1227
+set sql_log_bin = 0;
+disconnect con10;
+connection default;
+delete from mysql.user where user like 'mysqltest\_1';
+delete from mysql.db where user like 'mysqltest\_1';
+drop database mysqltest_1;
+flush privileges;
+
+# End of 4.1 tests
# Create and drop user
#
set sql_mode='maxdb';
diff --git a/mysql-test/t/heap_btree.test b/mysql-test/t/heap_btree.test
index fb715fccefe..e74e9723ca6 100644
--- a/mysql-test/t/heap_btree.test
+++ b/mysql-test/t/heap_btree.test
@@ -165,6 +165,26 @@ SELECT * from t1;
DROP TABLE t1;
#
+# Bug #9719: problem with delete
+#
+
+create table t1(a int not null, key using btree(a)) engine=heap;
+insert into t1 values (2), (2), (2), (1), (1), (3), (3), (3), (3);
+select a from t1 where a > 2 order by a;
+delete from t1 where a < 4;
+select a from t1 order by a;
+insert into t1 values (2), (2), (2), (1), (1), (3), (3), (3), (3);
+select a from t1 where a > 4 order by a;
+delete from t1 where a > 4;
+select a from t1 order by a;
+select a from t1 where a > 3 order by a;
+delete from t1 where a >= 2;
+select a from t1 order by a;
+drop table t1;
+
+--echo End of 4.1 tests
+
+#
# BUG#18160 - Memory-/HEAP Table endless growing indexes
#
CREATE TABLE t1(val INT, KEY USING BTREE(val)) ENGINE=memory;
@@ -184,4 +204,3 @@ CREATE TABLE t1 (a INT, UNIQUE USING BTREE(a)) ENGINE=MEMORY;
INSERT INTO t1 VALUES(NULL),(NULL);
DROP TABLE t1;
-# End of 4.1 tests
diff --git a/mysql-test/t/mysql_client.test b/mysql-test/t/mysql_client.test
index 003a086212e..7953e0b6550 100644
--- a/mysql-test/t/mysql_client.test
+++ b/mysql-test/t/mysql_client.test
@@ -29,6 +29,12 @@
--exec $MYSQL < $MYSQLTEST_VARDIR/tmp/bug20432.sql 2>&1
#
+# Bug #20328: mysql client interprets commands in comments
+#
+--exec echo 'help' | $MYSQL
+--exec echo 'help ' | $MYSQL
+
+#
# Bug #20103: Escaping with backslash does not work
#
--exec echo "SET SQL_MODE = 'NO_BACKSLASH_ESCAPES';" > $MYSQLTEST_VARDIR/tmp/bug20103.sql
diff --git a/mysql-test/t/mysqldump.test b/mysql-test/t/mysqldump.test
index 1794acea0dc..c175804c0cd 100644
--- a/mysql-test/t/mysqldump.test
+++ b/mysql-test/t/mysqldump.test
@@ -1287,7 +1287,7 @@ drop database mysqldump_dbb;
use test;
# Create user without sufficient privs to perform the requested operation
-create user mysqltest_1;
+create user mysqltest_1@localhost;
create table t1(a int, b varchar(34));
# To get consistent output, reset the master, starts over from first log
@@ -1324,6 +1324,7 @@ grant REPLICATION CLIENT on *.* to mysqltest_1@localhost;
# Clean up
drop table t1;
+drop user mysqltest_1@localhost;
drop user mysqltest_1;
--echo End of 5.0 tests
diff --git a/mysql-test/t/repair.test b/mysql-test/t/repair.test
index c79768dbb46..854ab712c2a 100644
--- a/mysql-test/t/repair.test
+++ b/mysql-test/t/repair.test
@@ -34,6 +34,17 @@ repair table t1;
repair table t1 use_frm;
drop table t1;
+#
+# BUG#18874 - Setting myisam_repair_threads > 1, index cardinality always 1
+#
+CREATE TABLE t1(a INT, KEY(a));
+INSERT INTO t1 VALUES(1),(2),(3),(4),(5);
+SET myisam_repair_threads=2;
+REPAIR TABLE t1;
+SHOW INDEX FROM t1;
+SET myisam_repair_threads=@@global.myisam_repair_threads;
+DROP TABLE t1;
+
# End of 4.1 tests
# End of 5.0 tests
diff --git a/scripts/fill_func_tables.sh b/scripts/fill_func_tables.sh
index 83501886d88..e71849962fa 100644
--- a/scripts/fill_func_tables.sh
+++ b/scripts/fill_func_tables.sh
@@ -1,7 +1,12 @@
-#!/usr/bin/perl
+#!@PERL@
+#
+# Copyright (C) 2003 MySQL AB
+# For a more info consult the file COPYRIGHT distributed with this file.
+#
# fill_func_tables - parse ../Docs/manual.texi
-
-# Original version by vva
+#
+# Original version by Victor Vagin <vva@mysql.com>
+#
my $cat_name= "";
my $func_name= "";
diff --git a/scripts/mysql_install_db.sh b/scripts/mysql_install_db.sh
index 865ab3e6db4..4ac9cf909e9 100644
--- a/scripts/mysql_install_db.sh
+++ b/scripts/mysql_install_db.sh
@@ -1,4 +1,3 @@
-
#!/bin/sh
# Copyright (C) 2002-2003 MySQL AB
# For a more info consult the file COPYRIGHT distributed with this file.
diff --git a/sql/field.cc b/sql/field.cc
index 6a205db0d80..e45e1586d89 100644
--- a/sql/field.cc
+++ b/sql/field.cc
@@ -6571,6 +6571,11 @@ void Field_varstring::sql_type(String &res) const
}
+uint Field_varstring::data_length(const char *from)
+{
+ return length_bytes == 1 ? (uint) (uchar) *ptr : uint2korr(ptr);
+}
+
/*
Functions to create a packed row.
Here the number of length bytes are depending on the given max_length
diff --git a/sql/field.h b/sql/field.h
index cd6439d1787..d0568d1d297 100644
--- a/sql/field.h
+++ b/sql/field.h
@@ -144,6 +144,11 @@ public:
table, which is located on disk).
*/
virtual uint32 pack_length_in_rec() const { return pack_length(); }
+
+ /*
+ data_length() return the "real size" of the data in memory.
+ */
+ virtual uint32 data_length(const char *from) { return pack_length(); }
virtual uint32 sort_length() const { return pack_length(); }
virtual void reset(void) { bzero(ptr,pack_length()); }
virtual void reset_fields() {}
@@ -1115,6 +1120,7 @@ public:
int key_cmp(const byte *str, uint length);
uint packed_col_length(const char *to, uint length);
uint max_packed_col_length(uint max_length);
+ uint data_length(const char *from);
uint size_of() const { return sizeof(*this); }
enum_field_types real_type() const { return MYSQL_TYPE_VARCHAR; }
bool has_charset(void) const
diff --git a/sql/set_var.cc b/sql/set_var.cc
index 75a419019b8..0be4fd72b30 100644
--- a/sql/set_var.cc
+++ b/sql/set_var.cc
@@ -589,7 +589,8 @@ static sys_var_thd_bit sys_sql_big_tables("sql_big_tables", 0,
static sys_var_thd_bit sys_big_selects("sql_big_selects", 0,
set_option_bit,
OPTION_BIG_SELECTS);
-static sys_var_thd_bit sys_log_off("sql_log_off", 0,
+static sys_var_thd_bit sys_log_off("sql_log_off",
+ check_log_update,
set_option_bit,
OPTION_LOG_OFF);
static sys_var_thd_bit sys_log_update("sql_log_update",
diff --git a/storage/archive/ha_archive.cc b/storage/archive/ha_archive.cc
index 6c0796e3bdc..de8b50fd2f3 100644
--- a/storage/archive/ha_archive.cc
+++ b/storage/archive/ha_archive.cc
@@ -901,6 +901,28 @@ int ha_archive::write_row(byte *buf)
if (init_archive_writer())
DBUG_RETURN(HA_ERR_CRASHED_ON_USAGE);
+ /*
+ Varchar structures are constant in size but are not cleaned up request
+ to request. The following sets all unused space to null to improve
+ compression.
+ */
+ for (Field **field=table->field ; *field ; field++)
+ {
+ DBUG_PRINT("archive",("Pack is %d\n", (*field)->pack_length()));
+ DBUG_PRINT("archive",("MyPack is %d\n", (*field)->data_length((char*) buf + (*field)->offset())));
+ if ((*field)->real_type() == MYSQL_TYPE_VARCHAR)
+ {
+ uint actual_length= (*field)->data_length((char*) buf + (*field)->offset());
+ uint offset= (*field)->offset() + actual_length +
+ (actual_length > 255 ? 2 : 1);
+ DBUG_PRINT("archive",("Offset is %d -> %d\n", actual_length, offset));
+ /*
+ if ((*field)->pack_length() + (*field)->offset() != offset)
+ bzero(buf + offset, (size_t)((*field)->pack_length() + (actual_length > 255 ? 2 : 1) - (*field)->data_length));
+ */
+ }
+ }
+
share->rows_recorded++;
rc= real_write_row(buf, &(share->archive_write));
error:
diff --git a/storage/heap/hp_delete.c b/storage/heap/hp_delete.c
index f37db2588f3..f18c5e7054c 100644
--- a/storage/heap/hp_delete.c
+++ b/storage/heap/hp_delete.c
@@ -73,7 +73,10 @@ int hp_rb_delete_key(HP_INFO *info, register HP_KEYDEF *keyinfo,
int res;
if (flag)
+ {
info->last_pos= NULL; /* For heap_rnext/heap_rprev */
+ info->lastkey_len= 0;
+ }
custom_arg.keyseg= keyinfo->seg;
custom_arg.key_length= hp_rb_make_key(keyinfo, info->recbuf, record, recpos);
diff --git a/storage/myisam/mi_update.c b/storage/myisam/mi_update.c
index f8b5cf55406..9ddda3f5ea9 100644
--- a/storage/myisam/mi_update.c
+++ b/storage/myisam/mi_update.c
@@ -172,7 +172,17 @@ int mi_update(register MI_INFO *info, const byte *oldrec, byte *newrec)
info->update= (HA_STATE_CHANGED | HA_STATE_ROW_CHANGED | HA_STATE_AKTIV |
key_changed);
myisam_log_record(MI_LOG_UPDATE,info,newrec,info->lastpos,0);
- VOID(_mi_writeinfo(info,key_changed ? WRITEINFO_UPDATE_KEYFILE : 0));
+ /*
+ Every myisam function that updates myisam table must end with
+ call to _mi_writeinfo(). If operation (second param of
+ _mi_writeinfo()) is not 0 it sets share->changed to 1, that is
+ flags that data has changed. If operation is 0, this function
+ equals to no-op in this case.
+
+ mi_update() must always pass !0 value as operation, since even if
+ there is no index change there could be data change.
+ */
+ VOID(_mi_writeinfo(info, WRITEINFO_UPDATE_KEYFILE));
allow_break(); /* Allow SIGHUP & SIGINT */
if (info->invalidator != 0)
{
diff --git a/storage/myisam/sort.c b/storage/myisam/sort.c
index 44e7e8b464e..099c3173396 100644
--- a/storage/myisam/sort.c
+++ b/storage/myisam/sort.c
@@ -484,13 +484,6 @@ int thr_write_keys(MI_SORT_PARAM *sort_param)
if (!got_error)
{
mi_set_key_active(share->state.key_map, sinfo->key);
- if (param->testflag & T_STATISTICS)
- update_key_parts(sinfo->keyinfo, rec_per_key_part, sinfo->unique,
- param->stats_method == MI_STATS_METHOD_IGNORE_NULLS?
- sinfo->notnull: NULL,
- (ulonglong) info->state->records);
-
-
if (!sinfo->buffpek.elements)
{
if (param->testflag & T_VERBOSE)
@@ -502,6 +495,11 @@ int thr_write_keys(MI_SORT_PARAM *sort_param)
flush_ft_buf(sinfo) || flush_pending_blocks(sinfo))
got_error=1;
}
+ if (!got_error && param->testflag & T_STATISTICS)
+ update_key_parts(sinfo->keyinfo, rec_per_key_part, sinfo->unique,
+ param->stats_method == MI_STATS_METHOD_IGNORE_NULLS?
+ sinfo->notnull: NULL,
+ (ulonglong) info->state->records);
}
my_free((gptr) sinfo->sort_keys,MYF(0));
my_free(mi_get_rec_buff_ptr(info, sinfo->rec_buff),