Sorry, the assertion should be
DBUG_ASSERT(table->file == this || dynamic_cast<ha_innobase*>(table->file) == NULL);
Well, the tests seem passing after adding this assertion (and a similar one for myisam):
Okay, I think I can agree on this approach, but then I want these assertions to be committed as well.
dynamic_cast can be replaced with hton comparison, of your choice.
Maybe somebody later will need row changes from a separate handler, imagine for example cascade
foreign key updates, which would have used a lookup handler for the cascade changes. For that case,
I'll try to gather these table->file comparisons under a single method.
Alternatively, we could introduce some bool handler::root_handler just now, without waiting for a demand,
but I'm afraid it could become another source for bugs. So better later on demand.