Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pt stalk flow control rate #49

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions mysql/pt-stalk/trg/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,16 @@
To configure it run:

```
# pt-stalk-flow-control-rate.sh
# Adjust threshold to make pt-stalk trigger when it reaches this value
PT_STALK_PLUGIN='pt-stalk-flow-control-rate.sh'
PTDEST=/tmp/pt/collected/`hostname`/
mkdir -p $PTDEST;
cd /tmp/pt;
wget percona.com/get/pt-stalk https://raw.githubusercontent.com/percona/support-snippets/master/mysql/pt-stalk/trg/$PT_STALK_PLUGIN;
chmod +x pt*;
sudo ./pt-stalk --daemonize --dest=$PTDEST --pid=/tmp/pt/stalk.pid --log=/tmp/pt/stalk.log --function=/tmp/pt/$PT_STALK_PLUGIN --variable='wsrep_flow_control_paused_ns' --threshold=100 --iterations=2 --sleep=30 -- --user=root --password=''

#Adjust to your plugin name
PT_STALK_PLUGIN='pt-stalk-load.sh'
PTDEST=/tmp/pt/collected/`hostname`/
Expand Down
14 changes: 14 additions & 0 deletions mysql/pt-stalk/trg/pt-stalk-flow-control-rate.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#!/bin/bash
trg_plugin() {
current_sample_tmp_file="/tmp/pt-stalk-flow-control-rate.dat";
current_sample=$(mysql ${EXT_ARGV} -BNe "SHOW GLOBAL STATUS LIKE 'wsrep_flow_control_paused_ns'" | awk '{ print $2 }');
if [ -f "$current_sample_tmp_file" ]
then
previous_sample=$(cat $current_sample_tmp_file);
echo "$current_sample" > $current_sample_tmp_file;
echo $(( (current_sample - previous_sample) / 1000 / 1000 )) | awk '{ print $1 }';
else
echo "$current_sample" > $current_sample_tmp_file;
echo 0;
fi
}