Hello!

On Wed, 24 May 2023 at 18:32, Sergei Golubchik <serg@mariadb.org> wrote:
> @@ -7750,6 +7750,8 @@ ha_innobase::write_row(

>       DBUG_ENTER("ha_innobase::write_row");

> +     DBUG_ASSERT(is_root_handler() || table->file->ht != innodb_hton_ptr);

instead of putting this assert into every handler's implementation
and in many methods, why not to have it in handler ha_ methods or may be
even in the is_root_handler itself?

We can only put this assertion to a leaf handler. The assertion itself means:
"A it's a leaf handler, then it's either a root handler as well, or a root hton is different".
 
You can compare this->ht with
table->file->ht. For example, like

  DBUG_ASSERT(this == table->file || this->ht != table->file->ht);
 
This'll mean that there can't be more than two layers of handlers. 

I suspect I'm able to move the assertion to a more generic place, like is_root_handler,
but I'd have to check whether a handler's hton is a "certainly leaf" one by comparing
it with ha_resolve_by_name outputs for "myisam" and "innodb".

--
Yours truly,
Nikita Malyavin