Description:
The functionality needed explained via example:
-----------------------------------------------
Let's assume we have a test x.test which is unable
to perform a perfect cleanup around system tables
(*) or to clean all server caches (**).
Than any succeeding test my suffer from this.
A server shutdown/start would clean the caches
and a replacement of all data between shutdown and
restart with the initial stuff would reset the system
table content.
= This is basically the same which we get now
if the preceding test failed.
I propose a option with a name similar to
"--force-restore-after" which could be placed
in *.opt files.
after -> after the run of the tests where the "opt"
file belongs to before the next test starts
restore -> restore initial state for all data
restore data implies to stop the server
before restore operation and to start
afterwards
(*) Assume the x.test adds an object relevant for
system tables, runs some subtests and removes/
deletes the object afterwards.
If the object gets an id integer auto_increment
than the system table has after this test a modified
- definition (SHOW CREATE TABLE for example executed
by "--check-testcases")
Example diff:
-) ENGINE=MyISAM AUTO_INCREMENT=6 DEFAULT CHARSET=utf8 COMMENT='Time zones';
+) ENGINE=MyISAM AUTO_INCREMENT=7 DEFAULT CHARSET=utf8 COMMENT='Time zones';
- behavior
The next object added gets the id 7 whereas without
this test it would get id 6.
In the moment I am able to avoid this by
a) (tested) ALTER TABLE ... AUTO_INCREMENT=6 or
b) (not tested):
Make a perfect copy of the system table at the beginning
of the test. DROP original table + RENAME copy table
to original table at end of test.
IMHO both solutions are not really satisfying because
there is a high probability that future improvements
of the server around system tables/data dictionary
will disallow such operations.
(**) Names of time zones are cached and they cannot be reused
in succeeding tests because this cache cannot be cleared.
Please see also
Bug#39979 main.events_time_zone does not clean up
Magnus mentioned to me:
yepp, we need it for "init_file.test" as well
Another reason why this feature might be useful:
Assume a test which runs a lot statements, makes
a lot modifications within tables. This will lead
to huge logs which might be a pain in case these
logs are within a tmpfs. Of course the test could
truncate some of these logs at its end, but I assume
we have/will have some logs where this is not doable
if the server is not shut down.
Transaction Redo/Undo logs of storage engines?
How to repeat:
Please have a look at
Bug#39979 main.events_time_zone does not clean up
or reset your source tree before the push of the fix
for Bug#39979 and run
./mysql-test-run.pl events_time_zone events_time_zone