Hi, Nikita, On Oct 09, Nikita Malyavin wrote:
Hi!
On Fri, 29 Sept 2023 at 21:41, Sergei Golubchik wrote:
+using Online_alter_cache_list= ilist<online_alter_cache_data>;
please, use typedef for that
Fine, but can you explain what's your reasoning behind this?
I've never seen this pattern before, so I googled. It seems to be exactly the same as typedef, is that right? In that case, it's just an Occam's razor - we use typedef everywhere already, we never use using for this purpose, so why multiply entities beyond necessity? Or am I wrong and using has a different semantics in this context?
class online_alter_cache_data: public Sql_alloc, public ilist_node<>,
public binlog_cache_data @@ -246,7 +268,11 @@ int online_alter_savepoint_rollback(THD *thd, LEX_CSTRING name)
static int online_alter_close_connection(handlerton *hton, THD *thd) { - DBUG_ASSERT(thd->online_alter_cache_list.empty()); + Ha_data &ha= thd->ha_data[online_alter_hton->slot]; + auto *cache_list= (Online_alter_cache_list*)ha.ha_ptr;
why not thd_get_ha_data()?
I suppose that this simple wrapper is used for dependency inversion, i.e. to access thd data outside `sql` scope, like innodb does it.
well, yes. it's also a convenient helper to access ha_data in sql/ too. you know, hide the implementation, this kind of things. why not to use it, for performance reasons? what's the downside? Regards, Sergei Chief Architect, MariaDB Server and security@mariadb.org