SlideShare a Scribd company logo
Troubleshooting MySQL
from a MySQL Developer
Perspective
Marcelo Altmann
Software Developer - Percona
Percona Live Austin / May 2022
Marcelo Altmann
● Software Developer @ Percona
○ Joined in 2016 as Senior Support
Engineer
○ PXB / PS / PXC
○ Member Bugs Escalation Committee
Software bug
Software bug
A software bug is an error, flaw or fault in computer software that causes it to produce an
incorrect or unexpected result, or to behave in unintended ways - wikipidia
● Wrong query results
● Performance degradations
● Security flaw
● Crash
Reproducible
test case
The history of a dev
Reproducible test case
● Been able to reproduce a bug is key
● Projects have their own test framework
● Used to ensure we don't introduce regressions.
● MySQL MTR
○ Start mysql instance:
./mtr --start alias &
mysql –defaults-file=var/my.cnf
○ Interactive GDB session:
./mtr --manual-gdb alias
gdb -cd ./ -x ./var/tmp/gdbinit.mysqld.1 ../bin/mysqld
Reproducible test case
● Recompile with Debug synchronization :
open_tables(...)
DEBUG_SYNC(thd, "after_open_tables");
lock_tables(...)
--connection conn1
SET DEBUG_SYNC= 'after_open_tables SIGNAL opened WAIT_FOR flushed';
send INSERT INTO t1 VALUES(1);
--connection conn2
SET DEBUG_SYNC= 'now WAIT_FOR opened';
SET DEBUG_SYNC= 'after_abort_locks SIGNAL flushed';
FLUSH TABLE t1;
Reproducible test case
● Recompile with Test Faults Macros :
somefile.cc
DBUG_EXECUTE_IF("some_keyword", {
some_function();
some_variable++;
};);
mysql> SET debug = '+d,some_keyword';
Stack traces
Crash fingerprint
Stack Traces - Signals
● A way of software / kernel / user to communicate with a process.
● Program will interpret and handle it - mysqld.cc my_init_signals()
Stack Traces - Signals
● SIGABRT / 6 - Code Assertions
○ ut_a(condition) / ut_ad(condition)
○ Critical points of code - continuing might cause damage
● SIGSEGV / 11 - Segmentation Fault
○ Memory access violation
○ Tried to access restricted memory area
● SIGTERM / 15 - Terminate
○ shutdown
Stack Traces
1
2
3
4
Divide and conquer
Page Cleaner bug
Divide and conquer
● Goal is to establish when this started to happen
● Remove as much as unknown as you can
○ Issue is happening on latest version?
○ Issue is happening on latest version minus 1 / 2 / 3 / … versions?
○ Issue is happening on previous major version (8.0 -> 5.7) ?
● ( PXB / PXC ) - Is the issue specific to the product?
Divide and conquer
● PXB-2742 as example:
● Start Point - partitions -> full backup -> inc backup (one or many) -> prepare full ->
prepare inc (one or many) -> crash (sometimes)
● partitions ? = full backup -> inc backup (one or many) -> prepare full -> prepare inc
(one or many) -> crash (sometimes)
Divide and conquer
● Incrementals ? = full backup -> prepare full -> crash (sometimes)
● Investigate (prepare full):
a. Innodb Master Thread Doing idle task
b. Merging Insert Buffer at full io capacity
■ Ask the pages to be read in to BP (async IO) (IO_BUF_READ)
c. IO Read Thread read the page
■ Merge Ibuf changes - Add page to Flush list
d. Shutdown
e. IO Read Thread complete the read/ibuf merge of page (IO_BUF_NONE)
Divide and conquer
● Can I reproduce the same on server?
● DBUG_EXECUTE_IF - shutdown - full ibuf merge
● Yes !!! 8.0 & 5.7 PS and upstream affected.
● PS-8174 / #107069 Crash -> private =(
● From a complex set of multiple variables (partition, xtrabackup, multiple
incremental) to "simple" server bug.
Regression = git bisect
Wrong query result bug
Regression = git bisect
● PS-7019 / #99398
● Works ok on 8.0.19
● Does NOT work on 8.0.20
Regression = git bisect
mysql> SELECT * FROM t1;
+-------+-------+
| t1_id | t2_id |
+-------+-------+
| 1 | 1000 |
| 2 | 5 |
+-------+-------+
2 rows in set (0,00 sec)
mysql> SELECT * FROM t2;
+-------+-----------+
| t2_id | is_active |
+-------+-----------+
| 2 | 1 |
| 3 | 0 |
| 1000 | 1 |
+-------+-----------+
3 rows in set (0,00 sec)
8.0.19> SELECT t1.*, t2.t2_id FROM t1 LEFT JOIN
t2 ON (t1.t2_id = t2.t2_id) GROUP BY t1_id;
+-------+-------+-------+
| t1_id | t2_id | t2_id |
+-------+-------+-------+
| 1 | 1000 | 1000 |
| 2 | 5 | NULL |
+-------+-------+-------+
2 rows in set (0,00 sec)
8.0.20> SELECT t1.*, t2.t2_id FROM t1 LEFT JOIN
t2 ON (t1.t2_id = t2.t2_id) GROUP BY t1_id;
+-------+-------+-------+
| t1_id | t2_id | t2_id |
+-------+-------+-------+
| 1 | 1000 | NULL |
| 2 | 5 | NULL |
+-------+-------+-------+
2 rows in set (0,00 sec)
Regression = git bisect
● Finding a Regression in MySQL Source Code: A Case Study
● Lines (737+K):
git diff mysql-8.0.19..mysql-8.0.20 | wc -l
737454
● Files (~4.5K):
git diff mysql-8.0.19..mysql-8.0.20 --name-only | wc -l
4495
● Commits (~2K):
git log mysql-8.0.19..mysql-8.0.20 --pretty=oneline | wc -l
1966
Regression = git bisect
Regression = git bisect
Regression = git bisect
Regression = git bisect
Regression = git bisect
● Manual:
a. git bisect start mysql-8.0.20 mysql-8.0.19
b. test
c. git bisect [good | bad]
Regression = git bisect
● Automated:
git bisect run sh -c '
compile_mysql.sh
if [ "$?" -ne "0" ]; then
exit 125
fi
./mysql-test/mtr bisect
if [ "$?" -eq "0" ]; then
exit 0
else
exit 1
fi'
Regression = git bisect
● Bug#30460528: RENAME FIELD::REAL_MAYBE_NULL() TO FIELD::IS_NULLABLE()
● https://github.com/mysql/mysql-
server/commit/3039fac3969f7c1521863bfe1513631986d2b6bd
Regression = git bisect
GDB / Coredump / PMP
Internal thread Deadlock bug
GDB
● GNU Debugger
● Works in various languages (C / C++ / Go / others)
● Can be used:
a. Remote
b. Live process - gdb -p PID
c. Starting a process - gdb –args mysqld –datadir=.....
d. Offline (coredump) - gdb bin/mysqld core.xxxxx
GDB
● Break point - stop the execution when a function is called.
● Condition break point - same as above but with condition (var1 == value)
● Watchpoints - same as break point but stop the execution when a variable is
read / written / or both
● Next - execute the code until the next line.
● Continue - execute the code until the next break point.
● Step - enter the function.
● Bt - Mostrar Backtrace / Stack trace.
● Frame - pular para frame especídico dentro da backtrace.
Coredump
● Snapshot / Dump of process memory
● Used alongside with GDB + binary of process
● Allows to check variables when the snapshot was collected
● Normally collected when process crash
● Can be collected on demand by gcore or gdb generate-core-file (eg: mysqld is
frozen and I can't get in)
Coredump
● On crash:
a. Requires mysqld to be configured with –core-file and linux config:
echo 2 > /proc/sys/fs/suid_dumpable
mkdir /tmp/corefiles
chmod 777 /tmp/corefiles
echo "/tmp/corefiles/core" >
/proc/sys/kernel/core_pattern
echo "1" > /proc/sys/kernel/core_uses_pid
Mysqld --core-file
b. PS - mysqld --coredumper=/PATH
Coredump
Poor Man's Profiler - PMP
● Aggregates identical stack traces
● Very useful for coredumps with high number of threads
● https://poormansprofiler.org/
● Available via percona toolkit
pt-pmp
GDB / Coredump / pt-pmp
GDB / Coredump / pt-pmp
GDB / Coredump / pt-pmp
● All 4996 threads wait on mutex from Thread 38
GDB / Coredump / pt-pmp
GDB / Coredump / pt-pmp
● All 4996 threads are trying to connect and waiting on mutex from Thread 38
● Thread 38
○ SELECT * FROM performance_schema.session_variables WHERE
VARIABLE_NAME LIKE 'binlog_transaction_dependency_tracking'
○ Wait on mutex from Thread 44
GDB / Coredump / pt-pmp
GDB / Coredump / pt-pmp
● All 4996 threads are trying to connect and waiting on mutex from Thread 38
● Thread 38
○ SELECT * FROM performance_schema.session_variables WHERE
VARIABLE_NAME LIKE 'binlog_transaction_dependency_tracking'
○ Wait on mutex from Thread 44
● Thread 44
○ SHOW BINARY LOGS
○ Wait on mutex from Thread 42
GDB / Coredump / pt-pmp
GDB / Coredump / pt-pmp
● All 4996 threads are trying to connect and waiting on mutex from Thread 38
● Thread 38
○ SELECT * FROM performance_schema.session_variables WHERE
VARIABLE_NAME LIKE 'binlog_transaction_dependency_tracking'
○ Wait on mutex from Thread 44
● Thread 44
○ SHOW BINARY LOGS
○ Wait on mutex from Thread 42
● Thread 42
○ PURGE BINARY LOGS BEFORE NOW()
○ Wait on mutex from Thread 38
GDB / Coredump / pt-pmp
● Loop in wait-for graph
● Bug: Deadlock during purge_logs_before_date - PS-1049 #91941
Record & Replay
Xtrabackup incremental backup bug
Record & Replay
● Created by Mozilla - https://rr-project.org/
● Open Source - https://github.com/rr-debugger/rr
● Record once, replay deterministically as many times you want
● Let you replay the code backwards
● Run on a GDB session
● Hard to reproduce bugs
● Complex bugs
Record & Replay
● Replay the Execution of MySQL With RR (Record and Replay)
● PXB-2180
● PXB crash randomly after applying N incremental backups
● Not always the same stack trace - Crash on different parts of InnoDB
● Always trying to apply a record on same Space=>Page
Record & Replay
● Page layout diverted somehow between PXB and Server
● Crash on N th inc is a consequence of something wrong on N-M th inc.
● Run MySQL under RR
● Make a copy of all backups so we can re-run –prepare when the issue happens
● Read the LSNs for this same page before/after each backup prepare (od).
● Identify all changes to m_space = 4294967294 & m_page_no = 5 at mysqld.
● Got a reproducible backup - 6th incremental was crashing
Record & Replay
● m_space = 4294967294 correspond to the MySQL data dictionary (mysql.ibd) –
dict0dict.h:1146
● On disk page, LSN is stored at the 16th byte of the page and has a size of 8 bytes –
fil0types.h:66
● Pages are written sequentially to disk, as an example, for the default 16k page size,
from bytes 1 to 16384 will have the data for page 0, from byte 16385 to 32768 data
from page 1, and so on.
● Frame is raw data of a page – buf0buf.h:1358
Record & Replay
BF: 0x1102185
Record & Replay
BF: 0x1102185
AF: 0x1100706
Record & Replay
BF: 0x1102185
AF: 0x1100706
I1: 0x1231906
Record & Replay
BF: 0x1102185
AF: 0x1100706
I1: 0x1231906
. . .
I3: 0x1474d3f
Record & Replay
BF: 0x1102185
AF: 0x1100706
I1: 0x1231906
. . .
I3: 0x1474d3f
B: 0x15fa326
S: 0x19f3fc9
Record & Replay
BF: 0x1102185
AF: 0x1100706
I1: 0x1231906
. . .
I3: 0x1474d3f
B: 0x15fa326
S: 0x19f3fc9
Troubleshooting MySQL from a MySQL Developer Perspective
Ad

More Related Content

What's hot (20)

Intro ProxySQL
Intro ProxySQLIntro ProxySQL
Intro ProxySQL
I Goo Lee
 
MySQL Database Architectures - MySQL InnoDB ClusterSet 2021-11
MySQL Database Architectures - MySQL InnoDB ClusterSet 2021-11MySQL Database Architectures - MySQL InnoDB ClusterSet 2021-11
MySQL Database Architectures - MySQL InnoDB ClusterSet 2021-11
Kenny Gryp
 
ProxySQL for MySQL
ProxySQL for MySQLProxySQL for MySQL
ProxySQL for MySQL
Mydbops
 
Prometheus: A Next Generation Monitoring System (FOSDEM 2016)
Prometheus: A Next Generation Monitoring System (FOSDEM 2016)Prometheus: A Next Generation Monitoring System (FOSDEM 2016)
Prometheus: A Next Generation Monitoring System (FOSDEM 2016)
Brian Brazil
 
Meet cute-between-ebpf-and-tracing
Meet cute-between-ebpf-and-tracingMeet cute-between-ebpf-and-tracing
Meet cute-between-ebpf-and-tracing
Viller Hsiao
 
Maxscale switchover, failover, and auto rejoin
Maxscale switchover, failover, and auto rejoinMaxscale switchover, failover, and auto rejoin
Maxscale switchover, failover, and auto rejoin
Wagner Bianchi
 
How does PostgreSQL work with disks: a DBA's checklist in detail. PGConf.US 2015
How does PostgreSQL work with disks: a DBA's checklist in detail. PGConf.US 2015How does PostgreSQL work with disks: a DBA's checklist in detail. PGConf.US 2015
How does PostgreSQL work with disks: a DBA's checklist in detail. PGConf.US 2015
PostgreSQL-Consulting
 
Query logging with proxysql
Query logging with proxysqlQuery logging with proxysql
Query logging with proxysql
YoungHeon (Roy) Kim
 
YOW2021 Computing Performance
YOW2021 Computing PerformanceYOW2021 Computing Performance
YOW2021 Computing Performance
Brendan Gregg
 
MySQL Ecosystem in 2023 - FOSSASIA'23 - Alkin.pptx.pdf
MySQL Ecosystem in 2023 - FOSSASIA'23 - Alkin.pptx.pdfMySQL Ecosystem in 2023 - FOSSASIA'23 - Alkin.pptx.pdf
MySQL Ecosystem in 2023 - FOSSASIA'23 - Alkin.pptx.pdf
Alkin Tezuysal
 
InnoDB Locking Explained with Stick Figures
InnoDB Locking Explained with Stick FiguresInnoDB Locking Explained with Stick Figures
InnoDB Locking Explained with Stick Figures
Karwin Software Solutions LLC
 
Docker 101: Introduction to Docker
Docker 101: Introduction to DockerDocker 101: Introduction to Docker
Docker 101: Introduction to Docker
Docker, Inc.
 
Prometheus (Prometheus London, 2016)
Prometheus (Prometheus London, 2016)Prometheus (Prometheus London, 2016)
Prometheus (Prometheus London, 2016)
Brian Brazil
 
New features in ProxySQL 2.0 (updated to 2.0.9) by Rene Cannao (ProxySQL)
New features in ProxySQL 2.0 (updated to 2.0.9) by Rene Cannao (ProxySQL)New features in ProxySQL 2.0 (updated to 2.0.9) by Rene Cannao (ProxySQL)
New features in ProxySQL 2.0 (updated to 2.0.9) by Rene Cannao (ProxySQL)
Altinity Ltd
 
Open Source 101 2022 - MySQL Indexes and Histograms
Open Source 101 2022 - MySQL Indexes and HistogramsOpen Source 101 2022 - MySQL Indexes and Histograms
Open Source 101 2022 - MySQL Indexes and Histograms
Frederic Descamps
 
Introduction to the Container Network Interface (CNI)
Introduction to the Container Network Interface (CNI)Introduction to the Container Network Interface (CNI)
Introduction to the Container Network Interface (CNI)
Weaveworks
 
Autoscaling Kubernetes
Autoscaling KubernetesAutoscaling Kubernetes
Autoscaling Kubernetes
craigbox
 
Percona Live 2022 - MySQL Architectures
Percona Live 2022 - MySQL ArchitecturesPercona Live 2022 - MySQL Architectures
Percona Live 2022 - MySQL Architectures
Frederic Descamps
 
Let's scale-out PostgreSQL using Citus (English)
Let's scale-out PostgreSQL using Citus (English)Let's scale-out PostgreSQL using Citus (English)
Let's scale-out PostgreSQL using Citus (English)
Noriyoshi Shinoda
 
Multiple Sites and Disaster Recovery with Ceph: Andrew Hatfield, Red Hat
Multiple Sites and Disaster Recovery with Ceph: Andrew Hatfield, Red HatMultiple Sites and Disaster Recovery with Ceph: Andrew Hatfield, Red Hat
Multiple Sites and Disaster Recovery with Ceph: Andrew Hatfield, Red Hat
OpenStack
 
Intro ProxySQL
Intro ProxySQLIntro ProxySQL
Intro ProxySQL
I Goo Lee
 
MySQL Database Architectures - MySQL InnoDB ClusterSet 2021-11
MySQL Database Architectures - MySQL InnoDB ClusterSet 2021-11MySQL Database Architectures - MySQL InnoDB ClusterSet 2021-11
MySQL Database Architectures - MySQL InnoDB ClusterSet 2021-11
Kenny Gryp
 
ProxySQL for MySQL
ProxySQL for MySQLProxySQL for MySQL
ProxySQL for MySQL
Mydbops
 
Prometheus: A Next Generation Monitoring System (FOSDEM 2016)
Prometheus: A Next Generation Monitoring System (FOSDEM 2016)Prometheus: A Next Generation Monitoring System (FOSDEM 2016)
Prometheus: A Next Generation Monitoring System (FOSDEM 2016)
Brian Brazil
 
Meet cute-between-ebpf-and-tracing
Meet cute-between-ebpf-and-tracingMeet cute-between-ebpf-and-tracing
Meet cute-between-ebpf-and-tracing
Viller Hsiao
 
Maxscale switchover, failover, and auto rejoin
Maxscale switchover, failover, and auto rejoinMaxscale switchover, failover, and auto rejoin
Maxscale switchover, failover, and auto rejoin
Wagner Bianchi
 
How does PostgreSQL work with disks: a DBA's checklist in detail. PGConf.US 2015
How does PostgreSQL work with disks: a DBA's checklist in detail. PGConf.US 2015How does PostgreSQL work with disks: a DBA's checklist in detail. PGConf.US 2015
How does PostgreSQL work with disks: a DBA's checklist in detail. PGConf.US 2015
PostgreSQL-Consulting
 
YOW2021 Computing Performance
YOW2021 Computing PerformanceYOW2021 Computing Performance
YOW2021 Computing Performance
Brendan Gregg
 
MySQL Ecosystem in 2023 - FOSSASIA'23 - Alkin.pptx.pdf
MySQL Ecosystem in 2023 - FOSSASIA'23 - Alkin.pptx.pdfMySQL Ecosystem in 2023 - FOSSASIA'23 - Alkin.pptx.pdf
MySQL Ecosystem in 2023 - FOSSASIA'23 - Alkin.pptx.pdf
Alkin Tezuysal
 
Docker 101: Introduction to Docker
Docker 101: Introduction to DockerDocker 101: Introduction to Docker
Docker 101: Introduction to Docker
Docker, Inc.
 
Prometheus (Prometheus London, 2016)
Prometheus (Prometheus London, 2016)Prometheus (Prometheus London, 2016)
Prometheus (Prometheus London, 2016)
Brian Brazil
 
New features in ProxySQL 2.0 (updated to 2.0.9) by Rene Cannao (ProxySQL)
New features in ProxySQL 2.0 (updated to 2.0.9) by Rene Cannao (ProxySQL)New features in ProxySQL 2.0 (updated to 2.0.9) by Rene Cannao (ProxySQL)
New features in ProxySQL 2.0 (updated to 2.0.9) by Rene Cannao (ProxySQL)
Altinity Ltd
 
Open Source 101 2022 - MySQL Indexes and Histograms
Open Source 101 2022 - MySQL Indexes and HistogramsOpen Source 101 2022 - MySQL Indexes and Histograms
Open Source 101 2022 - MySQL Indexes and Histograms
Frederic Descamps
 
Introduction to the Container Network Interface (CNI)
Introduction to the Container Network Interface (CNI)Introduction to the Container Network Interface (CNI)
Introduction to the Container Network Interface (CNI)
Weaveworks
 
Autoscaling Kubernetes
Autoscaling KubernetesAutoscaling Kubernetes
Autoscaling Kubernetes
craigbox
 
Percona Live 2022 - MySQL Architectures
Percona Live 2022 - MySQL ArchitecturesPercona Live 2022 - MySQL Architectures
Percona Live 2022 - MySQL Architectures
Frederic Descamps
 
Let's scale-out PostgreSQL using Citus (English)
Let's scale-out PostgreSQL using Citus (English)Let's scale-out PostgreSQL using Citus (English)
Let's scale-out PostgreSQL using Citus (English)
Noriyoshi Shinoda
 
Multiple Sites and Disaster Recovery with Ceph: Andrew Hatfield, Red Hat
Multiple Sites and Disaster Recovery with Ceph: Andrew Hatfield, Red HatMultiple Sites and Disaster Recovery with Ceph: Andrew Hatfield, Red Hat
Multiple Sites and Disaster Recovery with Ceph: Andrew Hatfield, Red Hat
OpenStack
 

Similar to Troubleshooting MySQL from a MySQL Developer Perspective (20)

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
 
Gdb basics for my sql db as (openfest 2017) final
Gdb basics for my sql db as (openfest 2017) finalGdb basics for my sql db as (openfest 2017) final
Gdb basics for my sql db as (openfest 2017) final
Valeriy Kravchuk
 
PL22 - Backup and Restore Performance.pptx
PL22 - Backup and Restore Performance.pptxPL22 - Backup and Restore Performance.pptx
PL22 - Backup and Restore Performance.pptx
Vinicius M Grippa
 
Upgrade to MySQL 5.6 without downtime
Upgrade to MySQL 5.6 without downtimeUpgrade to MySQL 5.6 without downtime
Upgrade to MySQL 5.6 without downtime
Olivier DASINI
 
Gdb basics for my sql db as (percona live europe 2019)
Gdb basics for my sql db as (percona live europe 2019)Gdb basics for my sql db as (percona live europe 2019)
Gdb basics for my sql db as (percona live europe 2019)
Valerii Kravchuk
 
Replication using PostgreSQL Replicator
Replication using PostgreSQL ReplicatorReplication using PostgreSQL Replicator
Replication using PostgreSQL Replicator
Command Prompt., Inc
 
Go replicator
Go replicatorGo replicator
Go replicator
Command Prompt., Inc
 
Kettunen, miaubiz fuzzing at scale and in style
Kettunen, miaubiz   fuzzing at scale and in styleKettunen, miaubiz   fuzzing at scale and in style
Kettunen, miaubiz fuzzing at scale and in style
DefconRussia
 
Let's trace Linux Lernel with KGDB @ COSCUP 2021
Let's trace Linux Lernel with KGDB @ COSCUP 2021Let's trace Linux Lernel with KGDB @ COSCUP 2021
Let's trace Linux Lernel with KGDB @ COSCUP 2021
Jian-Hong Pan
 
The Accidental DBA
The Accidental DBAThe Accidental DBA
The Accidental DBA
PostgreSQL Experts, Inc.
 
MySQL always-up with Galera Cluster
MySQL always-up with Galera ClusterMySQL always-up with Galera Cluster
MySQL always-up with Galera Cluster
FromDual GmbH
 
Deploying MongoDB sharded clusters easily with Terraform and Ansible
Deploying MongoDB sharded clusters easily with Terraform and AnsibleDeploying MongoDB sharded clusters easily with Terraform and Ansible
Deploying MongoDB sharded clusters easily with Terraform and Ansible
All Things Open
 
MySQL for Oracle DBAs
MySQL for Oracle DBAsMySQL for Oracle DBAs
MySQL for Oracle DBAs
FromDual GmbH
 
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
Jean-François Gagné
 
Percona XtraDB 集群内部
Percona XtraDB 集群内部Percona XtraDB 集群内部
Percona XtraDB 集群内部
YUCHENG HU
 
Linux /proc filesystem for MySQL DBAs - FOSDEM 2021
Linux  /proc filesystem for MySQL DBAs - FOSDEM 2021Linux  /proc filesystem for MySQL DBAs - FOSDEM 2021
Linux /proc filesystem for MySQL DBAs - FOSDEM 2021
Valeriy Kravchuk
 
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
Jean-François Gagné
 
MySQL Parallel Replication by Booking.com
MySQL Parallel Replication by Booking.comMySQL Parallel Replication by Booking.com
MySQL Parallel Replication by Booking.com
Jean-François Gagné
 
HKG15-409: ARM Hibernation enablement on SoCs - a case study
HKG15-409: ARM Hibernation enablement on SoCs - a case studyHKG15-409: ARM Hibernation enablement on SoCs - a case study
HKG15-409: ARM Hibernation enablement on SoCs - a case study
Linaro
 
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
FromDual GmbH
 
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
 
Gdb basics for my sql db as (openfest 2017) final
Gdb basics for my sql db as (openfest 2017) finalGdb basics for my sql db as (openfest 2017) final
Gdb basics for my sql db as (openfest 2017) final
Valeriy Kravchuk
 
PL22 - Backup and Restore Performance.pptx
PL22 - Backup and Restore Performance.pptxPL22 - Backup and Restore Performance.pptx
PL22 - Backup and Restore Performance.pptx
Vinicius M Grippa
 
Upgrade to MySQL 5.6 without downtime
Upgrade to MySQL 5.6 without downtimeUpgrade to MySQL 5.6 without downtime
Upgrade to MySQL 5.6 without downtime
Olivier DASINI
 
Gdb basics for my sql db as (percona live europe 2019)
Gdb basics for my sql db as (percona live europe 2019)Gdb basics for my sql db as (percona live europe 2019)
Gdb basics for my sql db as (percona live europe 2019)
Valerii Kravchuk
 
Replication using PostgreSQL Replicator
Replication using PostgreSQL ReplicatorReplication using PostgreSQL Replicator
Replication using PostgreSQL Replicator
Command Prompt., Inc
 
Kettunen, miaubiz fuzzing at scale and in style
Kettunen, miaubiz   fuzzing at scale and in styleKettunen, miaubiz   fuzzing at scale and in style
Kettunen, miaubiz fuzzing at scale and in style
DefconRussia
 
Let's trace Linux Lernel with KGDB @ COSCUP 2021
Let's trace Linux Lernel with KGDB @ COSCUP 2021Let's trace Linux Lernel with KGDB @ COSCUP 2021
Let's trace Linux Lernel with KGDB @ COSCUP 2021
Jian-Hong Pan
 
MySQL always-up with Galera Cluster
MySQL always-up with Galera ClusterMySQL always-up with Galera Cluster
MySQL always-up with Galera Cluster
FromDual GmbH
 
Deploying MongoDB sharded clusters easily with Terraform and Ansible
Deploying MongoDB sharded clusters easily with Terraform and AnsibleDeploying MongoDB sharded clusters easily with Terraform and Ansible
Deploying MongoDB sharded clusters easily with Terraform and Ansible
All Things Open
 
MySQL for Oracle DBAs
MySQL for Oracle DBAsMySQL for Oracle DBAs
MySQL for Oracle DBAs
FromDual GmbH
 
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
Jean-François Gagné
 
Percona XtraDB 集群内部
Percona XtraDB 集群内部Percona XtraDB 集群内部
Percona XtraDB 集群内部
YUCHENG HU
 
Linux /proc filesystem for MySQL DBAs - FOSDEM 2021
Linux  /proc filesystem for MySQL DBAs - FOSDEM 2021Linux  /proc filesystem for MySQL DBAs - FOSDEM 2021
Linux /proc filesystem for MySQL DBAs - FOSDEM 2021
Valeriy Kravchuk
 
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
Jean-François Gagné
 
MySQL Parallel Replication by Booking.com
MySQL Parallel Replication by Booking.comMySQL Parallel Replication by Booking.com
MySQL Parallel Replication by Booking.com
Jean-François Gagné
 
HKG15-409: ARM Hibernation enablement on SoCs - a case study
HKG15-409: ARM Hibernation enablement on SoCs - a case studyHKG15-409: ARM Hibernation enablement on SoCs - a case study
HKG15-409: ARM Hibernation enablement on SoCs - a case study
Linaro
 
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
FromDual GmbH
 
Ad

More from Marcelo Altmann (12)

Backup Online no MySQL com Percona Xtrabackup
Backup Online no MySQL com Percona XtrabackupBackup Online no MySQL com Percona Xtrabackup
Backup Online no MySQL com Percona Xtrabackup
Marcelo Altmann
 
Backup para MySQL
Backup para MySQLBackup para MySQL
Backup para MySQL
Marcelo Altmann
 
GDB e Análise de Bugs
GDB e Análise de BugsGDB e Análise de Bugs
GDB e Análise de Bugs
Marcelo Altmann
 
Percona University - ProxySQL para MySQL
Percona University - ProxySQL para MySQLPercona University - ProxySQL para MySQL
Percona University - ProxySQL para MySQL
Marcelo Altmann
 
DB Floripa - ProxySQL para MySQL
DB Floripa - ProxySQL para MySQLDB Floripa - ProxySQL para MySQL
DB Floripa - ProxySQL para MySQL
Marcelo Altmann
 
MySQL Backup Best Practices and Case Study- .ie Continuous Restore Process
MySQL Backup Best Practices and Case Study- .ie Continuous Restore ProcessMySQL Backup Best Practices and Case Study- .ie Continuous Restore Process
MySQL Backup Best Practices and Case Study- .ie Continuous Restore Process
Marcelo Altmann
 
A Percona Support Engineer Walkthrough on pt-stalk
A Percona Support Engineer Walkthrough on pt-stalkA Percona Support Engineer Walkthrough on pt-stalk
A Percona Support Engineer Walkthrough on pt-stalk
Marcelo Altmann
 
MysQL melhores práticas de seguranca
MysQL  melhores práticas de segurancaMysQL  melhores práticas de seguranca
MysQL melhores práticas de seguranca
Marcelo Altmann
 
ProxySQL para mysql
ProxySQL para mysqlProxySQL para mysql
ProxySQL para mysql
Marcelo Altmann
 
Optimizando MySQL
Optimizando MySQLOptimizando MySQL
Optimizando MySQL
Marcelo Altmann
 
MySQL - Melhores práticas de replicação de dados
MySQL - Melhores práticas de replicação de dadosMySQL - Melhores práticas de replicação de dados
MySQL - Melhores práticas de replicação de dados
Marcelo Altmann
 
Percona Live London 2014 - MySQL Backup Strategy @ IEDR
Percona Live London 2014 - MySQL Backup Strategy @ IEDRPercona Live London 2014 - MySQL Backup Strategy @ IEDR
Percona Live London 2014 - MySQL Backup Strategy @ IEDR
Marcelo Altmann
 
Backup Online no MySQL com Percona Xtrabackup
Backup Online no MySQL com Percona XtrabackupBackup Online no MySQL com Percona Xtrabackup
Backup Online no MySQL com Percona Xtrabackup
Marcelo Altmann
 
Percona University - ProxySQL para MySQL
Percona University - ProxySQL para MySQLPercona University - ProxySQL para MySQL
Percona University - ProxySQL para MySQL
Marcelo Altmann
 
DB Floripa - ProxySQL para MySQL
DB Floripa - ProxySQL para MySQLDB Floripa - ProxySQL para MySQL
DB Floripa - ProxySQL para MySQL
Marcelo Altmann
 
MySQL Backup Best Practices and Case Study- .ie Continuous Restore Process
MySQL Backup Best Practices and Case Study- .ie Continuous Restore ProcessMySQL Backup Best Practices and Case Study- .ie Continuous Restore Process
MySQL Backup Best Practices and Case Study- .ie Continuous Restore Process
Marcelo Altmann
 
A Percona Support Engineer Walkthrough on pt-stalk
A Percona Support Engineer Walkthrough on pt-stalkA Percona Support Engineer Walkthrough on pt-stalk
A Percona Support Engineer Walkthrough on pt-stalk
Marcelo Altmann
 
MysQL melhores práticas de seguranca
MysQL  melhores práticas de segurancaMysQL  melhores práticas de seguranca
MysQL melhores práticas de seguranca
Marcelo Altmann
 
MySQL - Melhores práticas de replicação de dados
MySQL - Melhores práticas de replicação de dadosMySQL - Melhores práticas de replicação de dados
MySQL - Melhores práticas de replicação de dados
Marcelo Altmann
 
Percona Live London 2014 - MySQL Backup Strategy @ IEDR
Percona Live London 2014 - MySQL Backup Strategy @ IEDRPercona Live London 2014 - MySQL Backup Strategy @ IEDR
Percona Live London 2014 - MySQL Backup Strategy @ IEDR
Marcelo Altmann
 
Ad

Recently uploaded (20)

Value Stream Mapping Worskshops for Intelligent Continuous Security
Value Stream Mapping Worskshops for Intelligent Continuous SecurityValue Stream Mapping Worskshops for Intelligent Continuous Security
Value Stream Mapping Worskshops for Intelligent Continuous Security
Marc Hornbeek
 
Smart Storage Solutions.pptx for production engineering
Smart Storage Solutions.pptx for production engineeringSmart Storage Solutions.pptx for production engineering
Smart Storage Solutions.pptx for production engineering
rushikeshnavghare94
 
Main cotrol jdbjbdcnxbjbjzjjjcjicbjxbcjcxbjcxb
Main cotrol jdbjbdcnxbjbjzjjjcjicbjxbcjcxbjcxbMain cotrol jdbjbdcnxbjbjzjjjcjicbjxbcjcxbjcxb
Main cotrol jdbjbdcnxbjbjzjjjcjicbjxbcjcxbjcxb
SunilSingh610661
 
IntroSlides-April-BuildWithAI-VertexAI.pdf
IntroSlides-April-BuildWithAI-VertexAI.pdfIntroSlides-April-BuildWithAI-VertexAI.pdf
IntroSlides-April-BuildWithAI-VertexAI.pdf
Luiz Carneiro
 
AI-assisted Software Testing (3-hours tutorial)
AI-assisted Software Testing (3-hours tutorial)AI-assisted Software Testing (3-hours tutorial)
AI-assisted Software Testing (3-hours tutorial)
Vəhid Gəruslu
 
Data Structures_Searching and Sorting.pptx
Data Structures_Searching and Sorting.pptxData Structures_Searching and Sorting.pptx
Data Structures_Searching and Sorting.pptx
RushaliDeshmukh2
 
five-year-soluhhhhhhhhhhhhhhhhhtions.pdf
five-year-soluhhhhhhhhhhhhhhhhhtions.pdffive-year-soluhhhhhhhhhhhhhhhhhtions.pdf
five-year-soluhhhhhhhhhhhhhhhhhtions.pdf
AdityaSharma944496
 
RICS Membership-(The Royal Institution of Chartered Surveyors).pdf
RICS Membership-(The Royal Institution of Chartered Surveyors).pdfRICS Membership-(The Royal Institution of Chartered Surveyors).pdf
RICS Membership-(The Royal Institution of Chartered Surveyors).pdf
MohamedAbdelkader115
 
ELectronics Boards & Product Testing_Shiju.pdf
ELectronics Boards & Product Testing_Shiju.pdfELectronics Boards & Product Testing_Shiju.pdf
ELectronics Boards & Product Testing_Shiju.pdf
Shiju Jacob
 
Compiler Design_Lexical Analysis phase.pptx
Compiler Design_Lexical Analysis phase.pptxCompiler Design_Lexical Analysis phase.pptx
Compiler Design_Lexical Analysis phase.pptx
RushaliDeshmukh2
 
DSP and MV the Color image processing.ppt
DSP and MV the  Color image processing.pptDSP and MV the  Color image processing.ppt
DSP and MV the Color image processing.ppt
HafizAhamed8
 
Artificial Intelligence introduction.pptx
Artificial Intelligence introduction.pptxArtificial Intelligence introduction.pptx
Artificial Intelligence introduction.pptx
DrMarwaElsherif
 
MAQUINARIA MINAS CEMA 6th Edition (1).pdf
MAQUINARIA MINAS CEMA 6th Edition (1).pdfMAQUINARIA MINAS CEMA 6th Edition (1).pdf
MAQUINARIA MINAS CEMA 6th Edition (1).pdf
ssuser562df4
 
Lidar for Autonomous Driving, LiDAR Mapping for Driverless Cars.pptx
Lidar for Autonomous Driving, LiDAR Mapping for Driverless Cars.pptxLidar for Autonomous Driving, LiDAR Mapping for Driverless Cars.pptx
Lidar for Autonomous Driving, LiDAR Mapping for Driverless Cars.pptx
RishavKumar530754
 
theory-slides-for react for beginners.pptx
theory-slides-for react for beginners.pptxtheory-slides-for react for beginners.pptx
theory-slides-for react for beginners.pptx
sanchezvanessa7896
 
DATA-DRIVEN SHOULDER INVERSE KINEMATICS YoungBeom Kim1 , Byung-Ha Park1 , Kwa...
DATA-DRIVEN SHOULDER INVERSE KINEMATICS YoungBeom Kim1 , Byung-Ha Park1 , Kwa...DATA-DRIVEN SHOULDER INVERSE KINEMATICS YoungBeom Kim1 , Byung-Ha Park1 , Kwa...
DATA-DRIVEN SHOULDER INVERSE KINEMATICS YoungBeom Kim1 , Byung-Ha Park1 , Kwa...
charlesdick1345
 
Structural Response of Reinforced Self-Compacting Concrete Deep Beam Using Fi...
Structural Response of Reinforced Self-Compacting Concrete Deep Beam Using Fi...Structural Response of Reinforced Self-Compacting Concrete Deep Beam Using Fi...
Structural Response of Reinforced Self-Compacting Concrete Deep Beam Using Fi...
Journal of Soft Computing in Civil Engineering
 
ADVXAI IN MALWARE ANALYSIS FRAMEWORK: BALANCING EXPLAINABILITY WITH SECURITY
ADVXAI IN MALWARE ANALYSIS FRAMEWORK: BALANCING EXPLAINABILITY WITH SECURITYADVXAI IN MALWARE ANALYSIS FRAMEWORK: BALANCING EXPLAINABILITY WITH SECURITY
ADVXAI IN MALWARE ANALYSIS FRAMEWORK: BALANCING EXPLAINABILITY WITH SECURITY
ijscai
 
DT REPORT by Tech titan GROUP to introduce the subject design Thinking
DT REPORT by Tech titan GROUP to introduce the subject design ThinkingDT REPORT by Tech titan GROUP to introduce the subject design Thinking
DT REPORT by Tech titan GROUP to introduce the subject design Thinking
DhruvChotaliya2
 
Process Parameter Optimization for Minimizing Springback in Cold Drawing Proc...
Process Parameter Optimization for Minimizing Springback in Cold Drawing Proc...Process Parameter Optimization for Minimizing Springback in Cold Drawing Proc...
Process Parameter Optimization for Minimizing Springback in Cold Drawing Proc...
Journal of Soft Computing in Civil Engineering
 
Value Stream Mapping Worskshops for Intelligent Continuous Security
Value Stream Mapping Worskshops for Intelligent Continuous SecurityValue Stream Mapping Worskshops for Intelligent Continuous Security
Value Stream Mapping Worskshops for Intelligent Continuous Security
Marc Hornbeek
 
Smart Storage Solutions.pptx for production engineering
Smart Storage Solutions.pptx for production engineeringSmart Storage Solutions.pptx for production engineering
Smart Storage Solutions.pptx for production engineering
rushikeshnavghare94
 
Main cotrol jdbjbdcnxbjbjzjjjcjicbjxbcjcxbjcxb
Main cotrol jdbjbdcnxbjbjzjjjcjicbjxbcjcxbjcxbMain cotrol jdbjbdcnxbjbjzjjjcjicbjxbcjcxbjcxb
Main cotrol jdbjbdcnxbjbjzjjjcjicbjxbcjcxbjcxb
SunilSingh610661
 
IntroSlides-April-BuildWithAI-VertexAI.pdf
IntroSlides-April-BuildWithAI-VertexAI.pdfIntroSlides-April-BuildWithAI-VertexAI.pdf
IntroSlides-April-BuildWithAI-VertexAI.pdf
Luiz Carneiro
 
AI-assisted Software Testing (3-hours tutorial)
AI-assisted Software Testing (3-hours tutorial)AI-assisted Software Testing (3-hours tutorial)
AI-assisted Software Testing (3-hours tutorial)
Vəhid Gəruslu
 
Data Structures_Searching and Sorting.pptx
Data Structures_Searching and Sorting.pptxData Structures_Searching and Sorting.pptx
Data Structures_Searching and Sorting.pptx
RushaliDeshmukh2
 
five-year-soluhhhhhhhhhhhhhhhhhtions.pdf
five-year-soluhhhhhhhhhhhhhhhhhtions.pdffive-year-soluhhhhhhhhhhhhhhhhhtions.pdf
five-year-soluhhhhhhhhhhhhhhhhhtions.pdf
AdityaSharma944496
 
RICS Membership-(The Royal Institution of Chartered Surveyors).pdf
RICS Membership-(The Royal Institution of Chartered Surveyors).pdfRICS Membership-(The Royal Institution of Chartered Surveyors).pdf
RICS Membership-(The Royal Institution of Chartered Surveyors).pdf
MohamedAbdelkader115
 
ELectronics Boards & Product Testing_Shiju.pdf
ELectronics Boards & Product Testing_Shiju.pdfELectronics Boards & Product Testing_Shiju.pdf
ELectronics Boards & Product Testing_Shiju.pdf
Shiju Jacob
 
Compiler Design_Lexical Analysis phase.pptx
Compiler Design_Lexical Analysis phase.pptxCompiler Design_Lexical Analysis phase.pptx
Compiler Design_Lexical Analysis phase.pptx
RushaliDeshmukh2
 
DSP and MV the Color image processing.ppt
DSP and MV the  Color image processing.pptDSP and MV the  Color image processing.ppt
DSP and MV the Color image processing.ppt
HafizAhamed8
 
Artificial Intelligence introduction.pptx
Artificial Intelligence introduction.pptxArtificial Intelligence introduction.pptx
Artificial Intelligence introduction.pptx
DrMarwaElsherif
 
MAQUINARIA MINAS CEMA 6th Edition (1).pdf
MAQUINARIA MINAS CEMA 6th Edition (1).pdfMAQUINARIA MINAS CEMA 6th Edition (1).pdf
MAQUINARIA MINAS CEMA 6th Edition (1).pdf
ssuser562df4
 
Lidar for Autonomous Driving, LiDAR Mapping for Driverless Cars.pptx
Lidar for Autonomous Driving, LiDAR Mapping for Driverless Cars.pptxLidar for Autonomous Driving, LiDAR Mapping for Driverless Cars.pptx
Lidar for Autonomous Driving, LiDAR Mapping for Driverless Cars.pptx
RishavKumar530754
 
theory-slides-for react for beginners.pptx
theory-slides-for react for beginners.pptxtheory-slides-for react for beginners.pptx
theory-slides-for react for beginners.pptx
sanchezvanessa7896
 
DATA-DRIVEN SHOULDER INVERSE KINEMATICS YoungBeom Kim1 , Byung-Ha Park1 , Kwa...
DATA-DRIVEN SHOULDER INVERSE KINEMATICS YoungBeom Kim1 , Byung-Ha Park1 , Kwa...DATA-DRIVEN SHOULDER INVERSE KINEMATICS YoungBeom Kim1 , Byung-Ha Park1 , Kwa...
DATA-DRIVEN SHOULDER INVERSE KINEMATICS YoungBeom Kim1 , Byung-Ha Park1 , Kwa...
charlesdick1345
 
ADVXAI IN MALWARE ANALYSIS FRAMEWORK: BALANCING EXPLAINABILITY WITH SECURITY
ADVXAI IN MALWARE ANALYSIS FRAMEWORK: BALANCING EXPLAINABILITY WITH SECURITYADVXAI IN MALWARE ANALYSIS FRAMEWORK: BALANCING EXPLAINABILITY WITH SECURITY
ADVXAI IN MALWARE ANALYSIS FRAMEWORK: BALANCING EXPLAINABILITY WITH SECURITY
ijscai
 
DT REPORT by Tech titan GROUP to introduce the subject design Thinking
DT REPORT by Tech titan GROUP to introduce the subject design ThinkingDT REPORT by Tech titan GROUP to introduce the subject design Thinking
DT REPORT by Tech titan GROUP to introduce the subject design Thinking
DhruvChotaliya2
 

Troubleshooting MySQL from a MySQL Developer Perspective

  • 1. Troubleshooting MySQL from a MySQL Developer Perspective Marcelo Altmann Software Developer - Percona Percona Live Austin / May 2022
  • 2. Marcelo Altmann ● Software Developer @ Percona ○ Joined in 2016 as Senior Support Engineer ○ PXB / PS / PXC ○ Member Bugs Escalation Committee
  • 4. Software bug A software bug is an error, flaw or fault in computer software that causes it to produce an incorrect or unexpected result, or to behave in unintended ways - wikipidia ● Wrong query results ● Performance degradations ● Security flaw ● Crash
  • 6. Reproducible test case ● Been able to reproduce a bug is key ● Projects have their own test framework ● Used to ensure we don't introduce regressions. ● MySQL MTR ○ Start mysql instance: ./mtr --start alias & mysql –defaults-file=var/my.cnf ○ Interactive GDB session: ./mtr --manual-gdb alias gdb -cd ./ -x ./var/tmp/gdbinit.mysqld.1 ../bin/mysqld
  • 7. Reproducible test case ● Recompile with Debug synchronization : open_tables(...) DEBUG_SYNC(thd, "after_open_tables"); lock_tables(...) --connection conn1 SET DEBUG_SYNC= 'after_open_tables SIGNAL opened WAIT_FOR flushed'; send INSERT INTO t1 VALUES(1); --connection conn2 SET DEBUG_SYNC= 'now WAIT_FOR opened'; SET DEBUG_SYNC= 'after_abort_locks SIGNAL flushed'; FLUSH TABLE t1;
  • 8. Reproducible test case ● Recompile with Test Faults Macros : somefile.cc DBUG_EXECUTE_IF("some_keyword", { some_function(); some_variable++; };); mysql> SET debug = '+d,some_keyword';
  • 10. Stack Traces - Signals ● A way of software / kernel / user to communicate with a process. ● Program will interpret and handle it - mysqld.cc my_init_signals()
  • 11. Stack Traces - Signals ● SIGABRT / 6 - Code Assertions ○ ut_a(condition) / ut_ad(condition) ○ Critical points of code - continuing might cause damage ● SIGSEGV / 11 - Segmentation Fault ○ Memory access violation ○ Tried to access restricted memory area ● SIGTERM / 15 - Terminate ○ shutdown
  • 13. Divide and conquer Page Cleaner bug
  • 14. Divide and conquer ● Goal is to establish when this started to happen ● Remove as much as unknown as you can ○ Issue is happening on latest version? ○ Issue is happening on latest version minus 1 / 2 / 3 / … versions? ○ Issue is happening on previous major version (8.0 -> 5.7) ? ● ( PXB / PXC ) - Is the issue specific to the product?
  • 15. Divide and conquer ● PXB-2742 as example: ● Start Point - partitions -> full backup -> inc backup (one or many) -> prepare full -> prepare inc (one or many) -> crash (sometimes) ● partitions ? = full backup -> inc backup (one or many) -> prepare full -> prepare inc (one or many) -> crash (sometimes)
  • 16. Divide and conquer ● Incrementals ? = full backup -> prepare full -> crash (sometimes) ● Investigate (prepare full): a. Innodb Master Thread Doing idle task b. Merging Insert Buffer at full io capacity ■ Ask the pages to be read in to BP (async IO) (IO_BUF_READ) c. IO Read Thread read the page ■ Merge Ibuf changes - Add page to Flush list d. Shutdown e. IO Read Thread complete the read/ibuf merge of page (IO_BUF_NONE)
  • 17. Divide and conquer ● Can I reproduce the same on server? ● DBUG_EXECUTE_IF - shutdown - full ibuf merge ● Yes !!! 8.0 & 5.7 PS and upstream affected. ● PS-8174 / #107069 Crash -> private =( ● From a complex set of multiple variables (partition, xtrabackup, multiple incremental) to "simple" server bug.
  • 18. Regression = git bisect Wrong query result bug
  • 19. Regression = git bisect ● PS-7019 / #99398 ● Works ok on 8.0.19 ● Does NOT work on 8.0.20
  • 20. Regression = git bisect mysql> SELECT * FROM t1; +-------+-------+ | t1_id | t2_id | +-------+-------+ | 1 | 1000 | | 2 | 5 | +-------+-------+ 2 rows in set (0,00 sec) mysql> SELECT * FROM t2; +-------+-----------+ | t2_id | is_active | +-------+-----------+ | 2 | 1 | | 3 | 0 | | 1000 | 1 | +-------+-----------+ 3 rows in set (0,00 sec) 8.0.19> SELECT t1.*, t2.t2_id FROM t1 LEFT JOIN t2 ON (t1.t2_id = t2.t2_id) GROUP BY t1_id; +-------+-------+-------+ | t1_id | t2_id | t2_id | +-------+-------+-------+ | 1 | 1000 | 1000 | | 2 | 5 | NULL | +-------+-------+-------+ 2 rows in set (0,00 sec) 8.0.20> SELECT t1.*, t2.t2_id FROM t1 LEFT JOIN t2 ON (t1.t2_id = t2.t2_id) GROUP BY t1_id; +-------+-------+-------+ | t1_id | t2_id | t2_id | +-------+-------+-------+ | 1 | 1000 | NULL | | 2 | 5 | NULL | +-------+-------+-------+ 2 rows in set (0,00 sec)
  • 21. Regression = git bisect ● Finding a Regression in MySQL Source Code: A Case Study ● Lines (737+K): git diff mysql-8.0.19..mysql-8.0.20 | wc -l 737454 ● Files (~4.5K): git diff mysql-8.0.19..mysql-8.0.20 --name-only | wc -l 4495 ● Commits (~2K): git log mysql-8.0.19..mysql-8.0.20 --pretty=oneline | wc -l 1966
  • 26. Regression = git bisect ● Manual: a. git bisect start mysql-8.0.20 mysql-8.0.19 b. test c. git bisect [good | bad]
  • 27. Regression = git bisect ● Automated: git bisect run sh -c ' compile_mysql.sh if [ "$?" -ne "0" ]; then exit 125 fi ./mysql-test/mtr bisect if [ "$?" -eq "0" ]; then exit 0 else exit 1 fi'
  • 28. Regression = git bisect ● Bug#30460528: RENAME FIELD::REAL_MAYBE_NULL() TO FIELD::IS_NULLABLE() ● https://github.com/mysql/mysql- server/commit/3039fac3969f7c1521863bfe1513631986d2b6bd
  • 30. GDB / Coredump / PMP Internal thread Deadlock bug
  • 31. GDB ● GNU Debugger ● Works in various languages (C / C++ / Go / others) ● Can be used: a. Remote b. Live process - gdb -p PID c. Starting a process - gdb –args mysqld –datadir=..... d. Offline (coredump) - gdb bin/mysqld core.xxxxx
  • 32. GDB ● Break point - stop the execution when a function is called. ● Condition break point - same as above but with condition (var1 == value) ● Watchpoints - same as break point but stop the execution when a variable is read / written / or both ● Next - execute the code until the next line. ● Continue - execute the code until the next break point. ● Step - enter the function. ● Bt - Mostrar Backtrace / Stack trace. ● Frame - pular para frame especídico dentro da backtrace.
  • 33. Coredump ● Snapshot / Dump of process memory ● Used alongside with GDB + binary of process ● Allows to check variables when the snapshot was collected ● Normally collected when process crash ● Can be collected on demand by gcore or gdb generate-core-file (eg: mysqld is frozen and I can't get in)
  • 34. Coredump ● On crash: a. Requires mysqld to be configured with –core-file and linux config: echo 2 > /proc/sys/fs/suid_dumpable mkdir /tmp/corefiles chmod 777 /tmp/corefiles echo "/tmp/corefiles/core" > /proc/sys/kernel/core_pattern echo "1" > /proc/sys/kernel/core_uses_pid Mysqld --core-file b. PS - mysqld --coredumper=/PATH
  • 36. Poor Man's Profiler - PMP ● Aggregates identical stack traces ● Very useful for coredumps with high number of threads ● https://poormansprofiler.org/ ● Available via percona toolkit
  • 38. GDB / Coredump / pt-pmp
  • 39. GDB / Coredump / pt-pmp
  • 40. GDB / Coredump / pt-pmp ● All 4996 threads wait on mutex from Thread 38
  • 41. GDB / Coredump / pt-pmp
  • 42. GDB / Coredump / pt-pmp ● All 4996 threads are trying to connect and waiting on mutex from Thread 38 ● Thread 38 ○ SELECT * FROM performance_schema.session_variables WHERE VARIABLE_NAME LIKE 'binlog_transaction_dependency_tracking' ○ Wait on mutex from Thread 44
  • 43. GDB / Coredump / pt-pmp
  • 44. GDB / Coredump / pt-pmp ● All 4996 threads are trying to connect and waiting on mutex from Thread 38 ● Thread 38 ○ SELECT * FROM performance_schema.session_variables WHERE VARIABLE_NAME LIKE 'binlog_transaction_dependency_tracking' ○ Wait on mutex from Thread 44 ● Thread 44 ○ SHOW BINARY LOGS ○ Wait on mutex from Thread 42
  • 45. GDB / Coredump / pt-pmp
  • 46. GDB / Coredump / pt-pmp ● All 4996 threads are trying to connect and waiting on mutex from Thread 38 ● Thread 38 ○ SELECT * FROM performance_schema.session_variables WHERE VARIABLE_NAME LIKE 'binlog_transaction_dependency_tracking' ○ Wait on mutex from Thread 44 ● Thread 44 ○ SHOW BINARY LOGS ○ Wait on mutex from Thread 42 ● Thread 42 ○ PURGE BINARY LOGS BEFORE NOW() ○ Wait on mutex from Thread 38
  • 47. GDB / Coredump / pt-pmp ● Loop in wait-for graph ● Bug: Deadlock during purge_logs_before_date - PS-1049 #91941
  • 48. Record & Replay Xtrabackup incremental backup bug
  • 49. Record & Replay ● Created by Mozilla - https://rr-project.org/ ● Open Source - https://github.com/rr-debugger/rr ● Record once, replay deterministically as many times you want ● Let you replay the code backwards ● Run on a GDB session ● Hard to reproduce bugs ● Complex bugs
  • 50. Record & Replay ● Replay the Execution of MySQL With RR (Record and Replay) ● PXB-2180 ● PXB crash randomly after applying N incremental backups ● Not always the same stack trace - Crash on different parts of InnoDB ● Always trying to apply a record on same Space=>Page
  • 51. Record & Replay ● Page layout diverted somehow between PXB and Server ● Crash on N th inc is a consequence of something wrong on N-M th inc. ● Run MySQL under RR ● Make a copy of all backups so we can re-run –prepare when the issue happens ● Read the LSNs for this same page before/after each backup prepare (od). ● Identify all changes to m_space = 4294967294 & m_page_no = 5 at mysqld. ● Got a reproducible backup - 6th incremental was crashing
  • 52. Record & Replay ● m_space = 4294967294 correspond to the MySQL data dictionary (mysql.ibd) – dict0dict.h:1146 ● On disk page, LSN is stored at the 16th byte of the page and has a size of 8 bytes – fil0types.h:66 ● Pages are written sequentially to disk, as an example, for the default 16k page size, from bytes 1 to 16384 will have the data for page 0, from byte 16385 to 32768 data from page 1, and so on. ● Frame is raw data of a page – buf0buf.h:1358
  • 53. Record & Replay BF: 0x1102185
  • 54. Record & Replay BF: 0x1102185 AF: 0x1100706
  • 55. Record & Replay BF: 0x1102185 AF: 0x1100706 I1: 0x1231906
  • 56. Record & Replay BF: 0x1102185 AF: 0x1100706 I1: 0x1231906 . . . I3: 0x1474d3f
  • 57. Record & Replay BF: 0x1102185 AF: 0x1100706 I1: 0x1231906 . . . I3: 0x1474d3f B: 0x15fa326 S: 0x19f3fc9
  • 58. Record & Replay BF: 0x1102185 AF: 0x1100706 I1: 0x1231906 . . . I3: 0x1474d3f B: 0x15fa326 S: 0x19f3fc9