List:Commits« Previous MessageNext Message »
From:Mats Kindahl Date:August 6 2007 3:01pm
Subject:Re: bk commit into 5.0 tree (gkodinov:1.2501) BUG#29536
View as plain text  
Hi Joro!

Patch looks good. OK to push.

/Matz

On Monday 06 August 2007 13.57.30 kgeorge@stripped wrote:
> Below is the list of changes that have just been committed into a local
> 5.0 repository of kgeorge. When kgeorge does a push these changes will
> be propagated to the main repository and, within 24 hours after the
> push, to the public repository.
> For information on how to access the public repository
> see http://dev.mysql.com/doc/mysql/en/installing-source-tree.html
>
> ChangeSet@stripped, 2007-08-06 04:57:28-07:00, gkodinov@stripped +4 -0
>   Bug #29536: timestamp inconsistent in replication around 1970
>
>   MySQL replicates the time zone only when operations that involve
>   it are performed. This is controlled by a flag. But this flag
>   is set only on successful operation.
>   The flag must be set also when there is an error that involves
>   a timezone (so the master would replicate the error to the slaves).
>
>   Fixed by moving the setting of the flag before the operation
>   (so it apples to errors as well).
>
>   mysql-test/r/rpl_timezone.result@stripped, 2007-08-06 04:57:26-07:00,
> gkodinov@stripped +18 -0 Bug #29536: test case
>
>   mysql-test/t/rpl_timezone.test@stripped, 2007-08-06 04:57:26-07:00,
> gkodinov@stripped +27 -2 Bug #29536: test case
>
>   sql/field.cc@stripped, 2007-08-06 04:57:26-07:00, gkodinov@stripped +3 -3
>     Bug #29536: move setting of the flag before the operation
>     (so it apples to errors as well).
>
>   sql/time.cc@stripped, 2007-08-06 04:57:26-07:00, gkodinov@stripped +1 -1
>     Bug #29536: move setting of the flag before the operation
>     (so it apples to errors as well).
>
> diff -Nrup a/mysql-test/r/rpl_timezone.result
> b/mysql-test/r/rpl_timezone.result ---
> a/mysql-test/r/rpl_timezone.result	2006-12-08 14:33:35 -08:00
> +++ b/mysql-test/r/rpl_timezone.result	2007-08-06 04:57:26 -07:00
> @@ -130,3 +130,21 @@ t
>  2005-01-01 08:00:00
>  drop table t1, t2;
>  set global time_zone= @my_time_zone;
> +End of 4.1 tests
> +CREATE TABLE t1 (a INT, b TIMESTAMP);
> +INSERT INTO t1 VALUES (1, NOW());
> +SET @@session.time_zone='Japan';
> +UPDATE t1 SET b= '1970-01-01 08:59:59' WHERE a= 1;
> +Warnings:
> +Warning	1264	Out of range value adjusted for column 'b' at row 1
> +SELECT * FROM t1 ORDER BY a;
> +a	b
> +1	0000-00-00 00:00:00
> +SET @@session.time_zone='Japan';
> +SELECT * FROM t1 ORDER BY a;
> +a	b
> +1	0000-00-00 00:00:00
> +SET @@session.time_zone = default;
> +DROP TABLE t1;
> +SET @@session.time_zone = default;
> +End of 5.0 tests
> diff -Nrup a/mysql-test/t/rpl_timezone.test
> b/mysql-test/t/rpl_timezone.test ---
> a/mysql-test/t/rpl_timezone.test	2006-11-15 01:23:23 -08:00
> +++ b/mysql-test/t/rpl_timezone.test	2007-08-06 04:57:26 -07:00
> @@ -126,8 +126,33 @@ connection master;
>  drop table t1, t2;
>  sync_slave_with_master;
>
> -# End of 4.1 tests
> -
>  # Restore original timezone
>  connection master;
>  set global time_zone= @my_time_zone;
> +
> +--echo End of 4.1 tests
> +
> +#
> +# Bug #29536: timestamp inconsistent in replication around 1970
> +#
> +connection master;
> +
> +CREATE TABLE t1 (a INT, b TIMESTAMP);
> +INSERT INTO t1 VALUES (1, NOW());
> +
> +SET @@session.time_zone='Japan';
> +UPDATE t1 SET b= '1970-01-01 08:59:59' WHERE a= 1;
> +SELECT * FROM t1 ORDER BY a;
> +
> +sync_slave_with_master;
> +SET @@session.time_zone='Japan';
> +# must procdure the same result as the SELECT on the master
> +SELECT * FROM t1 ORDER BY a;
> +
> +SET @@session.time_zone = default;
> +connection master;
> +DROP TABLE t1;
> +SET @@session.time_zone = default;
> +
> +
> +--echo End of 5.0 tests
> diff -Nrup a/sql/field.cc b/sql/field.cc
> --- a/sql/field.cc	2007-07-25 15:28:50 -07:00
> +++ b/sql/field.cc	2007-08-06 04:57:26 -07:00
> @@ -4462,6 +4462,7 @@ longlong Field_timestamp::val_int(void)
>    MYSQL_TIME time_tmp;
>    THD  *thd= table ? table->in_use : current_thd;
>
> +  thd->time_zone_used= 1;
>  #ifdef WORDS_BIGENDIAN
>    if (table && table->s->db_low_byte_first)
>      temp=uint4korr(ptr);
> @@ -4473,7 +4474,6 @@ longlong Field_timestamp::val_int(void)
>      return(0);					/* purecov: inspected */
>
>    thd->variables.time_zone->gmt_sec_to_TIME(&time_tmp, (my_time_t)temp);
> -  thd->time_zone_used= 1;
>
>    return time_tmp.year * LL(10000000000) + time_tmp.month * LL(100000000)
> + time_tmp.day * 1000000L + time_tmp.hour * 10000L +
> @@ -4492,6 +4492,7 @@ String *Field_timestamp::val_str(String
>    to= (char*) val_buffer->ptr();
>    val_buffer->length(field_length);
>
> +  thd->time_zone_used= 1;
>  #ifdef WORDS_BIGENDIAN
>    if (table && table->s->db_low_byte_first)
>      temp=uint4korr(ptr);
> @@ -4507,7 +4508,6 @@ String *Field_timestamp::val_str(String
>    val_buffer->set_charset(&my_charset_bin);	// Safety
>
>    thd->variables.time_zone->gmt_sec_to_TIME(&time_tmp,(my_time_t)temp);
> -  thd->time_zone_used= 1;
>
>    temp= time_tmp.year % 100;
>    if (temp < YY_PART_YEAR - 1)
> @@ -4557,6 +4557,7 @@ bool Field_timestamp::get_date(MYSQL_TIM
>  {
>    long temp;
>    THD *thd= table ? table->in_use : current_thd;
> +  thd->time_zone_used= 1;
>  #ifdef WORDS_BIGENDIAN
>    if (table && table->s->db_low_byte_first)
>      temp=uint4korr(ptr);
> @@ -4572,7 +4573,6 @@ bool Field_timestamp::get_date(MYSQL_TIM
>    else
>    {
>      thd->variables.time_zone->gmt_sec_to_TIME(ltime, (my_time_t)temp);
> -    thd->time_zone_used= 1;
>    }
>    return 0;
>  }
> diff -Nrup a/sql/time.cc b/sql/time.cc
> --- a/sql/time.cc	2007-05-16 01:44:42 -07:00
> +++ b/sql/time.cc	2007-08-06 04:57:26 -07:00
> @@ -228,11 +228,11 @@ my_time_t TIME_to_timestamp(THD *thd, co
>    my_time_t timestamp;
>
>    *in_dst_time_gap= 0;
> +  thd->time_zone_used= 1;
>
>    timestamp= thd->variables.time_zone->TIME_to_gmt_sec(t,
> in_dst_time_gap); if (timestamp)
>    {
> -    thd->time_zone_used= 1;
>      return timestamp;
>    }


Thread
bk commit into 5.0 tree (gkodinov:1.2501) BUG#29536kgeorge6 Aug
  • Re: bk commit into 5.0 tree (gkodinov:1.2501) BUG#29536Mats Kindahl6 Aug