SlideShare a Scribd company logo
1 of 17
Download to read offline
MariaDB Server on macOS
On my lame attempts to build and use it on 10.13.6
Valerii Kravchuk, Principal Support Engineer, MariaDB
valerii.kravchuk@mariadb.com
1
www.percona.com
What is this session about?
● Why bother to run MariaDB Server on macOS?
○ Because I can, I have a spare MacBook Air at hand, and I
want to study and use DTrace, Instruments and other
macOS specific tools, and test more (also on M1 eventually)
● Status of MariaDB Server on macOS
● Building recent MariaDB Server 10.1 … 10.6 from GitHub
sources on macOS 10.13.6 (High Sierra), related issues and
bugs reported
● My first lame attempts to use DTrace with MariaDB Server
● My first lame attempts to use Instruments with MariaDB Server
2
www.percona.com
MariaDB Server on macOS - NOT SUPPORTED
● At least it is not supported by MariaDB Corporation or
Foundation
● We do not provide binaries for macOS
● There is no macOS host in the buildbot
● Somebody cares, so there are different versions in MacPorts
(that may work or not):
Yuliyas-Air:~ Valerii$ sudo port list | grep -i maria | grep server
mariadb-server @5.5.68 databases/mariadb
mariadb-10.0-server @10.0.38 databases/mariadb-10.0
mariadb-10.1-server @10.1.48 databases/mariadb-10.1
mariadb-10.2-server @10.2.41 databases/mariadb-10.2
mariadb-10.3-server @10.3.32 databases/mariadb-10.3
mariadb-10.4-server @10.4.22 databases/mariadb-10.4
mariadb-10.5-server @10.5.13 databases/mariadb-10.5
mariadb-10.6-server @10.6.5 databases/mariadb-10.6
mariadb-10.7-server @10.7.1 databases/mariadb-10.7
3
www.percona.com
MariaDB 10.6 Server on macOS from MacPorts…
● At least on my Air with macOS 10.13.6 there is a problem:
Yuliyas-Air:~ Valerii$ sudo port install mariadb-10.6
mariadb-10.6-server
…
---> Attempting to fetch mariadb-10.6-10.6.5_1.darwin_17.x86_64.tbz2
from http://nue.de.packages.macports.org/mariadb-10.6
---> Building mariadb-10.6
Error: Failed to build mariadb-10.6: command execution failed
Error: See
/opt/local/var/macports/logs/_opt_local_var_macports_sources_rsync.macp
orts.org_macports_release_tarballs_ports_databases_mariadb-10.6/mariadb
-10.6/main.log for details.
Error: Follow https://guide.macports.org/#project.tickets if you
believe there is a bug.
Error: Processing of port mariadb-10.6 failed
…
● But I still want to build and MariaDB server there…
4
www.percona.com
MariaDB Server on macOS - Known Bugs
● I know I am not the only upstream user on macOS, as
there are bug reports - 82 MDEVs matching now
● Who cares about them? 60 of the above are closed.
● I’ve reported the following while preparing for this talk:
○ MDEV-27402 - easy to workaround with a simple
patch
○ MDEV-27403 - closed, surely affected 10.4+ badly
when built with (unsupported) openssl 3. The fix may
be even released already
○ MDEV-27579 - assigned, client, readline-related, may
be workarounded with a patch
○ … 5
www.percona.com
Building on macOS - prerequisites
● This KB page is a good start, but it’s far from being complete…
● Install proper version of XCode for your macOS version, from here
Yuliyas-Air:server Valerii$ clang -v
Apple LLVM version 10.0.0 (clang-1000.10.44.4)
● Install MacPorts (or Homebrew)
● Install git and get the source code:
git clone https://github.com/MariaDB/server.git
git checkout 10.3
git submodule update --init --recursive
● Openssl version 3 is installed by default (not supported until 10.8.1),
you’ll need 1.1 for MariaDB 10.4+:
Yuliyas-Air:server Valerii$ sudo port list | grep openss | head -4
fbopenssl @0.0.4 devel/fbopenssl
openssl @3 devel/openssl
openssl10 @1.0.2u devel/openssl10
openssl11 @1.1.1l devel/openssl11
6
www.percona.com
Building on macOS - MariaDB Server 10.1
● Basically build works without any issues, good old version, even though no
longer supported
● Build out of source (mkdir buildtmp; cd buildtmp; …; rm -rf *;)
● Use as simple cmake command lines as possible. This usually works for my
purposes:
Yuliyas-Air:buildtmp Valerii$ cmake ..
-DCMAKE_INSTALL_PREFIX=/Users/Valerii/dbs/maria10.1
-DCMAKE_BUILD_TYPE=RelWithDebInfo -DENABLE_DTRACE=1
● Run MTR tests if you care about the usability of the results:
Yuliyas-Air:mysql-test Valerii$ ./mtr --force
…
MariaDB Version 10.1.49-MariaDB
…
connect.json [ pass ] 204
connect.part_file [ pass ] 292
…
7
www.percona.com
Building on macOS - MariaDB Server 10.2
● With this version I’ve hit my first problem during compilation, in
the mysql.cc client code:
…
[ 99%] Building CXX object client/CMakeFiles/mysql.dir/mysql.cc.o
/Users/Valerii/git/server/client/mysql.cc:1055:16: error: redefinition
of
'_hist_entry'
typedef struct _hist_entry {
^
/opt/local/include/editline/readline.h:57:16: note: previous definition
is here
typedef struct _hist_entry {
^
1 error generated.
● It was easy to resolve with a lame patch, but I still reported it
as MDEV-27587
8
www.percona.com
Building on macOS - MariaDB Server 10.3
● With this version I’ve got my second problem, with MTR tests:
Yuliyas-Air:mysql-test Valerii$ ./mtr main.connect
Logging: ./mtr main.connect
…
MariaDB Version 10.3.33-MariaDB
…
main.connect [ fail ]
Test ended at 2022-01-23 17:31:31
CURRENT_TEST: main.connect
Could not execute 'check-testcase' before testcase 'main.connect' (res:
1):
…
mysqltest: Start processing test commands from
'./include/check-testcase.test' ...
mysqltest: At line 19: query 'let $tmp= `SELECT '$tmp' = 'No such
row'`' failed: 2013: Lost connection to MySQL server during query
9
www.percona.com
Building on macOS - MariaDB Server 10.4+
● With these versions I was initially not able to get
mysql_install_db to work without crashes (so MTR fails too)
● The solution was eventually to install openssl 1.1 from ports
and make sure it is used:
Yuliyas-Air:buildtmp Valerii$ cmake ..
-DCMAKE_INSTALL_PREFIX=/Users/Valerii/dbs/maria10.6
-DCMAKE_BUILD_TYPE=RelWithDebInfo -DBUILD_CONFIG=mysql_release
-DFEATURE_SET=community -DWITH_EMBEDDED_SERVER=OFF
-DPLUGIN_TOKUDB=NO -DWITH_SSL=/opt/local/libexec/openssl11
-DENABLE_DTRACE=1
● 10.4 and 10.5 built cleanly (MTR tests problem aside), while
for 10.6 I had to add lame fixes to workaround some
problematic parts of the code when __APPLE_CC__ is
defined
10
www.percona.com
DTrace on macOS - Basics
● Read about DTrace here, or there, or anywhere…
● It is there in macOS, ready to use:
Yuliyas-Air:maria10.6 Valerii$ dtrace
Usage: dtrace [-aACeFHlqSvVwZ] [-arch i386|x86_64] [-b bufsz] [-c cmd]
[-D name[=def]]
[-I path] [-L path] [-o output] [-p pid] [-s script] [-U name]
[-x opt[=val]]
[-P provider [[ predicate ] action ]]
[-m [ provider: ] module [[ predicate ] action ]]
[-f [[ provider: ] module: ] func [[ predicate ] action ]]
[-n [[[ provider: ] module: ] func: ] name [[ predicate ] action ]]
[-i probe-id [[ predicate ] action ]] [ args ... ]
predicate -> '/' D-expression '/'
action -> '{' D-statements '}'
…
11
www.percona.com
DTrace on macOS - using DTrace probes
● DTrace (USDT) probes in the code, or static tracepoints:
Yuliyas-Air:maria10.6 Valerii$ sudo dtrace -l ./bin/mariadbd | grep
query-start
…
2464 mysql73374 mariadbd
_ZL17wsrep_mysql_parseP3THDPcjP12Parser_state [wsrep_mysql_parse(THD*,
char*, unsigned int, Parser_state*)] query-start
2465 mysql73374 mariadbd
_Z16dispatch_command19enum_server_commandP3THDPcjb
[dispatch_command(enum_server_command, THD*, char*, unsigned int, bool)]
query-start
● How to use them:
Yuliyas-Air:server Valerii$ grep -rni 'query-start' *
support-files/dtrace/query-time.d:28:mysql*:::query-start
…
support-files/dtrace/query-rowops.d:30:mysql*:::query-start
Yuliyas-Air:server Valerii$ cat support-files/dtrace/query-time.d
12
www.percona.com
DTrace on macOS - query execution time
● Slightly shortened query-time.d from the above:
Yuliyas-Air:maria10.6 Valerii$ cat /tmp/query-time.d
#!/usr/sbin/dtrace -s
#pragma D option quiet
dtrace:::BEGIN {
printf("%-20s %-20s %-40s %-9sn", "Who", "Database", "Query",
"Time(ms)");
}
mysql*:::query-start {
self->query = copyinstr(arg0);
self->connid = arg1;
self->db = copyinstr(arg2);
self->who = strjoin(copyinstr(arg3),strjoin("@",copyinstr(arg4)));
self->querystart = timestamp;
}
mysql*:::query-done {
printf("%-20s %-20s %-40s %-9dn",self->who,self->db,self->query,
(timestamp - self->querystart) / 1000000);
}
13
www.percona.com
DTrace on macOS - adding user probes
● Consider this lame example:
Yuliyas-Air:maria10.6 Valerii$ cat /tmp/userfunc.d
#!/usr/sbin/dtrace -s
#pragma D option flowindent
pid$1::$2:entry {
printf("Enter %sn", probefunc);
}
pid$1::$2:return {
printf("Return from %sn", probefunc);
}
● Now let’s apply it to all functions in the PID of mariadbd:
Yuliyas-Air:maria10.6 Valerii$ sudo /tmp/userfunc.d 61198 '*' >
/tmp/trace.txt
…
Failed to start process notifications for pid 61198 (19)
dtrace: script '/tmp/userfunc.d' matched 453035 probes
^CYuliyas-Air:maria10.6 Valerii$ ls -l /tmp/trace.txt
-rw-r--r-- 1 Valerii wheel 4162041 Jan 23 22:06 /tmp/trace.txt
14
www.percona.com
Instruments on macOS - what you can do?
● Instruments looks impressive, DTrace-based GUI
15
www.percona.com
MariaDB Server on macOS - Next Steps
● Studying DTrace and re-implementing/re-checking all Linux
bpftrace scripts, at scale!
● Building Percona Toolkit and sysbench from sources
Yuliyas-Air:sysbench Valerii$ src/sysbench --version
sysbench 1.1.0-df89d34
● Studying of some MariaDB Server performance problems on
macOS with better (?) instrumentation than ever
● Maybe working on proper fixes for MDEVs reported and new
ones
● macOS upgrades and related experience. Maybe newer
versions resolve problems I hit…
● Builds and tests on M1-based hardware, maybe one day…
● Blog posts pending. Stay tuned!
16
www.percona.com
Thank you!
Questions and Answers?
Please, search and report bugs at:
● https://jira.mariadb.org
17

More Related Content

What's hot

E bpf and dynamic tracing for mariadb db as (mariadb day during fosdem 2020)
E bpf and dynamic tracing for mariadb db as (mariadb day during fosdem 2020)E bpf and dynamic tracing for mariadb db as (mariadb day during fosdem 2020)
E bpf and dynamic tracing for mariadb db as (mariadb day during fosdem 2020)Valeriy Kravchuk
 
FOSDEM 2015: gdb tips and tricks for MySQL DBAs
FOSDEM 2015: gdb tips and tricks for MySQL DBAsFOSDEM 2015: gdb tips and tricks for MySQL DBAs
FOSDEM 2015: gdb tips and tricks for MySQL DBAsValerii Kravchuk
 
Instant add column for inno db in mariadb 10.3+ (fosdem 2018, second draft)
Instant add column for inno db in mariadb 10.3+ (fosdem 2018, second draft)Instant add column for inno db in mariadb 10.3+ (fosdem 2018, second draft)
Instant add column for inno db in mariadb 10.3+ (fosdem 2018, second draft)Valerii Kravchuk
 
More on gdb for my sql db as (fosdem 2016)
More on gdb for my sql db as (fosdem 2016)More on gdb for my sql db as (fosdem 2016)
More on gdb for my sql db as (fosdem 2016)Valeriy Kravchuk
 
MySQL Parallel Replication by Booking.com
MySQL Parallel Replication by Booking.comMySQL Parallel Replication by Booking.com
MySQL Parallel Replication by Booking.comJean-François Gagné
 
Dynamic tracing of MariaDB on Linux - problems and solutions (MariaDB Server ...
Dynamic tracing of MariaDB on Linux - problems and solutions (MariaDB Server ...Dynamic tracing of MariaDB on Linux - problems and solutions (MariaDB Server ...
Dynamic tracing of MariaDB on Linux - problems and solutions (MariaDB Server ...Valeriy Kravchuk
 
MariaDB 10.5 new features for troubleshooting (mariadb server fest 2020)
MariaDB 10.5 new features for troubleshooting (mariadb server fest 2020)MariaDB 10.5 new features for troubleshooting (mariadb server fest 2020)
MariaDB 10.5 new features for troubleshooting (mariadb server fest 2020)Valeriy Kravchuk
 
MySQL/MariaDB Parallel Replication: inventory, use-case and limitations
MySQL/MariaDB Parallel Replication: inventory, use-case and limitationsMySQL/MariaDB Parallel Replication: inventory, use-case and limitations
MySQL/MariaDB Parallel Replication: inventory, use-case and limitationsJean-François Gagné
 
MySQL Parallel Replication: inventory, use-case and limitations
MySQL Parallel Replication: inventory, use-case and limitationsMySQL Parallel Replication: inventory, use-case and limitations
MySQL Parallel Replication: inventory, use-case and limitationsJean-François Gagné
 
Mysql 56-experiences-bugs-solutions-50mins
Mysql 56-experiences-bugs-solutions-50minsMysql 56-experiences-bugs-solutions-50mins
Mysql 56-experiences-bugs-solutions-50minsValeriy Kravchuk
 
Make Your Life Easier With Maatkit
Make Your Life Easier With MaatkitMake Your Life Easier With Maatkit
Make Your Life Easier With MaatkitMySQLConference
 
Riding the Binlog: an in Deep Dissection of the Replication Stream
Riding the Binlog: an in Deep Dissection of the Replication StreamRiding the Binlog: an in Deep Dissection of the Replication Stream
Riding the Binlog: an in Deep Dissection of the Replication StreamJean-François Gagné
 
PERFORMANCE_SCHEMA and sys schema
PERFORMANCE_SCHEMA and sys schemaPERFORMANCE_SCHEMA and sys schema
PERFORMANCE_SCHEMA and sys schemaFromDual GmbH
 
MySQL Parallel Replication: inventory, use-case and limitations
MySQL Parallel Replication: inventory, use-case and limitationsMySQL Parallel Replication: inventory, use-case and limitations
MySQL Parallel Replication: inventory, use-case and limitationsJean-François Gagné
 
MySQL Parallel Replication (LOGICAL_CLOCK): all the 5.7 (and some of the 8.0)...
MySQL Parallel Replication (LOGICAL_CLOCK): all the 5.7 (and some of the 8.0)...MySQL Parallel Replication (LOGICAL_CLOCK): all the 5.7 (and some of the 8.0)...
MySQL Parallel Replication (LOGICAL_CLOCK): all the 5.7 (and some of the 8.0)...Jean-François Gagné
 
FOSDEM 2012: MySQL synchronous replication in practice with Galera
FOSDEM 2012: MySQL synchronous replication in practice with GaleraFOSDEM 2012: MySQL synchronous replication in practice with Galera
FOSDEM 2012: MySQL synchronous replication in practice with GaleraFromDual GmbH
 
MySQL Parallel Replication: inventory, use-cases and limitations
MySQL Parallel Replication: inventory, use-cases and limitationsMySQL Parallel Replication: inventory, use-cases and limitations
MySQL Parallel Replication: inventory, use-cases and limitationsJean-François Gagné
 
MySQL Performance schema missing_manual_flossuk
MySQL Performance schema missing_manual_flossukMySQL Performance schema missing_manual_flossuk
MySQL Performance schema missing_manual_flossukValeriy Kravchuk
 
The Full MySQL and MariaDB Parallel Replication Tutorial
The Full MySQL and MariaDB Parallel Replication TutorialThe Full MySQL and MariaDB Parallel Replication Tutorial
The Full MySQL and MariaDB Parallel Replication TutorialJean-François Gagné
 

What's hot (20)

E bpf and dynamic tracing for mariadb db as (mariadb day during fosdem 2020)
E bpf and dynamic tracing for mariadb db as (mariadb day during fosdem 2020)E bpf and dynamic tracing for mariadb db as (mariadb day during fosdem 2020)
E bpf and dynamic tracing for mariadb db as (mariadb day during fosdem 2020)
 
FOSDEM 2015: gdb tips and tricks for MySQL DBAs
FOSDEM 2015: gdb tips and tricks for MySQL DBAsFOSDEM 2015: gdb tips and tricks for MySQL DBAs
FOSDEM 2015: gdb tips and tricks for MySQL DBAs
 
Instant add column for inno db in mariadb 10.3+ (fosdem 2018, second draft)
Instant add column for inno db in mariadb 10.3+ (fosdem 2018, second draft)Instant add column for inno db in mariadb 10.3+ (fosdem 2018, second draft)
Instant add column for inno db in mariadb 10.3+ (fosdem 2018, second draft)
 
More on gdb for my sql db as (fosdem 2016)
More on gdb for my sql db as (fosdem 2016)More on gdb for my sql db as (fosdem 2016)
More on gdb for my sql db as (fosdem 2016)
 
MySQL Parallel Replication by Booking.com
MySQL Parallel Replication by Booking.comMySQL Parallel Replication by Booking.com
MySQL Parallel Replication by Booking.com
 
Dynamic tracing of MariaDB on Linux - problems and solutions (MariaDB Server ...
Dynamic tracing of MariaDB on Linux - problems and solutions (MariaDB Server ...Dynamic tracing of MariaDB on Linux - problems and solutions (MariaDB Server ...
Dynamic tracing of MariaDB on Linux - problems and solutions (MariaDB Server ...
 
MariaDB 10.5 new features for troubleshooting (mariadb server fest 2020)
MariaDB 10.5 new features for troubleshooting (mariadb server fest 2020)MariaDB 10.5 new features for troubleshooting (mariadb server fest 2020)
MariaDB 10.5 new features for troubleshooting (mariadb server fest 2020)
 
MySQL/MariaDB Parallel Replication: inventory, use-case and limitations
MySQL/MariaDB Parallel Replication: inventory, use-case and limitationsMySQL/MariaDB Parallel Replication: inventory, use-case and limitations
MySQL/MariaDB Parallel Replication: inventory, use-case and limitations
 
MySQL Parallel Replication: inventory, use-case and limitations
MySQL Parallel Replication: inventory, use-case and limitationsMySQL Parallel Replication: inventory, use-case and limitations
MySQL Parallel Replication: inventory, use-case and limitations
 
Mysql 56-experiences-bugs-solutions-50mins
Mysql 56-experiences-bugs-solutions-50minsMysql 56-experiences-bugs-solutions-50mins
Mysql 56-experiences-bugs-solutions-50mins
 
Make Your Life Easier With Maatkit
Make Your Life Easier With MaatkitMake Your Life Easier With Maatkit
Make Your Life Easier With Maatkit
 
Riding the Binlog: an in Deep Dissection of the Replication Stream
Riding the Binlog: an in Deep Dissection of the Replication StreamRiding the Binlog: an in Deep Dissection of the Replication Stream
Riding the Binlog: an in Deep Dissection of the Replication Stream
 
PERFORMANCE_SCHEMA and sys schema
PERFORMANCE_SCHEMA and sys schemaPERFORMANCE_SCHEMA and sys schema
PERFORMANCE_SCHEMA and sys schema
 
MySQL Parallel Replication: inventory, use-case and limitations
MySQL Parallel Replication: inventory, use-case and limitationsMySQL Parallel Replication: inventory, use-case and limitations
MySQL Parallel Replication: inventory, use-case and limitations
 
MySQL Parallel Replication (LOGICAL_CLOCK): all the 5.7 (and some of the 8.0)...
MySQL Parallel Replication (LOGICAL_CLOCK): all the 5.7 (and some of the 8.0)...MySQL Parallel Replication (LOGICAL_CLOCK): all the 5.7 (and some of the 8.0)...
MySQL Parallel Replication (LOGICAL_CLOCK): all the 5.7 (and some of the 8.0)...
 
FOSDEM 2012: MySQL synchronous replication in practice with Galera
FOSDEM 2012: MySQL synchronous replication in practice with GaleraFOSDEM 2012: MySQL synchronous replication in practice with Galera
FOSDEM 2012: MySQL synchronous replication in practice with Galera
 
MySQL Parallel Replication: inventory, use-cases and limitations
MySQL Parallel Replication: inventory, use-cases and limitationsMySQL Parallel Replication: inventory, use-cases and limitations
MySQL Parallel Replication: inventory, use-cases and limitations
 
NoSQL with MySQL
NoSQL with MySQLNoSQL with MySQL
NoSQL with MySQL
 
MySQL Performance schema missing_manual_flossuk
MySQL Performance schema missing_manual_flossukMySQL Performance schema missing_manual_flossuk
MySQL Performance schema missing_manual_flossuk
 
The Full MySQL and MariaDB Parallel Replication Tutorial
The Full MySQL and MariaDB Parallel Replication TutorialThe Full MySQL and MariaDB Parallel Replication Tutorial
The Full MySQL and MariaDB Parallel Replication Tutorial
 

Similar to MariaDB Server on macOS - FOSDEM 2022 MariaDB Devroom

High-availability with Galera Cluster for MySQL
High-availability with Galera Cluster for MySQLHigh-availability with Galera Cluster for MySQL
High-availability with Galera Cluster for MySQLFromDual GmbH
 
TrinityCore server install guide
TrinityCore server install guideTrinityCore server install guide
TrinityCore server install guideSeungmin Shin
 
Drupal, Memcache and Solr on Windows
Drupal, Memcache and Solr on WindowsDrupal, Memcache and Solr on Windows
Drupal, Memcache and Solr on WindowsAlessandro Pilotti
 
Architecting cloud
Architecting cloudArchitecting cloud
Architecting cloudTahsin Hasan
 
What's New in Docker 1.12 by Mike Goelzer and Andrea Luzzardi
What's New in Docker 1.12 by Mike Goelzer and Andrea LuzzardiWhat's New in Docker 1.12 by Mike Goelzer and Andrea Luzzardi
What's New in Docker 1.12 by Mike Goelzer and Andrea LuzzardiDocker, Inc.
 
What's New in Docker 1.12 (June 20, 2016) by Mike Goelzer & Andrea Luzzardi
What's New in Docker 1.12 (June 20, 2016) by Mike Goelzer & Andrea LuzzardiWhat's New in Docker 1.12 (June 20, 2016) by Mike Goelzer & Andrea Luzzardi
What's New in Docker 1.12 (June 20, 2016) by Mike Goelzer & Andrea LuzzardiMike Goelzer
 
MariaDB, MySQL and Ansible: automating database infrastructures
MariaDB, MySQL and Ansible: automating database infrastructuresMariaDB, MySQL and Ansible: automating database infrastructures
MariaDB, MySQL and Ansible: automating database infrastructuresFederico Razzoli
 
Real World Experience of Running Docker in Development and Production
Real World Experience of Running Docker in Development and ProductionReal World Experience of Running Docker in Development and Production
Real World Experience of Running Docker in Development and ProductionBen Hall
 
MySQL for Oracle DBAs
MySQL for Oracle DBAsMySQL for Oracle DBAs
MySQL for Oracle DBAsFromDual GmbH
 
OSMC 2019 | Use Cloud services & features in your redundant Icinga2 Environme...
OSMC 2019 | Use Cloud services & features in your redundant Icinga2 Environme...OSMC 2019 | Use Cloud services & features in your redundant Icinga2 Environme...
OSMC 2019 | Use Cloud services & features in your redundant Icinga2 Environme...NETWAYS
 
MariaDB10.7_install_Ubuntu.docx
MariaDB10.7_install_Ubuntu.docxMariaDB10.7_install_Ubuntu.docx
MariaDB10.7_install_Ubuntu.docxNeoClova
 
Oreilly Webcast 01 19 10
Oreilly Webcast 01 19 10Oreilly Webcast 01 19 10
Oreilly Webcast 01 19 10Sean Hull
 
Caching and tuning fun for high scalability
Caching and tuning fun for high scalabilityCaching and tuning fun for high scalability
Caching and tuning fun for high scalabilityWim Godden
 
MySQL always-up with Galera Cluster
MySQL always-up with Galera ClusterMySQL always-up with Galera Cluster
MySQL always-up with Galera ClusterFromDual GmbH
 
Deploying Windows Containers on Windows Server 2016
Deploying Windows Containers on Windows Server 2016Deploying Windows Containers on Windows Server 2016
Deploying Windows Containers on Windows Server 2016Ben Hall
 
MySQL for Beginners - part 1
MySQL for Beginners - part 1MySQL for Beginners - part 1
MySQL for Beginners - part 1Ivan Zoratti
 
Summer of Fuzz: macOS
Summer of Fuzz: macOSSummer of Fuzz: macOS
Summer of Fuzz: macOSJeremy Brown
 

Similar to MariaDB Server on macOS - FOSDEM 2022 MariaDB Devroom (20)

High-availability with Galera Cluster for MySQL
High-availability with Galera Cluster for MySQLHigh-availability with Galera Cluster for MySQL
High-availability with Galera Cluster for MySQL
 
My SQL 101
My SQL 101My SQL 101
My SQL 101
 
TrinityCore server install guide
TrinityCore server install guideTrinityCore server install guide
TrinityCore server install guide
 
Drupal, Memcache and Solr on Windows
Drupal, Memcache and Solr on WindowsDrupal, Memcache and Solr on Windows
Drupal, Memcache and Solr on Windows
 
My name is Trinidad
My name is TrinidadMy name is Trinidad
My name is Trinidad
 
Architecting cloud
Architecting cloudArchitecting cloud
Architecting cloud
 
What's New in Docker 1.12 by Mike Goelzer and Andrea Luzzardi
What's New in Docker 1.12 by Mike Goelzer and Andrea LuzzardiWhat's New in Docker 1.12 by Mike Goelzer and Andrea Luzzardi
What's New in Docker 1.12 by Mike Goelzer and Andrea Luzzardi
 
What's New in Docker 1.12 (June 20, 2016) by Mike Goelzer & Andrea Luzzardi
What's New in Docker 1.12 (June 20, 2016) by Mike Goelzer & Andrea LuzzardiWhat's New in Docker 1.12 (June 20, 2016) by Mike Goelzer & Andrea Luzzardi
What's New in Docker 1.12 (June 20, 2016) by Mike Goelzer & Andrea Luzzardi
 
MariaDB, MySQL and Ansible: automating database infrastructures
MariaDB, MySQL and Ansible: automating database infrastructuresMariaDB, MySQL and Ansible: automating database infrastructures
MariaDB, MySQL and Ansible: automating database infrastructures
 
Real World Experience of Running Docker in Development and Production
Real World Experience of Running Docker in Development and ProductionReal World Experience of Running Docker in Development and Production
Real World Experience of Running Docker in Development and Production
 
MySQL for Oracle DBAs
MySQL for Oracle DBAsMySQL for Oracle DBAs
MySQL for Oracle DBAs
 
OSMC 2019 | Use Cloud services & features in your redundant Icinga2 Environme...
OSMC 2019 | Use Cloud services & features in your redundant Icinga2 Environme...OSMC 2019 | Use Cloud services & features in your redundant Icinga2 Environme...
OSMC 2019 | Use Cloud services & features in your redundant Icinga2 Environme...
 
MariaDB10.7_install_Ubuntu.docx
MariaDB10.7_install_Ubuntu.docxMariaDB10.7_install_Ubuntu.docx
MariaDB10.7_install_Ubuntu.docx
 
Oreilly Webcast 01 19 10
Oreilly Webcast 01 19 10Oreilly Webcast 01 19 10
Oreilly Webcast 01 19 10
 
Caching and tuning fun for high scalability
Caching and tuning fun for high scalabilityCaching and tuning fun for high scalability
Caching and tuning fun for high scalability
 
Memcached Study
Memcached StudyMemcached Study
Memcached Study
 
MySQL always-up with Galera Cluster
MySQL always-up with Galera ClusterMySQL always-up with Galera Cluster
MySQL always-up with Galera Cluster
 
Deploying Windows Containers on Windows Server 2016
Deploying Windows Containers on Windows Server 2016Deploying Windows Containers on Windows Server 2016
Deploying Windows Containers on Windows Server 2016
 
MySQL for Beginners - part 1
MySQL for Beginners - part 1MySQL for Beginners - part 1
MySQL for Beginners - part 1
 
Summer of Fuzz: macOS
Summer of Fuzz: macOSSummer of Fuzz: macOS
Summer of Fuzz: macOS
 

Recently uploaded

Professional Resume Template for Software Developers
Professional Resume Template for Software DevelopersProfessional Resume Template for Software Developers
Professional Resume Template for Software DevelopersVinodh Ram
 
The Evolution of Karaoke From Analog to App.pdf
The Evolution of Karaoke From Analog to App.pdfThe Evolution of Karaoke From Analog to App.pdf
The Evolution of Karaoke From Analog to App.pdfPower Karaoke
 
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time ApplicationsUnveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time ApplicationsAlberto González Trastoy
 
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASE
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASEBATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASE
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASEOrtus Solutions, Corp
 
Project Based Learning (A.I).pptx detail explanation
Project Based Learning (A.I).pptx detail explanationProject Based Learning (A.I).pptx detail explanation
Project Based Learning (A.I).pptx detail explanationkaushalgiri8080
 
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...Christina Lin
 
cybersecurity notes for mca students for learning
cybersecurity notes for mca students for learningcybersecurity notes for mca students for learning
cybersecurity notes for mca students for learningVitsRangannavar
 
Building Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
Building Real-Time Data Pipelines: Stream & Batch Processing workshop SlideBuilding Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
Building Real-Time Data Pipelines: Stream & Batch Processing workshop SlideChristina Lin
 
Asset Management Software - Infographic
Asset Management Software - InfographicAsset Management Software - Infographic
Asset Management Software - InfographicHr365.us smith
 
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer Data
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer DataAdobe Marketo Engage Deep Dives: Using Webhooks to Transfer Data
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer DataBradBedford3
 
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...stazi3110
 
Engage Usergroup 2024 - The Good The Bad_The Ugly
Engage Usergroup 2024 - The Good The Bad_The UglyEngage Usergroup 2024 - The Good The Bad_The Ugly
Engage Usergroup 2024 - The Good The Bad_The UglyFrank van der Linden
 
EY_Graph Database Powered Sustainability
EY_Graph Database Powered SustainabilityEY_Graph Database Powered Sustainability
EY_Graph Database Powered SustainabilityNeo4j
 
Advancing Engineering with AI through the Next Generation of Strategic Projec...
Advancing Engineering with AI through the Next Generation of Strategic Projec...Advancing Engineering with AI through the Next Generation of Strategic Projec...
Advancing Engineering with AI through the Next Generation of Strategic Projec...OnePlan Solutions
 
HR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.comHR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.comFatema Valibhai
 
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...MyIntelliSource, Inc.
 
Hand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptxHand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptxbodapatigopi8531
 
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptx
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptxKnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptx
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptxTier1 app
 
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...gurkirankumar98700
 
why an Opensea Clone Script might be your perfect match.pdf
why an Opensea Clone Script might be your perfect match.pdfwhy an Opensea Clone Script might be your perfect match.pdf
why an Opensea Clone Script might be your perfect match.pdfjoe51371421
 

Recently uploaded (20)

Professional Resume Template for Software Developers
Professional Resume Template for Software DevelopersProfessional Resume Template for Software Developers
Professional Resume Template for Software Developers
 
The Evolution of Karaoke From Analog to App.pdf
The Evolution of Karaoke From Analog to App.pdfThe Evolution of Karaoke From Analog to App.pdf
The Evolution of Karaoke From Analog to App.pdf
 
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time ApplicationsUnveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
 
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASE
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASEBATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASE
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASE
 
Project Based Learning (A.I).pptx detail explanation
Project Based Learning (A.I).pptx detail explanationProject Based Learning (A.I).pptx detail explanation
Project Based Learning (A.I).pptx detail explanation
 
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...
 
cybersecurity notes for mca students for learning
cybersecurity notes for mca students for learningcybersecurity notes for mca students for learning
cybersecurity notes for mca students for learning
 
Building Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
Building Real-Time Data Pipelines: Stream & Batch Processing workshop SlideBuilding Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
Building Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
 
Asset Management Software - Infographic
Asset Management Software - InfographicAsset Management Software - Infographic
Asset Management Software - Infographic
 
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer Data
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer DataAdobe Marketo Engage Deep Dives: Using Webhooks to Transfer Data
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer Data
 
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
 
Engage Usergroup 2024 - The Good The Bad_The Ugly
Engage Usergroup 2024 - The Good The Bad_The UglyEngage Usergroup 2024 - The Good The Bad_The Ugly
Engage Usergroup 2024 - The Good The Bad_The Ugly
 
EY_Graph Database Powered Sustainability
EY_Graph Database Powered SustainabilityEY_Graph Database Powered Sustainability
EY_Graph Database Powered Sustainability
 
Advancing Engineering with AI through the Next Generation of Strategic Projec...
Advancing Engineering with AI through the Next Generation of Strategic Projec...Advancing Engineering with AI through the Next Generation of Strategic Projec...
Advancing Engineering with AI through the Next Generation of Strategic Projec...
 
HR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.comHR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.com
 
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
 
Hand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptxHand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptx
 
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptx
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptxKnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptx
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptx
 
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
 
why an Opensea Clone Script might be your perfect match.pdf
why an Opensea Clone Script might be your perfect match.pdfwhy an Opensea Clone Script might be your perfect match.pdf
why an Opensea Clone Script might be your perfect match.pdf
 

MariaDB Server on macOS - FOSDEM 2022 MariaDB Devroom

  • 1. MariaDB Server on macOS On my lame attempts to build and use it on 10.13.6 Valerii Kravchuk, Principal Support Engineer, MariaDB valerii.kravchuk@mariadb.com 1
  • 2. www.percona.com What is this session about? ● Why bother to run MariaDB Server on macOS? ○ Because I can, I have a spare MacBook Air at hand, and I want to study and use DTrace, Instruments and other macOS specific tools, and test more (also on M1 eventually) ● Status of MariaDB Server on macOS ● Building recent MariaDB Server 10.1 … 10.6 from GitHub sources on macOS 10.13.6 (High Sierra), related issues and bugs reported ● My first lame attempts to use DTrace with MariaDB Server ● My first lame attempts to use Instruments with MariaDB Server 2
  • 3. www.percona.com MariaDB Server on macOS - NOT SUPPORTED ● At least it is not supported by MariaDB Corporation or Foundation ● We do not provide binaries for macOS ● There is no macOS host in the buildbot ● Somebody cares, so there are different versions in MacPorts (that may work or not): Yuliyas-Air:~ Valerii$ sudo port list | grep -i maria | grep server mariadb-server @5.5.68 databases/mariadb mariadb-10.0-server @10.0.38 databases/mariadb-10.0 mariadb-10.1-server @10.1.48 databases/mariadb-10.1 mariadb-10.2-server @10.2.41 databases/mariadb-10.2 mariadb-10.3-server @10.3.32 databases/mariadb-10.3 mariadb-10.4-server @10.4.22 databases/mariadb-10.4 mariadb-10.5-server @10.5.13 databases/mariadb-10.5 mariadb-10.6-server @10.6.5 databases/mariadb-10.6 mariadb-10.7-server @10.7.1 databases/mariadb-10.7 3
  • 4. www.percona.com MariaDB 10.6 Server on macOS from MacPorts… ● At least on my Air with macOS 10.13.6 there is a problem: Yuliyas-Air:~ Valerii$ sudo port install mariadb-10.6 mariadb-10.6-server … ---> Attempting to fetch mariadb-10.6-10.6.5_1.darwin_17.x86_64.tbz2 from http://nue.de.packages.macports.org/mariadb-10.6 ---> Building mariadb-10.6 Error: Failed to build mariadb-10.6: command execution failed Error: See /opt/local/var/macports/logs/_opt_local_var_macports_sources_rsync.macp orts.org_macports_release_tarballs_ports_databases_mariadb-10.6/mariadb -10.6/main.log for details. Error: Follow https://guide.macports.org/#project.tickets if you believe there is a bug. Error: Processing of port mariadb-10.6 failed … ● But I still want to build and MariaDB server there… 4
  • 5. www.percona.com MariaDB Server on macOS - Known Bugs ● I know I am not the only upstream user on macOS, as there are bug reports - 82 MDEVs matching now ● Who cares about them? 60 of the above are closed. ● I’ve reported the following while preparing for this talk: ○ MDEV-27402 - easy to workaround with a simple patch ○ MDEV-27403 - closed, surely affected 10.4+ badly when built with (unsupported) openssl 3. The fix may be even released already ○ MDEV-27579 - assigned, client, readline-related, may be workarounded with a patch ○ … 5
  • 6. www.percona.com Building on macOS - prerequisites ● This KB page is a good start, but it’s far from being complete… ● Install proper version of XCode for your macOS version, from here Yuliyas-Air:server Valerii$ clang -v Apple LLVM version 10.0.0 (clang-1000.10.44.4) ● Install MacPorts (or Homebrew) ● Install git and get the source code: git clone https://github.com/MariaDB/server.git git checkout 10.3 git submodule update --init --recursive ● Openssl version 3 is installed by default (not supported until 10.8.1), you’ll need 1.1 for MariaDB 10.4+: Yuliyas-Air:server Valerii$ sudo port list | grep openss | head -4 fbopenssl @0.0.4 devel/fbopenssl openssl @3 devel/openssl openssl10 @1.0.2u devel/openssl10 openssl11 @1.1.1l devel/openssl11 6
  • 7. www.percona.com Building on macOS - MariaDB Server 10.1 ● Basically build works without any issues, good old version, even though no longer supported ● Build out of source (mkdir buildtmp; cd buildtmp; …; rm -rf *;) ● Use as simple cmake command lines as possible. This usually works for my purposes: Yuliyas-Air:buildtmp Valerii$ cmake .. -DCMAKE_INSTALL_PREFIX=/Users/Valerii/dbs/maria10.1 -DCMAKE_BUILD_TYPE=RelWithDebInfo -DENABLE_DTRACE=1 ● Run MTR tests if you care about the usability of the results: Yuliyas-Air:mysql-test Valerii$ ./mtr --force … MariaDB Version 10.1.49-MariaDB … connect.json [ pass ] 204 connect.part_file [ pass ] 292 … 7
  • 8. www.percona.com Building on macOS - MariaDB Server 10.2 ● With this version I’ve hit my first problem during compilation, in the mysql.cc client code: … [ 99%] Building CXX object client/CMakeFiles/mysql.dir/mysql.cc.o /Users/Valerii/git/server/client/mysql.cc:1055:16: error: redefinition of '_hist_entry' typedef struct _hist_entry { ^ /opt/local/include/editline/readline.h:57:16: note: previous definition is here typedef struct _hist_entry { ^ 1 error generated. ● It was easy to resolve with a lame patch, but I still reported it as MDEV-27587 8
  • 9. www.percona.com Building on macOS - MariaDB Server 10.3 ● With this version I’ve got my second problem, with MTR tests: Yuliyas-Air:mysql-test Valerii$ ./mtr main.connect Logging: ./mtr main.connect … MariaDB Version 10.3.33-MariaDB … main.connect [ fail ] Test ended at 2022-01-23 17:31:31 CURRENT_TEST: main.connect Could not execute 'check-testcase' before testcase 'main.connect' (res: 1): … mysqltest: Start processing test commands from './include/check-testcase.test' ... mysqltest: At line 19: query 'let $tmp= `SELECT '$tmp' = 'No such row'`' failed: 2013: Lost connection to MySQL server during query 9
  • 10. www.percona.com Building on macOS - MariaDB Server 10.4+ ● With these versions I was initially not able to get mysql_install_db to work without crashes (so MTR fails too) ● The solution was eventually to install openssl 1.1 from ports and make sure it is used: Yuliyas-Air:buildtmp Valerii$ cmake .. -DCMAKE_INSTALL_PREFIX=/Users/Valerii/dbs/maria10.6 -DCMAKE_BUILD_TYPE=RelWithDebInfo -DBUILD_CONFIG=mysql_release -DFEATURE_SET=community -DWITH_EMBEDDED_SERVER=OFF -DPLUGIN_TOKUDB=NO -DWITH_SSL=/opt/local/libexec/openssl11 -DENABLE_DTRACE=1 ● 10.4 and 10.5 built cleanly (MTR tests problem aside), while for 10.6 I had to add lame fixes to workaround some problematic parts of the code when __APPLE_CC__ is defined 10
  • 11. www.percona.com DTrace on macOS - Basics ● Read about DTrace here, or there, or anywhere… ● It is there in macOS, ready to use: Yuliyas-Air:maria10.6 Valerii$ dtrace Usage: dtrace [-aACeFHlqSvVwZ] [-arch i386|x86_64] [-b bufsz] [-c cmd] [-D name[=def]] [-I path] [-L path] [-o output] [-p pid] [-s script] [-U name] [-x opt[=val]] [-P provider [[ predicate ] action ]] [-m [ provider: ] module [[ predicate ] action ]] [-f [[ provider: ] module: ] func [[ predicate ] action ]] [-n [[[ provider: ] module: ] func: ] name [[ predicate ] action ]] [-i probe-id [[ predicate ] action ]] [ args ... ] predicate -> '/' D-expression '/' action -> '{' D-statements '}' … 11
  • 12. www.percona.com DTrace on macOS - using DTrace probes ● DTrace (USDT) probes in the code, or static tracepoints: Yuliyas-Air:maria10.6 Valerii$ sudo dtrace -l ./bin/mariadbd | grep query-start … 2464 mysql73374 mariadbd _ZL17wsrep_mysql_parseP3THDPcjP12Parser_state [wsrep_mysql_parse(THD*, char*, unsigned int, Parser_state*)] query-start 2465 mysql73374 mariadbd _Z16dispatch_command19enum_server_commandP3THDPcjb [dispatch_command(enum_server_command, THD*, char*, unsigned int, bool)] query-start ● How to use them: Yuliyas-Air:server Valerii$ grep -rni 'query-start' * support-files/dtrace/query-time.d:28:mysql*:::query-start … support-files/dtrace/query-rowops.d:30:mysql*:::query-start Yuliyas-Air:server Valerii$ cat support-files/dtrace/query-time.d 12
  • 13. www.percona.com DTrace on macOS - query execution time ● Slightly shortened query-time.d from the above: Yuliyas-Air:maria10.6 Valerii$ cat /tmp/query-time.d #!/usr/sbin/dtrace -s #pragma D option quiet dtrace:::BEGIN { printf("%-20s %-20s %-40s %-9sn", "Who", "Database", "Query", "Time(ms)"); } mysql*:::query-start { self->query = copyinstr(arg0); self->connid = arg1; self->db = copyinstr(arg2); self->who = strjoin(copyinstr(arg3),strjoin("@",copyinstr(arg4))); self->querystart = timestamp; } mysql*:::query-done { printf("%-20s %-20s %-40s %-9dn",self->who,self->db,self->query, (timestamp - self->querystart) / 1000000); } 13
  • 14. www.percona.com DTrace on macOS - adding user probes ● Consider this lame example: Yuliyas-Air:maria10.6 Valerii$ cat /tmp/userfunc.d #!/usr/sbin/dtrace -s #pragma D option flowindent pid$1::$2:entry { printf("Enter %sn", probefunc); } pid$1::$2:return { printf("Return from %sn", probefunc); } ● Now let’s apply it to all functions in the PID of mariadbd: Yuliyas-Air:maria10.6 Valerii$ sudo /tmp/userfunc.d 61198 '*' > /tmp/trace.txt … Failed to start process notifications for pid 61198 (19) dtrace: script '/tmp/userfunc.d' matched 453035 probes ^CYuliyas-Air:maria10.6 Valerii$ ls -l /tmp/trace.txt -rw-r--r-- 1 Valerii wheel 4162041 Jan 23 22:06 /tmp/trace.txt 14
  • 15. www.percona.com Instruments on macOS - what you can do? ● Instruments looks impressive, DTrace-based GUI 15
  • 16. www.percona.com MariaDB Server on macOS - Next Steps ● Studying DTrace and re-implementing/re-checking all Linux bpftrace scripts, at scale! ● Building Percona Toolkit and sysbench from sources Yuliyas-Air:sysbench Valerii$ src/sysbench --version sysbench 1.1.0-df89d34 ● Studying of some MariaDB Server performance problems on macOS with better (?) instrumentation than ever ● Maybe working on proper fixes for MDEVs reported and new ones ● macOS upgrades and related experience. Maybe newer versions resolve problems I hit… ● Builds and tests on M1-based hardware, maybe one day… ● Blog posts pending. Stay tuned! 16
  • 17. www.percona.com Thank you! Questions and Answers? Please, search and report bugs at: ● https://jira.mariadb.org 17