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

hostname_max column is empty #181

Open
vachanda opened this issue Oct 18, 2016 · 3 comments
Open

hostname_max column is empty #181

vachanda opened this issue Oct 18, 2016 · 3 comments

Comments

@vachanda
Copy link

Hi,

I'm using pt-query-digest to parse the mysql slow query logs and am trying to visualize the data using anemometer. I run initial DB schema migrations on anemometer, but when I try to run the pt-query-digest command, it fails with the error - DBD::mysql::st execute failed: Column 'hostname_max' cannot be null.

The pt-query-digest command -

pt-query-digest --user=abc --password=abc --database=slow_query_log \
                           --review h=localhost,D=slow_query_log,t=global_query_review \
                           --history h=localhost,D=slow_query_log,t=global_query_review_history \
                           --no-report --limit=0% slow_query.log

I'm running it on mysql version 5.7.12 and percona-toolkit version 2.2.18.
Any ideas on how to fix it?

@akuzminsky
Copy link
Contributor

@vachanda , we'll have a look

@krzykawski
Copy link

krzykawski commented Jan 11, 2017

I'm sure vachanda above already has fixed this. For others that are having the same issue, the pt-query-digest command line need the hostname specified as described in https://github.com/box/Anemometer/blob/master/README.md

i.e, my function in my collect script run across all db's is:
`
digest() {

    LOG "Running pt-query-digest and saving metrics in database $STOREDB - file: $1"

    pt-query-digest \
    --user=${DBUSER} \
    --password=${DBPASS} \
    --review h=${STOREDB},D=slow_query_log,t=global_query_review,P=${STOREDBPORT} \
    --history h=${STOREDB},D=slow_query_log,t=global_query_review_history,P=${STOREDBPORT} \
    --no-report \
    --limit=0% \
    --filter=" \$event->{Bytes} = length(\$event->{arg}) and \$event->{hostname}=\"$HOSTNAME:$MYPORT\"" $1 >> $SESSIONLOGFILE

EXIT=$?

}
`

Note $HOSTNAME and $MYPORT. The latter is picked up from the local my.cnf file like: MYPORT=$(cat /etc/my.cnf|grep port|head -1|sed 's/[^0-9]//g'). The former is a bash default var, but if you're on an older bash, you can populate it like HOSTNAME=$(hostname)

@Jonathanliu525
Copy link

I have the same problem when I use the percona-toolkit 2.2.13,although I specify the host by using --filter=" \$event->{Bytes} = length(\$event->{arg}) and \$event->{hostname}=\"$HOSTNAME\""
I solve it after changing to percona-toolkit 3.0.2.
know more about the hostname_max. You can read this

https://www.percona.com/blog/2012/08/28/hidden-columns-of-query_review_history/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants