TokuDB table stats row count decreases to 1

percona-servertokudb

I have a few Percona 5.6.30 servers with a TokuDB table that has ~120 million rows. On some of these servers, row count in SHOW TABLE STATUS mysteriously decreases until is hits 1. This is accompanied by rather unpleasant performance reduction and happens on both master and slave servers.

I've tried to fix this by running ANALYZE TABLE, running OPTIMIZE TABLE, restarting the affected server, running ALTER TABLE ... FORCE. None of these has had any effect. The only two things that help are ALTER TABLE ... ENGINE=TokuDB and recreating the table from dumped data. These bring row count back to sane values, after which they begin to decrease again.

Any hints about what might have caused this issue and how to fix it would be helpful.

Best Answer

We looked into it for a while and it looks like this is a regression in Percona. I wasn't yet able to reproduce it outside our own environment, but it started when we upgraded our servers from 5.6.22 to 5.6.28, persisted through upgrading to 5.6.30, and disappeared when we returned to 5.6.22.

The stats decreate was present on both master and slave servers and apparently depended on traffic the database served. I was not able to replicate this on any smaller data nor with any specific queries.