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

Get option group suffix from $MARIADB_GROUP_SUFFIX in addition to $MYSQL_GROUP_SUFFIX

Details

    Description

      Currently, if the --defaults-group-suffix option is not set, then MariaDB checks if the $MYSQL_GROUP_SUFFIX environment variable is set. If it is set, then MariaDB uses that value as the option group suffix:

      https://github.com/MariaDB/server/blob/mariadb-10.4.11/mysys/my_default.c#L237

      https://mariadb.com/kb/en/library/configuring-mariadb-with-option-files/#custom-option-group-suffixes

      To further MariaDB's branding, I think MariaDB should similarly be able to use $MARIADB_GROUP_SUFFIX to determine the option group suffix, if the environment variable is set.

      Attachments

        Issue Links

          Activity

            Will something like this work? Concatenating the option group suffix from both $MYSQL_GROUP_SUFFIX and $MARIADB_GROUP_SUFFIX if both exists. Then will raise a PR for this one.

            @@ -318,7 +319,32 @@ int get_defaults_options(char **argv)
               }
             
               if (! my_defaults_group_suffix)
            -    my_defaults_group_suffix= getenv("MYSQL_GROUP_SUFFIX");
            +  {
            +    const char *mysql_group_suffix= getenv("MYSQL_GROUP_SUFFIX");
            +    const char *mariadb_group_suffix= getenv("MARIADB_GROUP_SUFFIX");
            +
            +    if (mysql_group_suffix && mariadb_group_suffix)
            +    {
            +    // If both environment variables are set, concatenate their values
            +      size_t len= strlen(mysql_group_suffix) + strlen(mariadb_group_suffix);
            +      if (!(combined_suffix= malloc(len+1)))
            +        DBUG_RETURN(2);
            +
            +      strcpy(combined_suffix, mysql_group_suffix);
            +      strcat(combined_suffix, mariadb_group_suffix);
            +      my_defaults_group_suffix= combined_suffix;
            +    }
            +    else if (mysql_group_suffix)
            +    {
            +      // If only MYSQL_GROUP_SUFFIX is set, use its value
            +      my_defaults_group_suffix= mysql_group_suffix;
            +    }
            +    else if (mariadb_group_suffix)
            +    {
            +      // If only MARIADB_GROUP_SUFFIX is set, use its value
            +      my_defaults_group_suffix= mariadb_group_suffix;
            +    }
            +  }
            

            Debjyoti Debjyoti Ghosh added a comment - Will something like this work? Concatenating the option group suffix from both $MYSQL_GROUP_SUFFIX and $MARIADB_GROUP_SUFFIX if both exists. Then will raise a PR for this one. @@ -318,7 +319,32 @@ int get_defaults_options( char **argv) } if (! my_defaults_group_suffix) - my_defaults_group_suffix= getenv ( "MYSQL_GROUP_SUFFIX" ); + { + const char *mysql_group_suffix= getenv ( "MYSQL_GROUP_SUFFIX" ); + const char *mariadb_group_suffix= getenv ( "MARIADB_GROUP_SUFFIX" ); + + if (mysql_group_suffix && mariadb_group_suffix) + { + // If both environment variables are set, concatenate their values + size_t len= strlen (mysql_group_suffix) + strlen (mariadb_group_suffix); + if (!(combined_suffix= malloc (len+1))) + DBUG_RETURN(2); + + strcpy (combined_suffix, mysql_group_suffix); + strcat (combined_suffix, mariadb_group_suffix); + my_defaults_group_suffix= combined_suffix; + } + else if (mysql_group_suffix) + { + // If only MYSQL_GROUP_SUFFIX is set, use its value + my_defaults_group_suffix= mysql_group_suffix; + } + else if (mariadb_group_suffix) + { + // If only MARIADB_GROUP_SUFFIX is set, use its value + my_defaults_group_suffix= mariadb_group_suffix; + } + }
            amjilani Amar Jilani added a comment -

            This issue has been addressed in this PR : https://github.com/MariaDB/server/pull/3787

            amjilani Amar Jilani added a comment - This issue has been addressed in this PR : https://github.com/MariaDB/server/pull/3787

            People

              ralf.gebhardt Ralf Gebhardt
              GeoffMontee Geoff Montee (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              5 Start watching this issue

              Dates

                Created:
                Updated:

                Git Integration

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