3953 Dmitry Shulga 2012-02-24
Follow-up for patch for bug#1174899.
Event_queue::create_event() deletes an Event_queue_element object as its
side effect. Subsequently, the attribute 'Event_queue_element::dropped'
is used to check whether event should be deleted from table. An access
to attribute of already deleted object could incur a fault. To protect
against such failure we save the value of Event_queue_element::dropped
attribute into a temporary variable to use it subsequently after
return from Event_queue::create_event.
events_restart.test re-enabled.
modified:
mysql-test/t/disabled.def
sql/events.cc
3952 Alexander Barkov 2012-02-23
Bug#13596893 - "ERROR 1690 (22003): BIGINT UNSIGNED VALUE IS OUT OF RANGE" ON DATE OPERATION
Problem:
Prior to WL#946 expressions like "timestamp_column1-timestamp_column2"
had REAL type. WL#946 changed behaviour of temporal data types in numeric
context started to work as DECIMAL numbers, or as INT number in case of
no fractional digits. This change in combination with the fact that
TIMESTAMP fields had UNSIGNED_FLAG made the expression
"timestamp_column1-timestamp_column2" create a "BINGINT UNSIGNED"
result and therefore fail with the error
"BIGINT UNSIGNED value is out of range".
Fix:
- Removing UNSIGNED_FLAG from Field_timestampf.
- For consistency, removing "unsigned_flag" from
all DATETIME and DATE items. Note, we want to have
negative years in the future anyway.
- Additionally, adjusting Item::decimal_precision() to
return more precise result, so smaller numeric types
are created when temporal types appear in numeric context.
- Additionally, removing ZEROFILL_FLAG from Field_timestampf,
as it's a remainder from MySQL-4.0 times.
Per file comments:
@ sql/field.cc
Removing ZEROFILL_FLAG and UNSIGNED_FLAG from Field_timestampf.
Note, not removing these flags from the old Field_timestamp,
for better compatibility purposes. InnoDB might need these
flags in the old tables.
Also, removing redundant setting of BINARY_FLAG.
It's set by Field_temporal::Field_temporal().
@ sql/item.cc
Adding better decimal precision calculation for the temporal data types,
to create smaller data types in numeric context.
@ sql/item_func.cc
@ sql/item_timefunc.cc
@ sql/item_timefunc.h
Removing unsigned flag from date and datetime items.
@ sql/sql_const.h
Introducing new constants representing number of integer
digits in the temporal data types.
@ mysql-test/r/ctype_binary.result
@ mysql-test/r/ctype_cp1251.result
@ mysql-test/r/ctype_latin1.result
@ mysql-test/r/ctype_ucs.result
@ mysql-test/r/ctype_utf8.result
@ mysql-test/r/func_time.result
@ mysql-test/r/metadata.result
@ mysql-test/r/ps_2myisam.result
@ mysql-test/r/ps_3innodb.result
@ mysql-test/r/ps_4heap.result
@ mysql-test/r/ps_5merge.result
@ mysql-test/r/type_temporal_fractional.result
Recording test results
modified:
mysql-test/r/ctype_binary.result
mysql-test/r/ctype_cp1251.result
mysql-test/r/ctype_latin1.result
mysql-test/r/ctype_ucs.result
mysql-test/r/ctype_utf8.result
mysql-test/r/func_time.result
mysql-test/r/metadata.result
mysql-test/r/ps_2myisam.result
mysql-test/r/ps_3innodb.result
mysql-test/r/ps_4heap.result
mysql-test/r/ps_5merge.result
mysql-test/r/type_temporal_fractional.result
mysql-test/r/type_timestamp.result
mysql-test/t/type_timestamp.test
sql/field.cc
sql/item.cc
sql/item_func.cc
sql/item_timefunc.cc
sql/item_timefunc.h
sql/sql_const.h
=== modified file 'mysql-test/t/disabled.def'
--- a/mysql-test/t/disabled.def 2012-02-23 05:57:45 +0000
+++ b/mysql-test/t/disabled.def 2012-02-24 06:32:57 +0000
@@ -14,4 +14,3 @@ read_many_rows_innodb : Bug#11748886
sum_distinct-big : Bug#11764126 2010-11-15 mattiasj was not tested
archive-big : Bug#11817185 2011-03-10 Anitha Disabled since this leads to timeout on Solaris Sparc
log_tables-big : Bug#11756699 2010-11-15 mattiasj report already exists
-events_restart @windows : Bug#11748899 2012-02-23 hemant The test started failing on windows after the fix for bug#11748899 and followup patch didnot work.
=== modified file 'sql/events.cc'
--- a/sql/events.cc 2012-02-09 14:56:44 +0000
+++ b/sql/events.cc 2012-02-24 06:32:57 +0000
@@ -1117,7 +1117,7 @@ Events::load_events_from_db(THD *thd)
while (!(read_record_info.read_record(&read_record_info)))
{
Event_queue_element *et;
- bool created;
+ bool created, dropped;
if (!(et= new Event_queue_element))
goto end;
@@ -1133,6 +1133,12 @@ Events::load_events_from_db(THD *thd)
goto end;
}
+ /**
+ Since the Event_queue_element object could be deleted inside
+ Event_queue::create_event we should save the value of dropped flag
+ into the temporary variable.
+ */
+ dropped= et->dropped;
if (event_queue->create_event(thd, et, &created))
{
/* Out of memory */
@@ -1141,7 +1147,7 @@ Events::load_events_from_db(THD *thd)
}
if (created)
count++;
- else if (et->dropped)
+ else if (dropped)
{
/*
If not created, a stale event - drop if immediately if
No bundle (reason: useless for push emails).
| Thread |
|---|
| • bzr push into mysql-trunk branch (Dmitry.Shulga:3952 to 3953) Bug#1174899 | Dmitry Shulga | 24 Feb |