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

Factor out code repeat in functions calling spider_check_and_init_casual_read()

    XMLWordPrintable

Details

    Description

      The following ha_spider methods inside ha_spider.cc call spider_check_and_init_casual_read()

      ft_read_internal multi_range_read_next_first
      index_first_map_internal multi_range_read_next_next
      index_last_internal range_read_first_internal
      index_read_last_map_internal rnd_next_internal
      index_read_map_internal

      Near the callsite is about 80 lines of repeated code. Part of the repeated region is also a common pattern found in other spider files and functions. They need to be factored out.

      See the attached gif for an IDE demo, as well as attached .cc files with these functions extracted out (at 11.0 941f91edbc3d3a0a184b9bfc58d5e4042c4b65f1).

      Attachments

        1. ft_read_internal.cc
          10 kB
        2. index_first_map_internal.cc
          10 kB
        3. index_last_internal.cc
          10 kB
        4. index_read_last_map_internal.cc
          10 kB
        5. index_read_map_internal.cc
          10 kB
        6. multi_range_read_next_first.cc
          38 kB
        7. multi_range_read_next_next.cc
          37 kB
        8. range_read_first_internal.cc
          10 kB
        9. rnd_next_internal.cc
          11 kB
        10. screen.gif
          screen.gif
          2.03 MB

        Issue Links

          Activity

            People

              ycp Yuchen Pei
              ycp Yuchen Pei
              Votes:
              1 Vote for this issue
              Watchers:
              6 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.