Assertion `Handlerton: db != NULL ' failed (errno=0) in analyze_key | tokudb/ha_tokudb_admin.cc:582
Startup options : --plugin-load-add=tokudb=ha_tokudb.so --sql_mode=ONLY_FULL_GROUP_BY
The attached tarball (1457331400_bug_bundle.tar.gz) gives the testcase as an exact match of our system, including some handy utilities
It seems that with tokudb_auto_analyze > 0, an ALTER TABLE can trigger an auto analysis. if tokudb_analyze_in_background = true, this analysis is dispatched to the bjm and executed in parallel.
The problem is that with an ALTER TABLE DROP KEY, the analysis can try to run on the table/key meta-data (number of and definition of keys) before the table/key meta-data has been updated in the TOKUDB_SHARE by the process of COMMITing the ALTER (close and re-open) and therefore the analyze will be operating on old/bad table/key meta-data.
The fix is to not allow an ALTER to trigger an analyze at all.