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

Spider: remove unnecessary #ifdef and dead code in #ifdef

Details

    Description

      Remove unnecessary #ifdefs and dead code, in Spider, which is protected by #ifdef.

      Some time ago, the Spider was a separate project, and Kentoku tried to make it compile on many MySQL and MariaDB versions without changes. So, there are many #ifdef macro in the Spider codebase, which were to adjust Spider for changes in API over different server versions. For example, see ITEM_FUNC_CASE_PARAMS_ARE_PUBLIC. Now, the Spider is part of the source tree, and thus we can remove dead code in #ifdef.

      Use unifdef as far as possible.

      Attachments

        Issue Links

          1.
          Spider: remove #if defined(MARIADB_BASE_VERSION) && MYSQL_VERSION_ID >= ${VERSION} Technical task Closed Nayuta Yanagisawa (Inactive)
          2.
          Spider: remove #if MYSQL_VERSION_ID < ${VERSION} Technical task Closed Nayuta Yanagisawa (Inactive)
          3.
          Spider: remove #ifdef WITHOUT_SPIDER_BG_SEARCH Technical task Closed Nayuta Yanagisawa (Inactive)
          4.
          Spider: remove #ifdef HA_CAN_BULK_ACCESS Technical task Closed Nayuta Yanagisawa (Inactive)
          5.
          Spider: remove #ifdef HANDLER_HAS_DIRECT_AGGREGATE Technical task Closed Nayuta Yanagisawa (Inactive)
          6.
          Spider: remove #ifdef HA_MRR_USE_DEFAULT_IMPL Technical task Closed Nayuta Yanagisawa (Inactive)
          7.
          Spider: remove #ifdef SPIDER_HAS_HASH_VALUE_TYPE Technical task Closed Nayuta Yanagisawa (Inactive)
          8.
          Spider: remove #ifdef HANDLER_HAS_DIRECT_UPDATE_ROWS Technical task Closed Nayuta Yanagisawa (Inactive)
          9.
          Spider: remove #ifdef HASH_UPDATE_WITH_HASH_VALUE Technical task Closed Nayuta Yanagisawa (Inactive)
          10.
          Spider: remove #ifdef SPIDER_HAS_GROUP_BY_HANDLER Technical task Closed Yuchen Pei
          11.
          Spider: remove #ifdef HA_HAS_CHECKSUM_EXTENDED Technical task Closed Nayuta Yanagisawa (Inactive)
          12.
          Spider: remove #ifdef MARIADB_BASE_VERSION Technical task Closed Nayuta Yanagisawa (Inactive)
          13.
          Spider: remove #ifdef SPIDER_HAS_DISCOVER_TABLE_STRUCTURE Technical task Closed Nayuta Yanagisawa (Inactive)
          14.
          Spider: remove #ifdef SPIDER_HANDLER_SUPPORT_MULTIPLE_KEY_PARTS Technical task Closed Nayuta Yanagisawa (Inactive)
          15.
          Spider: remove #if defined(PARTITION_HAS_GET_CHILD_HANDLERS) Technical task Closed Nayuta Yanagisawa (Inactive)
          16.
          Spider: remove #ifdef HANDLER_HAS_DIRECT_UPDATE_ROWS_WITH_HS Technical task Closed Nayuta Yanagisawa (Inactive)
          17.
          Spider: remove #ifdef SPIDER_HANDLER_START_BULK_INSERT_HAS_FLAGS Technical task Closed Nayuta Yanagisawa (Inactive)
          18.
          Spider: remove #ifdef SPIDER_SUPPORT_CREATE_OR_REPLACE_TABLE Technical task Closed Nayuta Yanagisawa (Inactive)
          19.
          Spider: remove #ifdef SPIDER_USE_CONST_ITEM_FOR_STRING_INT_REAL_DECIMAL_DATE_ITEM Technical task Closed Nayuta Yanagisawa (Inactive)
          20.
          Spider: remove #ifdef SPIDER_SQL_CACHE_IS_IN_LEX Technical task Closed Nayuta Yanagisawa (Inactive)
          21.
          Spider: remove #ifdef SPIDER_LIKE_FUNC_HAS_GET_NEGATED Technical task Closed Nayuta Yanagisawa (Inactive)
          22.
          Spider: remove #ifdef SPIDER_I_S_USE_SHOW_FOR_COLUMN Technical task Closed Nayuta Yanagisawa (Inactive)
          23.
          Spider: remove #ifdef SPIDER_USE_CONST_ITEM_FOR_STRING_INT_REAL_DECIMAL_DATE_ITEM Technical task Closed Nayuta Yanagisawa (Inactive)
          24.
          Spider: remove #ifdef SPIDER_MDEV_16246 Technical task Closed Nayuta Yanagisawa (Inactive)
          25.
          Spider: remove #ifdef HANDLER_HAS_NEED_INFO_FOR_AUTO_INC Technical task Closed Nayuta Yanagisawa (Inactive)
          26.
          Spider: remove #ifdef SPIDER_HAS_MY_CHARLEN Technical task Closed Nayuta Yanagisawa (Inactive)
          27.
          Spider: remove #ifdef SPIDER_use_LEX_CSTRING_for_KEY_Field_name Technical task Closed Nayuta Yanagisawa (Inactive)
          28.
          Spider: remove #ifdef SPIDER_ITEM_STRING_WITHOUT_SET_STR_WITH_COPY_AND_THDPTR Technical task Closed Nayuta Yanagisawa (Inactive)
          29.
          Spider: remove #ifdef SPIDER_ITEM_STRING_WITHOUT_SET_STR_WITH_COPY Technical task Closed Nayuta Yanagisawa (Inactive)
          30.
          Spider: remove #ifdef SPIDER_use_LEX_CSTRING_for_Field_blob_constructor Technical task Closed Yuchen Pei
          31.
          Spider: remove #ifdef SPIDER_HAS_EXPR_CACHE_ITEM Technical task Closed Nayuta Yanagisawa (Inactive)
          32.
          Spider: remove #ifdef SPIDER_ITEM_HAS_CMP_TYPE Technical task Closed Nayuta Yanagisawa (Inactive)
          33.
          Spider: remove #ifdef ITEM_FUNC_CASE_PARAMS_ARE_PUBLIC Technical task Closed Yuchen Pei
          34.
          Spider: remove #ifdef SPIDER_XID_USES_xid_cache_iterate Technical task Closed Nayuta Yanagisawa (Inactive)
          35.
          Spider: remove #ifdef SPIDER_FIELD_FIELDPTR_REQUIRES_THDPTR Technical task Closed Yuchen Pei
          36.
          Spider: remove #ifdef SPIDER_Item_args_arg_count_IS_PROTECTED Technical task Closed Yuchen Pei
          37.
          Spider: remove #ifdef SPIDER_NET_HAS_THD Technical task Closed Yuchen Pei
          38.
          Spider: remove #ifdef HA_EXTRA_HAS_STARTING_ORDERED_INDEX_SCAN Technical task Closed Yuchen Pei
          39.
          Spider: remove #ifdef HANDLER_HAS_CAN_USE_FOR_AUTO_INC_INIT Technical task Closed Yuchen Pei
          40.
          Spider: remove #ifdef SPIDER_UPDATE_ROW_HAS_CONST_NEW_DATA Technical task Closed Yuchen Pei
          41.
          Spider: remove #ifdef ITEM_FUNC_TIMESTAMPDIFF_ARE_PUBLIC Technical task Closed Yuchen Pei

          Activity

            nayuta-yanagisawa Nayuta Yanagisawa (Inactive) added a comment - https://github.com/MariaDB/server/tree/bb-10.9-MDEV-26178
            ycp Yuchen Pei added a comment - - edited

            Hi holyfoot, ptal thanks. There are 22 commits below, including some previously fixed subtask MDEVs for higher versions, as well as all remaining unfixed subtask MDEVs. The commits not applicable to any subtask are marked with the present ticket, i.e. MDEV-26178. All subtasks covered by these changes will have their fixversions updated accordingly once they are pushed.

            7e000f0e075 upstream/bb-10.5-mdev-26178 MDEV-27648 remove #define HASH_UPDATE_WITH_HASH_VALUE
            8005450625d MDEV-26178 spider: delete spd_environ.h
            c5638c5e9bb MDEV-27644 Spider: remove HANDLER_HAS_DIRECT_AGGREGATE
            b963146789c MDEV-27662 remove SPIDER_SUPPORT_CREATE_OR_REPLACE_TABLE
            fb512706b7a MDEV-27809 remove SPIDER_I_S_USE_SHOW_FOR_COLUMN
            770220edff0 MDEV-27652 remove #ifdef HA_HAS_CHECKSUM_EXTENDED
            41812502e0c MDEV-27808 remove SPIDER_LIKE_FUNC_HAS_GET_NEGATED
            302548ab918 MDEV-27664 remove SPIDER_SQL_CACHE_IS_IN_LEX
            e6cc59f827e MDEV-27663 remove SPIDER_USE_CONST_ITEM_FOR_STRING_INT_REAL_DECIMAL_DATE_ITEM
            f4936f9ef37 MDEV-27811: remove SPIDER_MDEV_16246
            acf97c666cc MDEV-28226 Remove HANDLER_HAS_NEED_INFO_FOR_AUTO_INC
            72e9a3096a3 MDEV-26178 spider: remove PARTITION_HAS_GET_PART_SPEC
            d645d2dd51c MDEV-26178 Spider: remove HANDLER_HAS_TOP_TABLE_FIELDS
            d945e1f4b9a MDEV-27660 Remove #ifdef SPIDER_HANDLER_START_BULK_INSERT_HAS_FLAGS
            ff94f4796ba MDEV-28896 Spider: remove #ifdef SPIDER_UPDATE_ROW_HAS_CONST_NEW_DATA
            bc843c552fe MDEV-28895 Spider: remove #ifdef HANDLER_HAS_CAN_USE_FOR_AUTO_INC_INIT
            6d480d4466a MDEV-27647 Spider: remove HANDLER_HAS_DIRECT_UPDATE_ROWS
            ee5bdcf4078 MDEV-26178 Spider: remove HA_EXTRA_HAS_HA_EXTRA_USE_CMP_REF
            60e54cfd363 MDEV-28894 Spider: remove #ifdef HA_EXTRA_HAS_STARTING_ORDERED_INDEX_SCAN
            d5a6fef64f5 MDEV-28893 Spider: remove #ifdef SPIDER_NET_HAS_THD
            ff8dac182f0 MDEV-28892 remove #ifdef SPIDER_Item_args_arg_count_IS_PROTECTED
            bc737d5c5e9 MDEV-27646 remove SPIDER_HAS_HASH_VALUE_TYPE

            As expected, application to 10.11 is nontrivial, as 13 of the 22 commits are already in 10.11, and here are the patches on 10.11

            e115a1cb9b7 * upstream/bb-10.11-mdev-26178 MDEV-26178 spider: delete spd_environ.h
            d24aa9ee971 * MDEV-26178 spider: remove PARTITION_HAS_GET_PART_SPEC
            7f33185318a * MDEV-26178 Spider: remove HANDLER_HAS_TOP_TABLE_FIELDS
            e62fc09b632 * MDEV-28896 Spider: remove #ifdef SPIDER_UPDATE_ROW_HAS_CONST_NEW_DATA
            443f5f25a02 * MDEV-28895 Spider: remove #ifdef HANDLER_HAS_CAN_USE_FOR_AUTO_INC_INIT
            771ae466df2 * MDEV-26178 Spider: remove HA_EXTRA_HAS_HA_EXTRA_USE_CMP_REF
            284a095e2b2 * MDEV-28894 Spider: remove #ifdef HA_EXTRA_HAS_STARTING_ORDERED_INDEX_SCAN
            145a207d9d3 * MDEV-28893 Spider: remove #ifdef SPIDER_NET_HAS_THD
            e6a624477c8 * MDEV-28892 remove #ifdef SPIDER_Item_args_arg_count_IS_PROTECTED

            I have also applied the commits on 10.6 and 11.1, which are at af5c50df1a4bd2e796ce51745d0ee076ffb07419 and b7af1f4fb67f6e52c217127f859540bdeb5f4639 respectively.

            ycp Yuchen Pei added a comment - - edited Hi holyfoot , ptal thanks. There are 22 commits below, including some previously fixed subtask MDEVs for higher versions, as well as all remaining unfixed subtask MDEVs. The commits not applicable to any subtask are marked with the present ticket, i.e. MDEV-26178 . All subtasks covered by these changes will have their fixversions updated accordingly once they are pushed. 7e000f0e075 upstream/bb-10.5-mdev-26178 MDEV-27648 remove #define HASH_UPDATE_WITH_HASH_VALUE 8005450625d MDEV-26178 spider: delete spd_environ.h c5638c5e9bb MDEV-27644 Spider: remove HANDLER_HAS_DIRECT_AGGREGATE b963146789c MDEV-27662 remove SPIDER_SUPPORT_CREATE_OR_REPLACE_TABLE fb512706b7a MDEV-27809 remove SPIDER_I_S_USE_SHOW_FOR_COLUMN 770220edff0 MDEV-27652 remove #ifdef HA_HAS_CHECKSUM_EXTENDED 41812502e0c MDEV-27808 remove SPIDER_LIKE_FUNC_HAS_GET_NEGATED 302548ab918 MDEV-27664 remove SPIDER_SQL_CACHE_IS_IN_LEX e6cc59f827e MDEV-27663 remove SPIDER_USE_CONST_ITEM_FOR_STRING_INT_REAL_DECIMAL_DATE_ITEM f4936f9ef37 MDEV-27811: remove SPIDER_MDEV_16246 acf97c666cc MDEV-28226 Remove HANDLER_HAS_NEED_INFO_FOR_AUTO_INC 72e9a3096a3 MDEV-26178 spider: remove PARTITION_HAS_GET_PART_SPEC d645d2dd51c MDEV-26178 Spider: remove HANDLER_HAS_TOP_TABLE_FIELDS d945e1f4b9a MDEV-27660 Remove #ifdef SPIDER_HANDLER_START_BULK_INSERT_HAS_FLAGS ff94f4796ba MDEV-28896 Spider: remove #ifdef SPIDER_UPDATE_ROW_HAS_CONST_NEW_DATA bc843c552fe MDEV-28895 Spider: remove #ifdef HANDLER_HAS_CAN_USE_FOR_AUTO_INC_INIT 6d480d4466a MDEV-27647 Spider: remove HANDLER_HAS_DIRECT_UPDATE_ROWS ee5bdcf4078 MDEV-26178 Spider: remove HA_EXTRA_HAS_HA_EXTRA_USE_CMP_REF 60e54cfd363 MDEV-28894 Spider: remove #ifdef HA_EXTRA_HAS_STARTING_ORDERED_INDEX_SCAN d5a6fef64f5 MDEV-28893 Spider: remove #ifdef SPIDER_NET_HAS_THD ff8dac182f0 MDEV-28892 remove #ifdef SPIDER_Item_args_arg_count_IS_PROTECTED bc737d5c5e9 MDEV-27646 remove SPIDER_HAS_HASH_VALUE_TYPE As expected, application to 10.11 is nontrivial, as 13 of the 22 commits are already in 10.11, and here are the patches on 10.11 e115a1cb9b7 * upstream/bb-10.11-mdev-26178 MDEV-26178 spider: delete spd_environ.h d24aa9ee971 * MDEV-26178 spider: remove PARTITION_HAS_GET_PART_SPEC 7f33185318a * MDEV-26178 Spider: remove HANDLER_HAS_TOP_TABLE_FIELDS e62fc09b632 * MDEV-28896 Spider: remove #ifdef SPIDER_UPDATE_ROW_HAS_CONST_NEW_DATA 443f5f25a02 * MDEV-28895 Spider: remove #ifdef HANDLER_HAS_CAN_USE_FOR_AUTO_INC_INIT 771ae466df2 * MDEV-26178 Spider: remove HA_EXTRA_HAS_HA_EXTRA_USE_CMP_REF 284a095e2b2 * MDEV-28894 Spider: remove #ifdef HA_EXTRA_HAS_STARTING_ORDERED_INDEX_SCAN 145a207d9d3 * MDEV-28893 Spider: remove #ifdef SPIDER_NET_HAS_THD e6a624477c8 * MDEV-28892 remove #ifdef SPIDER_Item_args_arg_count_IS_PROTECTED I have also applied the commits on 10.6 and 11.1, which are at af5c50df1a4bd2e796ce51745d0ee076ffb07419 and b7af1f4fb67f6e52c217127f859540bdeb5f4639 respectively.
            Roel Roel Van de Paar added a comment - - edited

            Hi ycp Thank you for your detailed work on this. Once reviewed, let's give this branch a test run before it's pushed to main, just assign to me and let me know what branch to test. If you would have a recent 10.5 trunk with the patch, or patches, applied on top, that would work best (to avoid old regressions etc.), thank you.

            Roel Roel Van de Paar added a comment - - edited Hi ycp Thank you for your detailed work on this. Once reviewed, let's give this branch a test run before it's pushed to main, just assign to me and let me know what branch to test. If you would have a recent 10.5 trunk with the patch, or patches, applied on top, that would work best (to avoid old regressions etc.), thank you.
            ycp Yuchen Pei added a comment -

            Sounds good, thanks Roel.

            ycp Yuchen Pei added a comment - Sounds good, thanks Roel .

            ok to push.

            holyfoot Alexey Botchkov added a comment - ok to push.
            ycp Yuchen Pei added a comment -

            holyfoot thanks for the review.

            Roel I've included which commits to test in my latest comment in MDEV-31788[1]. The 10.5 branch based on a two week old 10.5 - is that new enough for the purpose of testing?

            [1] https://jira.mariadb.org/browse/MDEV-31788?focusedCommentId=287314&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-287314

            ycp Yuchen Pei added a comment - holyfoot thanks for the review. Roel I've included which commits to test in my latest comment in MDEV-31788 [1] . The 10.5 branch based on a two week old 10.5 - is that new enough for the purpose of testing? [1] https://jira.mariadb.org/browse/MDEV-31788?focusedCommentId=287314&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-287314

            Branches are fine. Testing as part of MDEV-31788.

            Roel Roel Van de Paar added a comment - Branches are fine. Testing as part of MDEV-31788 .

            OK to push

            Roel Roel Van de Paar added a comment - OK to push
            ycp Yuchen Pei added a comment - - edited

            All subtasks done. fixversions vary, may backport some subtasks when needed.

            ycp Yuchen Pei added a comment - - edited All subtasks done. fixversions vary, may backport some subtasks when needed.

            People

              ycp Yuchen Pei
              nayuta-yanagisawa Nayuta Yanagisawa (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              8 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.