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

Some conditions around btr_latch_mode could be eliminated

    XMLWordPrintable

Details

    Description

      The types btr_latch_mode and mtr_memo_type_t are partly derived from rw_lock_type_t. Despite that, some code for converting between them is using conditions instead of bitwise arithmetics.

      If we align btr_latch_mode better with mtr_memo_type_t, some conversions by bitwise arithmetics will become possible. For example, the arithmetic expression

      	const rw_lock_type_t mode = rw_lock_type_t(
      		latch_mode & (RW_X_LATCH | RW_S_LATCH));
      

      would replace conditional code like the following:

      	mode = latch_mode == BTR_MODIFY_LEAF ? RW_X_LATCH : RW_S_LATCH;
      

      Attachments

        Activity

          People

            marko Marko Mäkelä
            marko Marko Mäkelä
            Votes:
            0 Vote for this issue
            Watchers:
            1 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.