Uploaded image for project: 'MariaDB Server'
  1. MariaDB Server
  2. MDEV-33779

InnoDB row operations could be faster

    XMLWordPrintable

Details

    Description

      While investigating MDEV-33533, I noticed that the function ha_innobase::rnd_pos() is duplicating a ut_a() assertion is also at the start of the invoked function ha_innobase::index_next(). For checking the assertion condition, two non-inlined function calls are needed. I think that we should enable this assertion only in debug builds, and retain it in a few places only, such as ha_innobase::change_active_index(). There are also other occurrences of this assertion:

      @@ -9179,7 +9179,7 @@ void
       ha_innobase::try_semi_consistent_read(bool yes)
       /*===========================================*/
       {
      -	ut_a(m_prebuilt->trx == thd_to_trx(ha_thd()));
      +	DBUG_ASSERT(m_prebuilt->trx == thd_to_trx(ha_thd()));
       
       	/* Row read type is set to semi consistent read if this was
       	requested by the MySQL and either innodb_locks_unsafe_for_binlog
      @@ -9349,8 +9349,7 @@ ha_innobase::index_read(
       	DBUG_ENTER("index_read");
       	DEBUG_SYNC_C("ha_innobase_index_read_begin");
       
      -	ut_a(m_prebuilt->trx == thd_to_trx(m_user_thd));
      -	ut_ad(key_len != 0 || find_flag != HA_READ_KEY_EXACT);
      +	DBUG_ASSERT(m_prebuilt->trx == thd_to_trx(m_user_thd));
       
       	dict_index_t*	index = m_prebuilt->index;
       
      

      Furthermore, the function ha_innobase::index_read() is executing two sets of tests on find_flag, while one switch (find_flag) could perform the same more efficiently. There is also some duplicated code at the end of the function, for the error handling of row_search_mvcc().

      Attachments

        Issue Links

          Activity

            People

              marko Marko Mäkelä
              marko Marko Mäkelä
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Git Integration

                  Error rendering 'com.xiplink.jira.git.jira_git_plugin:git-issue-webpanel'. Please contact your Jira administrators.