[MDEV-32041] "plugin already loaded" should be a Warning, not an Error Created: 2023-08-30  Updated: 2023-12-09  Resolved: 2023-12-09

Status: Closed
Project: MariaDB Server
Component/s: Plugins
Affects Version/s: None
Fix Version/s: 10.4.33, 10.5.24, 10.6.17, 10.11.7, 11.0.5, 11.1.4, 11.2.3

Type: Bug Priority: Critical
Reporter: Hartmut Holzgraefe Assignee: Daniel Black
Resolution: Fixed Votes: 0
Labels: None

Issue Links:
Relates
relates to MDEV-32043 mariadb-upgrade should remove mysql.p... Closed
relates to MDEV-7652 More explanatory ERROR and WARNING me... Closed
relates to MDEV-32626 Server hangs during startup with plug... Closed

 Description   

When there are multiple requests to load the same plugin, e.g. both a "plugin_load_add" in the config file and an entry in the mysql.plugin table via "INSTALL PLUGIN", an error message is logged, e.g.:

[ERROR] mariadbd: Plugin 'unix_socket' is already installed.

IMHO this should only be a warning, not an error, as initial loading of the plugin was successful, so no real damage is done by the 2nd loading attempt in most cases.

The exception would be an attempt to load a different version of the same plugin library, but even then a warning should be sufficient IMHO, especially as even the current error output does not terminate server startup.

So both a warning and the current error would go unnoticed if a user doesn't bother to check the error log output, but the current error messages makes the situation sound much more critical than it actually is.



 Comments   
Comment by Daniel Black [ 2023-08-31 ]

10.4+:

Can't INSTALL PLUGIN IF NOT EXISTS be used to downgrade any error to a warning?

If a replacement is desired can UNINSTALL PLUGIN IF EXISTS be used before the INSTALL PLUGIN?

Comment by Sergei Golubchik [ 2023-08-31 ]

IF NOT EXISTS would be more consistent with other statements. For example, DROP TABLE fails if the table doesn't exist, it's not a warning because "the table doesn't exist after the statement anyway, no real damage was done"

Comment by Hartmut Holzgraefe [ 2023-10-02 ]

This was not so much about error handling on INSTALL PLUGIN, but about a plugin already installed, and so present in the mysql.plugin table, also being loaded via plugin_load_add in the config file(s).

As plugin_load_add happens first when the mysql.plugin table contents are processed later during startup that "Error: plugin already loaded" log line is now raised on every startup, while typically this is not actually much of a problem as trying to load a plugin that is already loaded would just be an idempotent operation.

The server will function the same way regardless of whether a plugin is loaded via plugin_load_add or a prior INSTALL PLUGIN, thus my reasoning that this should merely be a warning, not an error, as server functionality is not impacted.

Comment by Daniel Black [ 2023-10-12 ]

The implementation in https://github.com/MariaDB/server/pull/2744 also covers this case.

MariaDB [(none)]> install soname 'locales.so';
Query OK, 0 rows affected (0.001 sec)
 
MariaDB [(none)]> shutdown;
Query OK, 0 rows affected (0.000 sec)

$ sql/mariadbd --no-defaults --datadir=/tmp/${PWD##*/}-datadir --socket=/tmp/${PWD##*/}.sock --plugin-dir=${PWD}/mysql-test/var/plugins/ --verbose --skip-networking --plugin-load-add=locales
2023-10-13 10:07:41 0 [Note] Starting MariaDB 10.4.32-MariaDB source revision 3981e9cb385d435d17772c38504982ae9cf8293b as process 39312
2023-10-13 10:07:41 0 [Note] InnoDB: Using Linux native AIO
2023-10-13 10:07:41 0 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
2023-10-13 10:07:41 0 [Note] InnoDB: Uses event mutexes
2023-10-13 10:07:41 0 [Note] InnoDB: Compressed tables use zlib 1.2.13
2023-10-13 10:07:41 0 [Note] InnoDB: Number of pools: 1
2023-10-13 10:07:41 0 [Note] InnoDB: Using SSE2 crc32 instructions
2023-10-13 10:07:41 0 [Note] InnoDB: Initializing buffer pool, total size = 128M, instances = 1, chunk size = 128M
2023-10-13 10:07:41 0 [Note] InnoDB: Completed initialization of buffer pool
2023-10-13 10:07:41 0 [Note] InnoDB: If the mysqld execution user is authorized, page cleaner thread priority can be changed. See the man page of setpriority().
2023-10-13 10:07:41 0 [Note] InnoDB: 128 out of 128 rollback segments are active.
2023-10-13 10:07:41 0 [Note] InnoDB: Creating shared tablespace for temporary tables
2023-10-13 10:07:41 0 [Note] InnoDB: Setting file './ibtmp1' size to 12 MB. Physically writing the file full; Please wait ...
2023-10-13 10:07:41 0 [Note] InnoDB: File './ibtmp1' size is now 12 MB.
2023-10-13 10:07:41 0 [Note] InnoDB: Waiting for purge to start
2023-10-13 10:07:41 0 [Note] InnoDB: 10.4.32 started; log sequence number 60961; transaction id 20
2023-10-13 10:07:41 0 [Note] InnoDB: Loading buffer pool(s) from /tmp/build-mariadb-server-10.4-datadir/ib_buffer_pool
2023-10-13 10:07:41 0 [Note] Plugin 'FEEDBACK' is disabled.
2023-10-13 10:07:41 0 [Note] InnoDB: Buffer pool(s) load completed at 231013 10:07:41
2023-10-13 10:07:41 0 [Note] mariadbd: Plugin 'LOCALES' already installed
2023-10-13 10:07:41 0 [Note] Reading of all Master_info entries succeeded
2023-10-13 10:07:41 0 [Note] Added new Master_info '' to hash table
2023-10-13 10:07:41 0 [Note] sql/mariadbd: ready for connections.
Version: '10.4.32-MariaDB'  socket: '/tmp/build-mariadb-server-10.4.sock'  port: 0  Source distribution

Generated at Thu Feb 08 10:28:22 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.