The EXAMPLE storage engine

The Example storage engine is meant to serve mainly as a code example of the stub of a storage engine for example purposes only (or so the code comment at the start of ha_example.cc reads). In reality however, it’s not very useful. It likely was back in 2004 when it could be used as a starting point for starting some simple new engines (my guess would be that more than a few of the simpler engines started from ha_example.cc).

The sad reality is the complexity of the non-obviousness of the bits o the storage engine API you actually care about are documented in ha_ndbcluster.cc, ha_myisam.cc and ha_innodb.cc. If you’re doing something that isn’t already done by one of those three engines: good luck.

Whenever I looked at ha_example.cc I always wished there was something more behind it… basically hoping that InnoDB would get a better and cleaner API with the server and would use that rather than the layering violations it has to do the interesting stuff.

That all being said, as a starting point, it probably helped spawn at least a dozen storage engines.

9 thoughts on “The EXAMPLE storage engine

  1. csv (tina engine) shows a bit more in practical terms, although it’s pretty hacky.

    But I do agree, for serious stuff you need to look at the code of some of the “bigger” engines.

  2. Perhaps ha_tokudb.cc will join ha_ndbcluster.cc, ha_myisam.cc, and ha_innodb.cc now as a useful source of information on SE API.

Leave a Reply