summaryrefslogtreecommitdiff
path: root/sql
diff options
context:
space:
mode:
Diffstat (limited to 'sql')
-rw-r--r--sql/slave.cc10
-rw-r--r--sql/sql_cte.cc2
2 files changed, 10 insertions, 2 deletions
diff --git a/sql/slave.cc b/sql/slave.cc
index 77d9811f288..16fa890d86c 100644
--- a/sql/slave.cc
+++ b/sql/slave.cc
@@ -4306,7 +4306,15 @@ static int exec_relay_log_event(THD* thd, Relay_log_info* rli,
*/
if (!(ev->is_artificial_event() || ev->is_relay_log_event() || (ev->when == 0)))
{
- rli->last_master_timestamp= ev->when + (time_t) ev->exec_time;
+ /*
+ Ignore FD's timestamp as it does not reflect the slave execution
+ state but likely to reflect a deep past. Consequently when the first
+ data modification event execution last long all this time
+ Seconds_Behind_Master is zero.
+ */
+ if (ev->get_type_code() != FORMAT_DESCRIPTION_EVENT)
+ rli->last_master_timestamp= ev->when + (time_t) ev->exec_time;
+
DBUG_ASSERT(rli->last_master_timestamp >= 0);
}
}
diff --git a/sql/sql_cte.cc b/sql/sql_cte.cc
index b05a688f40e..24fd2c60503 100644
--- a/sql/sql_cte.cc
+++ b/sql/sql_cte.cc
@@ -1278,7 +1278,7 @@ bool With_element::check_unrestricted_recursive(st_select_lex *sel,
With_element *with_elem= unit->with_element;
if (encountered & with_elem->get_elem_map())
unrestricted|= with_elem->mutually_recursive;
- else
+ else if (with_elem ==this)
encountered|= with_elem->get_elem_map();
}
}