[MDEV-19629] Implement MySQL 8.0 native functions: format_bytes(), format_pico_time() and ps_thread_id() Created: 2019-05-29  Updated: 2023-07-18

Status: Open
Project: MariaDB Server
Component/s: Server
Fix Version/s: None

Type: Task Priority: Minor
Reporter: Jaime Crespo Assignee: Anel Husakovic
Resolution: Unresolved Votes: 1
Labels: beginner-friendly, compat80, upstream-fixed

Issue Links:
PartOf
is part of MDEV-28906 MySQL 8.0 desired compatibility Open
Sub-Tasks:
Key
Summary
Type
Status
Assignee
MDEV-31733 Create native function format_pico_time Technical task Closed Anel Husakovic  
MDEV-31734 Create native function ps_thread_id Technical task Open  
MDEV-31735 Create native function ps_current_thr... Technical task Open  
MDEV-31736 Create native function for format_bytes Technical task Open  

 Description   

While this functions can be implemented as user SQL functions, they have become native on MySQL 8.0.16. They are simple and independent enough that backport them should be easy.
Implementing them on MariaDB would allow:

  • Better compatibility with sys/performance_schema
  • Nice functions to have natively in any case for formatting reasons or even as a virtual column
  • Better MySQL compatibility, and avoiding user pain when migrating from MySQL from 8.0.16+
  • Better performance by being C rather than user functions/SQL

https://mysql.wisborg.dk/2019/05/28/performance-schema-functions/

MySQL implementation

MariaDB implementation

  • MariaDB doesn't have any native functions
  • MariaDB has sys schema function format_bytes, as stated in sysschema.format_bytes documentation.
  • This change is introduced from 10.6.0 with commits and author

    commit aa2ff62082c4eb09b1d505af0d0327278c9f7d08
    Author: Vladislav Vaintroub <wlad@mariadb.com>
    Date:   Wed Mar 3 10:30:29 2021 +0100
     
        MDEV-9077 Use sys schema in bootstrapping, incl. mtr
    

    and second commit

    commit 4bac804c90c6f8d101ef32aef39813c3d13283ff
    Author: Vladislav Vaintroub <wlad@mariadb.com>
    Date:   Wed Mar 17 17:57:11 2021 +0100
     
        MDEV-9077 add sys_schema from https://github.com/mysql/mysql-sys
    

  • Tasks:
    The task can be divided into 3 steps by backporting the patch from MySQL if possible in single commit and if not in separate commits:
  • Create native function format_pico_time - task done as contribution with PR 2558 on 11.0, commit d9808f79
  • Create native function ps_thread_id
  • Create native function ps_current_thread_id
  • Create native function for format_bytes

Generated at Thu Feb 08 08:53:08 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.