[MDEV-21375] Get option group suffix from $MARIADB_GROUP_SUFFIX in addition to $MYSQL_GROUP_SUFFIX Created: 2019-12-21  Updated: 2023-03-25

Status: Open
Project: MariaDB Server
Component/s: Configuration
Fix Version/s: None

Type: Task Priority: Major
Reporter: Geoff Montee (Inactive) Assignee: Ralf Gebhardt
Resolution: Unresolved Votes: 0
Labels: beginner-friendly

Issue Links:
Relates
relates to CONC-449 Check $MARIADB_HOME/my.cnf in additio... Closed
relates to MDEV-21365 Check $MARIADB_HOME/my.cnf in additio... Closed

 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.



 Comments   
Comment by Debjyoti Ghosh [ 2023-03-25 ]

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;
+    }
+  }

Generated at Thu Feb 08 09:06:40 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.