Piwik can't create archive table for july 2017


I installed a brand new Piwik for my site in June (Piwki v3.0.4) with a crontab for the archiver.
It worked for a couple of days but, in july, it went mad with the following error :

SQLSTATE[HY000]: General error: 1005 Can't create table 'XXX.piwik_archive_numeric_2017_07' (errno: -1)

Now that we are in august it still seems to be locked on this “july problem” : the table piwik_archive_numeric_2017_08 has been created successfully but it’s still not able to create july’s

How can I get more info about the SQL request piwik is trying to execute ?

Try enabling SQL logging to get a closer look what’s going on with your SQL queries.

Add the following to your config.ini.php

enable_sql_profiler = 1

Thank’s for the tip @howdytom (I don’t know why I missed it in piwik’s Troubleshooting guide …)
Yet it’s not helping so I drilled down the code and figured out it was linked to this line (and you can see logging is not enabled in this method)

(skipping a few steps)

Bottom point is mysql states that the innodb file for the table already exists (but the table itself is not loaded)
I know my hosting had a major db issue in july ==> this must have corrupted the file.
I’m getting in touch with them