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

implement a generic way to change a value of a variable in a scope

Details

    Description

      Some class should store an old value and change it's value to a new/tmp value in ctor, and restore an old value in dtor.

      Attachments

        Issue Links

          Activity

            kevg Eugene Kosov (Inactive) added a comment - https://github.com/MariaDB/server/commits/bb-10.7-MDEV-22441-scoped-variable
            kevg Eugene Kosov (Inactive) added a comment - Rebased onto 10.8 https://github.com/MariaDB/server/commits/bb-10.8-MDEV-22441-scoped-variable

            Please review bb-10.5-midenok2

            midenok Aleksey Midenkov added a comment - Please review bb-10.5-midenok2

            I think that we can have it in a code base, however it should be used with some causion: it's better to control the behavior with function arguments, rather than semi-global variables. Historically, THD::sql_mode and THD::abort_on_warning are the two exceptions.

            midenok I think that SCOPE_MASK_SET and SCOPE_MASK_CLEAR names will do better than SCOPE_SET and SCOPE_CLEAR. Or, maybe, SCOPE_MASK_ADD and SCOPE_MASK_REMOVE.

            Also I think that CONCAT and ANONYMOUS_VARIABLE may find a wider use, so I'd suggest to put them in some more generic header: it can be my_global.h, or another new header, like macro_utilities.h

            With some better namings for SCOPE_SET/CLEAR, commits d5710a4423 and 86bc9aa0aa will be ok to push.

            nikitamalyavin Nikita Malyavin added a comment - I think that we can have it in a code base, however it should be used with some causion: it's better to control the behavior with function arguments, rather than semi-global variables. Historically, THD::sql_mode and THD::abort_on_warning are the two exceptions. midenok I think that SCOPE_MASK_SET and SCOPE_MASK_CLEAR names will do better than SCOPE_SET and SCOPE_CLEAR. Or, maybe, SCOPE_MASK_ADD and SCOPE_MASK_REMOVE. Also I think that CONCAT and ANONYMOUS_VARIABLE may find a wider use, so I'd suggest to put them in some more generic header: it can be my_global.h, or another new header, like macro_utilities.h With some better namings for SCOPE_SET/CLEAR, commits d5710a4423 and 86bc9aa0aa will be ok to push.

            How did this get pushed into 10.5 just a week ago or so?
            This is a code refactoring, it it not appropriate for any GA release, let alone earliest supported GA 10.5.
            Where is the review of this patch, who approved it for push to 10.5?

            Unless there is an explanation for why this should go in 10.5, it needs to be reverted before next release.

            knielsen Kristian Nielsen added a comment - How did this get pushed into 10.5 just a week ago or so? This is a code refactoring, it it not appropriate for any GA release, let alone earliest supported GA 10.5. Where is the review of this patch, who approved it for push to 10.5? Unless there is an explanation for why this should go in 10.5, it needs to be reverted before next release.

            knielsen this was approved by serg. It goes to 10.5 because MDEV-22438 is in 10.5 and this is second part of that task. As long as this refactoring is harmless we want to keep it in 10.5 to avoid merge conflicts unless you have any counterarguments that this can inflict any harm.

            midenok Aleksey Midenkov added a comment - knielsen this was approved by serg . It goes to 10.5 because MDEV-22438 is in 10.5 and this is second part of that task. As long as this refactoring is harmless we want to keep it in 10.5 to avoid merge conflicts unless you have any counterarguments that this can inflict any harm.
            knielsen Kristian Nielsen added a comment - - edited

            midenok Ok, but I did not see any explanation for this in either this issue or in the commit comments, nor do I see serg's review anywhere. Refactoring in general is very much not appropriate for GA releases, so when there is a particular reason to do it anyway it is important that this reason is explained somewhere.

            knielsen Kristian Nielsen added a comment - - edited midenok Ok, but I did not see any explanation for this in either this issue or in the commit comments, nor do I see serg's review anywhere. Refactoring in general is very much not appropriate for GA releases, so when there is a particular reason to do it anyway it is important that this reason is explained somewhere.

            Wait, it must be some mistake. I wasn't a reviewer, Nikita was.

            If I'd been a reviewer, though, I'd say it could go into 10.5, being, basically, hardly worse then renaming a variable.

            serg Sergei Golubchik added a comment - Wait, it must be some mistake. I wasn't a reviewer, Nikita was. If I'd been a reviewer, though, I'd say it could go into 10.5, being, basically, hardly worse then renaming a variable.

            Correct, I was a reviewer.

            This is a code refactoring, it it not appropriate for any GA release

            I know no such policy for Foundation.

            nikitamalyavin Nikita Malyavin added a comment - Correct, I was a reviewer. This is a code refactoring, it it not appropriate for any GA release I know no such policy for Foundation.
            midenok Aleksey Midenkov added a comment - - edited

            knielsen Got it. We were discussing this in private chat. Next time I'll notify explicitly permission granted.

            P.S. And yes, Nikita was the reviewer, but first I got an approval from Sergei.

            midenok Aleksey Midenkov added a comment - - edited knielsen Got it. We were discussing this in private chat. Next time I'll notify explicitly permission granted. P.S. And yes, Nikita was the reviewer, but first I got an approval from Sergei.

            As a followup note, this code works with gcc 4.8 and it is tested not only by tests, but by bootstrap as well.

            midenok Aleksey Midenkov added a comment - As a followup note, this code works with gcc 4.8 and it is tested not only by tests, but by bootstrap as well.

            People

              midenok Aleksey Midenkov
              kevg Eugene Kosov (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              5 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.