Bug #87934 test_services suite mishandling server error log
Submitted: 2 Oct 2017 6:08 Modified: 13 Jun 2018 13:07
Reporter: Laurynas Biveinis (OCA) Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: Tests Severity:S3 (Non-critical)
Version:8.0.3, 8.0.4 OS:Any
Assigned to: CPU Architecture:Any

[2 Oct 2017 6:08] Laurynas Biveinis
Description:
test_services, test_services_threaded, test_services_plugin_registry perform some actions, then check the server error log for their output. This is done with the commonly seen MTR antipattern of using the default mysqld.1.err, at least without its truncation. This is wrong for the usual reasons: MTR --repeat is broken, the test depends on the previous tests in the same run, enabling both false positives and false negatives.

In this case LOAD DATA LOCAL INFILE is used with FIELDS TERMINATED BY ' [', which is not always able to handle the output of all the previous tests in the server error log.

How to repeat:
For example,

$ ./mtr --debug-server test_services --repeat=2
...
test_services.test_services              [ pass ]    224
test_services.test_services              [ fail ]
        Test ended at 2017-10-02 09:04:54

CURRENT_TEST: test_services.test_services
--- /home/laurynas/mysql-8.0.3/mysql-test/suite/test_services/r/test_services.result	2017-09-19 13:22:09.000000000 +0300
+++ /home/laurynas/obj-mysql-8.0.3-san-debug/mysql-test/var/log/test_services.reject	2017-10-02 09:04:54.654009855 +0300
@@ -37,4 +37,9 @@
 Note] Plugin test_services reported: 'This is the test plugin for services testing info report output'
 Warning] Plugin test_services reported: 'This is a warning from test plugin for services testing warning report output'
 ERROR] Plugin test_services reported: 'This is an error from test plugin for services testing error report output'
+Note] Plugin test_services reported: 'Test_services with_snprintf_val: 1'
+Note] Plugin test_services reported: 'Test_services with_log_message_val: 1'
+Note] Plugin test_services reported: 'This is the test plugin for services testing info report output'
+Warning] Plugin test_services reported: 'This is a warning from test plugin for services testing warning report output'
+ERROR] Plugin test_services reported: 'This is an error from test plugin for services testing error report output'
 DROP TABLE IF EXISTS t1;

mysqltest: Result length mismatch

As for the FIELDS TERMINATED BY ' [':

170922 19:39:26 +29.391 [ 40%] test_services.test_services_threaded     [ fail ]
        Test ended at 2017-09-22 19:39:26

CURRENT_TEST: test_services.test_services_threaded
mysqltest: At line 33: query 'LOAD DATA LOCAL INFILE '$MYSQLTEST_VARDIR/log/mysqld.1.err' INTO TABLE t1 
FIELDS TERMINATED BY ' ['' failed: 1300: Invalid utf8mb4 character string: 'Note] InnoDB: keynr=1, ''

Suggested fix:
Restart the server with the custom error log path, analyze that. Then keeping FIELDS TERMINATED BY ' [' could be acceptable too.
[2 Oct 2017 6:49] MySQL Verification Team
Hello Laurynas,

Thank you for the report.

Thanks,
Umesh
[1 Feb 2018 8:40] Laurynas Biveinis
Still an issue with 8.0.4.
[13 Jun 2018 13:07] Paul DuBois
Posted by developer:
 
Fixed in 8.0.13.

Work was done for test suite. No changelog entry needed.
[24 Jul 2018 11:00] Erlend Dahl
Note: there is a follow-up patch in 8.0.13:

Bug#28391977 TEST_SERVICES TESTS: DO NOT REMOVE MYSQLD.1.ERR