2739 Georgi Kodinov 2008-07-23
fixed 5.1-bugteam -> 6.0-bugteam merge problems
modified:
mysql-test/mysql-test-run.pl*
mysql-test/r/partition_pruning.result
2738 Georgi Kodinov 2008-07-23 [merge]
merged 5.1-bugteam
modified:
mysys/my_uuid.c
sql/handler.cc
2737 Alexander Barkov 2008-07-23
Bug#33791 Wrong ORDER BY with latin2_czech_cs
Problem: ORDER BY didn't take into account accents and cases
in multi-level collations (latin2_czech_cs and cp1250_czech_cs).
This happened because my_strnxfrm_xxx() family functions were
executed with wrong "nweights" argument, so only primary
level weights padded by primary weights for SPACE character
were written into the result. Bug was introduced in 6.0
with WL#3664 "strnxfrm() changes for prefix keys and NOPAD" (for Falcon).
Fix: pass correct "nweights" argument, pad each level to "nweights"
separetely, and additionally pad the result string to generate
fixed length records.
Additional changes:
- New syntax was added:
WEIGHT_STRING(expr, result_length, nweights, flags)
which is a great help for testing purposes.
- my_stnxfrm_xxx() family functions now write partial weights
if the full weight doesn't fit. This gives a little bit better
ORDER BY for strings longer than @@max_sort_length.
- Removing duplicate functions and introducing my_strnxfrm_unicode()
which is compatible with utf8, utf8mb4, ucs2, utf16, utf32.
include/m_ctype.h@stripped, 2008-03-26 15:26:45+04:00, bar@stripped +5 -1
- Adding new flag, to pad strnxfrm() result to generate
fixed length records (e.g. for filesort())
- Adding new function prototype
mysql-test/include/weight_string.inc:
Adding tests
mysql-test/include/weight_string_8140.inc:
Adding tests
mysql-test/include/weight_string_8EA1.inc:
Adding tests
mysql-test/include/weight_string_8FA2C3.inc:
Adding tests
mysql-test/include/weight_string_A1A1.inc:
Adding tests
mysql-test/include/weight_string_chde.inc:
Adding tests
mysql-test/include/weight_string_euro.inc:
Adding a new include test file, for better test coverage.
This is to test that my_strnxfrm_xxx() functions allow
writting of partial weights into the result.
mysql-test/include/weight_string_euro.inc:
mysql-test/r/ctype_big5.result:
Adding tests
mysql-test/r/ctype_cp1250_ch.result:
Adding tests
mysql-test/r/ctype_cp932_binlog_stm.result:
Adding tests
mysql-test/r/ctype_eucjpms.result:
Adding tests
mysql-test/r/ctype_euckr.result:
Adding tests
mysql-test/r/ctype_gb2312.result:
Adding tests
mysql-test/r/ctype_gbk.result:
Adding tests
mysql-test/r/ctype_latin1.result:
Adding tests
mysql-test/r/ctype_latin1_de.result:
Adding tests
mysql-test/r/ctype_latin2.result:
Adding tests
mysql-test/r/ctype_latin2_ch.result:
Adding tests
mysql-test/r/ctype_sjis.result:
Adding tests
mysql-test/r/ctype_tis620.result:
Adding tests
mysql-test/r/ctype_uca.result:
Adding tests
mysql-test/r/ctype_ucs.result:
Adding tests
mysql-test/r/ctype_ujis.result:
Adding tests
mysql-test/r/ctype_utf16.result:
Adding tests
mysql-test/r/ctype_utf16_uca.result:
Adding tests
mysql-test/r/ctype_utf32.result:
Adding tests
mysql-test/r/ctype_utf32_uca.result:
Adding tests
mysql-test/r/ctype_utf8.result:
Adding tests
mysql-test/suite/binlog/r/binlog_stm_ctype_cp932.result:
Adding tests
mysql-test/t/ctype_cp1250_ch.test:
Adding tests
mysql-test/t/ctype_latin1.test:
Adding tests
mysql-test/t/ctype_latin1_de.test:
Adding tests
mysql-test/t/ctype_latin2_ch.test:
Adding tests
mysql-test/t/ctype_uca.test:
Adding tests
mysql-test/t/ctype_ucs.test:
Adding tests
mysql-test/t/ctype_utf16.test:
Adding tests
mysql-test/t/ctype_utf16_uca.test:
Adding tests
mysql-test/t/ctype_utf32.test:
Adding tests
mysql-test/t/ctype_utf32_uca.test:
Adding tests
mysql-test/t/ctype_utf8.test:
Adding tests
mysql-test/t/disabled.def:
Uncommenting failing test
sql/field.cc:
Fix for bug#33791 (a bug since 6.0):
- Using explicit function call, instead of macros, to pass new flag
- Passing correct "nweights" argument.
This change fixes filesort() behavior for for multi-level collations
(like cp1250_czech_cs and latin2_czech_cs).
Weight strings are now generated using this format:
PPPPpppp.SSSSssss.TTTTtttt.QQQQqqqq,
assuming a column of type CHAR(8) or VARCHAR(8)
with length=4, where:
PPPP - primary weights for the source string (base letter),
pppp - primary weights for padded trailing spaces,
SSSS - secondary weights for the source string (accent),
ssss - secondary weights for padded trailing spaces,
TTTT - tertiary weights for the source string (case),
tttt - tertiary weights for padded trailing spaces,
QQQQ - quarternary weights (binary representation),
qqqq - quarternary weights for padded trailing spaces,
dot(.) - optional level separator.
Previously wrong result of this format was generated:
PPPPpppppppppppp, where PPPP - primary weights for the source string,
pppppppppppp - primary weights for padded trailing spaces.
I.e. only primary weights were written into the result
(because of wrong "nweights"), and only primary weights were padded
with spaces (because of lack of two separate flags "pad each level"
and "pad the result").
Secondary and higher weights were never written to the result
string, so accents and cases were never taken into account.
sql/filesort.cc:
A change similar to the one in field.cc, now for Items:
- passing correct "nweights"
- passing correct pad flags
sql/item_strfunc.cc:
New functionality (mostly for test purposes) - adding "result_length" parameter:
- if result_length is non-zero, then use result_length as max_length
- otherwise automatically calculate result's max_length using
argument's max_length and nweights.
sql/item_strfunc.h:
Adding result_length.
sql/sql_yacc.yy:
Adding new syntax:
WEIGHT_STRING(argument, result_length, nweights, flags)
strings/ctype-czech.c:
New code to pad result to fixed length.
strings/ctype-mb.c:
Allow writting of partial weights.
If weight for the next character does't fit into the result,
just write its part. This happens when ORDER BY expression
generates results longer than max_sort_length.
Previously either the full weight was written, or was not
written at all. Writting partial weight gives a little
bit better ORDER BY result.
strings/ctype-simple.c:
- Remember new flag
- New code to pad result to fixed length.
strings/ctype-tis620.c:
New code to pad result to fixed length.
strings/ctype-uca.c:
- Allow writting partial weights
- New code to pad result to fixed length
strings/ctype-ucs2.c:
- Removing duplicate code: we have had separate functions
strnxfrm() functions UCS2, UTF16, UTF32.
- Reusing my_strnxfrm_unicode() instead, which is compatible
with all of them.
strings/ctype-utf8.c:
- Moving pad code into separate functions
- Removing duplicate code: separate functions for UTF8 and UTF8MB3
- Reusing my_strnxfrm_unicode() instead.
strings/ctype-win1250ch.c:
Adding new code for padding to fixed length.
added:
mysql-test/include/weight_string_euro.inc
modified:
include/m_ctype.h
mysql-test/include/weight_string.inc
mysql-test/include/weight_string_8140.inc
mysql-test/include/weight_string_8EA1.inc
mysql-test/include/weight_string_8FA2C3.inc
mysql-test/include/weight_string_A1A1.inc
mysql-test/include/weight_string_chde.inc
mysql-test/r/ctype_big5.result
mysql-test/r/ctype_cp1250_ch.result
mysql-test/r/ctype_cp932_binlog_stm.result
mysql-test/r/ctype_eucjpms.result
mysql-test/r/ctype_euckr.result
mysql-test/r/ctype_gb2312.result
mysql-test/r/ctype_gbk.result
mysql-test/r/ctype_latin1.result
mysql-test/r/ctype_latin1_de.result
mysql-test/r/ctype_latin2.result
mysql-test/r/ctype_latin2_ch.result
mysql-test/r/ctype_sjis.result
mysql-test/r/ctype_tis620.result
mysql-test/r/ctype_uca.result
mysql-test/r/ctype_ucs.result
mysql-test/r/ctype_ujis.result
mysql-test/r/ctype_utf16.result
mysql-test/r/ctype_utf16_uca.result
mysql-test/r/ctype_utf32.result
mysql-test/r/ctype_utf32_uca.result
mysql-test/r/ctype_utf8.result
mysql-test/suite/binlog/r/binlog_stm_ctype_cp932.result
mysql-test/t/ctype_cp1250_ch.test
mysql-test/t/ctype_latin1.test
mysql-test/t/ctype_latin1_de.test
mysql-test/t/ctype_latin2_ch.test
mysql-test/t/ctype_uca.test
mysql-test/t/ctype_ucs.test
mysql-test/t/ctype_utf16.test
mysql-test/t/ctype_utf16_uca.test
mysql-test/t/ctype_utf32.test
mysql-test/t/ctype_utf32_uca.test
mysql-test/t/ctype_utf8.test
mysql-test/t/disabled.def
sql/field.cc
sql/filesort.cc
sql/item_strfunc.cc
sql/item_strfunc.h
sql/sql_yacc.yy
strings/ctype-czech.c
strings/ctype-mb.c
strings/ctype-simple.c
strings/ctype-tis620.c
strings/ctype-uca.c
strings/ctype-ucs2.c
strings/ctype-utf8.c
strings/ctype-win1250ch.c
=== modified file 'mysql-test/mysql-test-run.pl' (properties changed: -x to +x)
=== modified file 'mysql-test/r/partition_pruning.result'
--- a/mysql-test/r/partition_pruning.result 2008-07-22 10:51:13 +0000
+++ b/mysql-test/r/partition_pruning.result 2008-07-23 13:17:13 +0000
@@ -342,7 +342,7 @@ id select_type table partitions type pos
explain partitions
select * from t1 X, t1 Y where X.a = Y.a and (X.a=1 or X.a=2);
id select_type table partitions type possible_keys key key_len ref rows Extra
-1 SIMPLE X p1,p2 ALL a NULL NULL NULL 4 Using where
+1 SIMPLE X p1,p2 ALL a NULL NULL NULL 2 Using where
1 SIMPLE Y p1,p2 ref a a 4 test.X.a 2
drop table t1;
create table t1 (a int) partition by hash(a) partitions 20;
=== modified file 'mysys/my_uuid.c'
--- a/mysys/my_uuid.c 2008-07-18 13:30:53 +0000
+++ b/mysys/my_uuid.c 2008-07-23 11:28:20 +0000
@@ -145,12 +145,12 @@ void my_uuid(uchar *to)
*/
if (nanoseq)
{
- longlong delta;
+ uint delta;
DBUG_ASSERT((tv > uuid_time) && (nanoseq > 0));
/*
-1 so we won't make tv= uuid_time for nanoseq >= (tv - uuid_time)
*/
- delta= (longlong) min(nanoseq, tv - uuid_time -1);
+ delta= min(nanoseq, (uint)(tv - uuid_time -1));
tv-= delta;
nanoseq-= delta;
}
=== modified file 'sql/handler.cc'
--- a/sql/handler.cc 2008-07-09 07:12:43 +0000
+++ b/sql/handler.cc 2008-07-23 11:28:20 +0000
@@ -1630,23 +1630,23 @@ bool mysql_xa_recover(THD *thd)
@return
always 0
*/
-static my_bool release_temporary_latches(THD *thd, plugin_ref plugin,
- void *unused)
-{
- handlerton *hton= plugin_data(plugin, handlerton *);
-
- if (hton->state == SHOW_OPTION_YES && hton->release_temporary_latches)
- hton->release_temporary_latches(hton, thd);
-
- return FALSE;
-}
-
int ha_release_temporary_latches(THD *thd)
{
- plugin_foreach(thd, release_temporary_latches, MYSQL_STORAGE_ENGINE_PLUGIN,
- NULL);
+ Ha_trx_info *info;
+ /*
+ Note that below we assume that only transactional storage engines
+ may need release_temporary_latches(). If this will ever become false,
+ we could iterate on thd->open_tables instead (and remove duplicates
+ as if (!seen[hton->slot]) { seen[hton->slot]=1; ... }).
+ */
+ for (info= thd->transaction.stmt.ha_list; info; info= info->next())
+ {
+ handlerton *hton= info->ht();
+ if (hton && hton->release_temporary_latches)
+ hton->release_temporary_latches(hton, thd);
+ }
return 0;
}
| Thread |
|---|
| • bzr push into mysql-6.0-backup branch (kgeorge:2737 to 2739) Bug#33791,WL#3664 | Georgi Kodinov | 23 Jul |