Skip to content

Instantly share code, notes, and snippets.

View altmannmarcelo's full-sized avatar

Marcelo Altmann altmannmarcelo

View GitHub Profile
ISSUE="199402"
VM_NAME_PREFIX=$ISSUE"_marcelo_altmann_pxc"
for i in {1..3};
do
{
VM_NAME=$VM_NAME_PREFIX"_node_"$i;
lxc-stop -n $VM_NAME;
lxc-destroy -n $VM_NAME;
lxc-create -t centos -n $VM_NAME;
lxc-start -n $VM_NAME;
# Many of these are obvious and stupidly simple, but for your reference and copy-pasting pleasure…
# Mextify all (with workaround for pesky samples that contain multi-line RSA key that breaks pt-mext)
for i in $(ls $1/*-mysqladmin); do { (cat $i | sed -e '/\-\-\-\-\-BEGIN\ PUBLIC\ KEY/,+9d' | pt-mext -r -- cat -) > $i.mext && echo $i.mext;} done;
# Inspect given variable through multiple mext samples (revealing ;-))
grep Table_locks_waited *.mext |less -S
#Find contentious tables
# RHEL 7.5
vagrant init --box-version "1.6.26" generic/rhel7; vagrant up --provider virtualbox;
# RHEL 7.3
vagrant init --box-version '1.0.4' generic/rhel7; vagrant up --provider virtualbox;
# Centos 7.2
vagrant init --box-version '1603.01' centos/7; vagrant up --provider virtualbox;
<?php
date_default_timezone_set('UTC');
$mysqli = new mysqli('127.0.0.1', 'root', 'sekret', 'test', 6033);
if ($mysqli->connect_error) {
die('Connect Error (' . $mysqli->connect_errno . ') '
. $mysqli->connect_error);
}
/* Setup */
echo date('Y-m-d H:i:s') . " Starting to SETUP the test\n";
[mysqld]
datadir=/var/lib/mysql
socket=/var/lib/mysql/mysql.sock
# Disabling symbolic-links is recommended to prevent assorted security risks
symbolic-links=0
log-error=/var/log/mysqld.log
pid-file=/var/run/mysqld/mysqld.pid
log-bin
[mysqld]
datadir=/var/lib/mysql
socket=/var/lib/mysql/mysql.sock
# Disabling symbolic-links is recommended to prevent assorted security risks
symbolic-links=0
log-error=/var/log/mysqld.log
pid-file=/var/run/mysqld/mysqld.pid
log-bin
............ DUMPING MAIN DATABASE ............
***** DUMPING global_variables *****
+-----------------------------------------------------+--------------------+
| variable_name | variable_value |
+-----------------------------------------------------+--------------------+
| mysql-shun_on_failures | 5 |
| mysql-shun_recovery_time_sec | 10 |
| mysql-query_retries_on_failure | 1 |
| mysql-client_multi_statements | true |
| mysql-connect_retries_delay | 1 |
INSERT INTO `languages` (`locales`, `name`) VALUES ('en_US', 'English'),
('ab', 'Abkhaz'),
('ab', 'Abkhaz'),
('ab', 'Abkhaz'),
('ab', 'Abkhaz'),
('ab', 'Abkhaz'),
('ab', 'Abkhaz'),
('ab', 'Abkhaz'),
('ab', 'Abkhaz'),
('ab', 'Abkhaz'),
2020-05-20 15:55:34 [INFO] ProxySQL version 2.0.12-38-g58a909a
2020-05-20 15:55:34 [INFO] Detected OS: Linux marcelo-2711-proxysql-1 5.4.0-28-generic #32-Ubuntu SMP Wed Apr 22 17:40:10 UTC 2020 x86_64
2020-05-20 15:55:34 [INFO] ProxySQL SHA1 checksum: 46f8b8fb1e79484931cdaedb6c200dea3e5c0dea
2020-05-20 15:55:34 [INFO] Starting ProxySQL
2020-05-20 15:55:34 [INFO] Sucessfully started
2020-05-20 15:55:34 [INFO] Angel process started ProxySQL process 734330
Standard ProxySQL MySQL Logger rev. 2.0.0714 -- MySQL_Logger.cpp -- Sun May 17 20:24:24 2020
Standard ProxySQL Cluster rev. 0.4.0906 -- ProxySQL_Cluster.cpp -- Sun May 17 20:24:24 2020
Standard ProxySQL Statistics rev. 1.4.1027 -- ProxySQL_Statistics.cpp -- Sun May 17 20:24:24 2020
Standard ProxySQL HTTP Server Handler rev. 1.4.1031 -- ProxySQL_HTTP_Server.cpp -- Sun May 17 20:24:24 2020
start_server
backup_dir=$topdir/xb_export_backup
rm -rf $backup_dir
mkdir $backup_dir
mysql -e 'CREATE TABLE test1(a int, b int, PRIMARY KEY (a), KEY (b DESC))' test
mysql -e 'CREATE TABLE test2(a int, b int, PRIMARY KEY (a), KEY (b ASC))' test
mysql -e "INSERT INTO test1 VALUES(1,2)" test