Tuesday 14 January 2014

MAXTEMPL: a maximal template of a storage engine

I like to present another storage engine which I called MaxTemplate, a maximal template for a storage engine. You will find the source-code of MaxTemplate here.

This engine is similar to MinTemplate, and you will find the article about MinTemplate in the archive of this blog.

When you look into the source-code of MaxTemplate you will see that there is a lot more of code in this engine then in MinTemplate. Every function in the base class MyIsam is found in MinTemplate; this explains the amount of code. I will give a reason for this later.

And also we will encounter differences when compiling the code in the two environments: my code compiled unchanged on MySQL (version 5.5.8) and did require some modifications for MariaDB (10.0.4). Some functions have been removed, others are private now, some have different parameters - normal modifications when software develops. For handling the difference between MySQL and MariaDB I needed a define, which exists in MariaDB but not in MySQL (or vice versa),  so I can use this define to handle the different parts of the code. If you look into the code please look for MARIADB_BASE_VERSION.

I did some tests to demonstrate that this engine works. You will find them in the file Skripte/Tests.log in the tar.gz-file. I only included the tests for MariaDB, I did the same tests with MySQL and I hope you will trust me when I write that this code did work in this environment too.

In the end this engine is identical to MyIsam - as you can see when you do your own tests. But this engine needs more time for the same work then MyIsam because it produces a lot of output in the console of Eclipse.

what is it good for?

Do not use this engine in a production-environment! The purpose of this engine is to monitor the activities of a storage engine, e.g.
  • which function is called 
  • the order functions are called
  • what are the parameters on entering a function 
  • what are the return-values 
In Eclipse you can set a breakpoint on a function of interest to you and inspect everything. You can even modify the code of a function by duplicating this code and play with it, all without touching the original MyIsam-code.

And that's what I used it for.

Corrections

During my tests I found that I needed a define in the code:
 #define MYSQL_SERVER 1
Please excuse, but you have to add it to dummy.tar.gz and MinTemplate.tar.gz; It's already included in the source-code in MaxTemplate.tar.gz.