1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-30 16:24:05 +03:00

MDEV-33856: Alternative Replication Lag Representation via Received/Executed Master Binlog Event Timestamps

This commit adds 3 new status variables to 'show all slaves status':

- Master_last_event_time ; timestamp of the last event read from the
  master by the IO thread.
- Slave_last_event_time ; Master timestamp of the last event committed
  on the slave.
- Master_Slave_time_diff: The difference of the above two timestamps.

All the above variables are NULL until the slave has started and the
slave has read one query event from the master that changes data.

- Added information_schema.slave_status, which allows us to remove:
   - show_master_info(), show_master_info_get_fields(),
     send_show_master_info_data(), show_all_master_info()
   - class Sql_cmd_show_slave_status.
   - Protocol::store(I_List<i_string_pair>* str_list) as it is not
     used anymore.
- Changed old SHOW SLAVE STATUS and SHOW ALL SLAVES STATUS to
  use the SELECT code path, as all other SHOW ... STATUS commands.

Other things:
- Xid_log_time is set to time of commit to allow slave that reads the
  binary log to calculate Master_last_event_time and
  Slave_last_event_time.
  This is needed as there is not 'exec_time' for row events.
- Fixed that Load_log_event calculates exec_time identically to
  Query_event.
- Updated RESET SLAVE to reset Master/Slave_last_event_time
- Updated SQL thread's update on first transaction read-in to
  only update Slave_last_event_time on group events.
- Fixed possible (unlikely) bugs in sql_show.cc ...old_format() functions
  if allocation of 'field' would fail.

Reviewed By:
Brandon Nesterenko <brandon.nesterenko@mariadb.com>
Kristian Nielsen <knielsen@knielsen-hq.org>
This commit is contained in:
Monty
2024-05-14 23:47:59 +03:00
committed by Brandon Nesterenko
parent 4dde925f54
commit 25b5c63905
51 changed files with 1931 additions and 784 deletions

View File

@ -4058,12 +4058,22 @@ Field *Type_handler_float::make_schema_field(MEM_ROOT *root, TABLE *table,
const ST_FIELD_INFO &def) const
{
LEX_CSTRING name= def.name();
uint32 len= def.char_length();
uint dec= NOT_FIXED_DEC;
if (len >= 100)
{
dec= def.decimal_scale();
uint prec= def.decimal_precision();
/* Field defined in sql_show.cc with decimals */
len= my_decimal_precision_to_length(prec, dec, 0);
}
return new (root)
Field_float(addr.ptr(), def.char_length(),
addr.null_ptr(), addr.null_bit(),
Field::NONE, &name,
(uint8) NOT_FIXED_DEC,
0/*zerofill*/, def.unsigned_flag());
Field_float(addr.ptr(), len,
addr.null_ptr(), addr.null_bit(),
Field::NONE, &name,
dec,
0/*zerofill*/, def.unsigned_flag());
}