Bug #70859 -DWITH_EXAMPLE_STORAGE_ENGINE=1 is ignored
Submitted: 8 Nov 2013 9:30 Modified: 27 Feb 2014 15:13
Reporter: Laurynas Biveinis (OCA) Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: Storage Engines Severity:S3 (Non-critical)
Version:5.7, 5.6.14 OS:Any
Assigned to: CPU Architecture:Any

[8 Nov 2013 9:30] Laurynas Biveinis
Description:
-DWITH_EXAMPLE_STORAGE_ENGINE=1 is ignored, although, according to the docs, it shouldn't be:

https://dev.mysql.com/doc/refman/5.7/en/source-configuration-options.html

o compile a storage engine statically into the server, use -DWITH_engine_STORAGE_ENGINE=1. Some permissible engine values are (...) EXAMPLE, (...).

Probably 5.5 and 5.6 are affected, didn't check.

How to repeat:
Configure and build with -DWITH_EXAMPLE_STORAGE_ENGINE=1, then see

SHOW ENGINES;
Engine	Support	Comment	Transactions	XA	Savepoints
FEDERATED	NO	Federated MySQL storage engine	NULL	NULL	NULL
CSV	YES	CSV storage engine	NO	NO	NO
MEMORY	YES	Hash based, stored in memory, useful for temporary tables	NO	NO	NO
BLACKHOLE	YES	/dev/null storage engine (anything you write to it disappears)	NO	NO	NO
MRG_MYISAM	YES	Collection of identical MyISAM tables	NO	NO	NO
MyISAM	YES	MyISAM storage engine	NO	NO	NO
ARCHIVE	YES	Archive storage engine	NO	NO	NO
PERFORMANCE_SCHEMA	YES	Performance Schema	NO	NO	NO
InnoDB	DEFAULT	Supports transactions, row-level locking, and foreign keys	YES	YES	YES

Remove MODULE_ONLY from EXAMPLE's MYSQL_ADD_PLUGIN, reconfigure/rebuild, and it appears:
SHOW ENGINES;
Engine	Support	Comment	Transactions	XA	Savepoints
EXAMPLE	YES	Example storage engine	NO	YES	NO
...

Suggested fix:
=== modified file 'storage/example/CMakeLists.txt'
--- storage/example/CMakeLists.txt	2011-09-07 10:08:09 +0000
+++ storage/example/CMakeLists.txt	2013-11-08 09:26:59 +0000
@@ -15,4 +15,4 @@
 
 SET(EXAMPLE_PLUGIN_DYNAMIC "ha_example")
 SET(EXAMPLE_SOURCES ha_example.cc)
-MYSQL_ADD_PLUGIN(example ${EXAMPLE_SOURCES} STORAGE_ENGINE MODULE_ONLY)
+MYSQL_ADD_PLUGIN(example ${EXAMPLE_SOURCES} STORAGE_ENGINE)
[11 Nov 2013 6:01] Umesh Shastry
Hello Laurynas,

Thank you for the bug report.
Verified as described(5.6.14, 5.7).

Thanks,
Umesh
[27 Feb 2014 15:13] Paul Dubois
Noted in 5.7.4 changelog.

The -DWITH_EXAMPLE_STORAGE_ENGINE=1 CMake option was ignored but
should not have been. If -DWITH_EXAMPLE_STORAGE_ENGINE=0 is given,
the EXAMPLE storage engine is built as a plugin.