[MDEV-16752] mysqldump: racing condition in STDERR+STDOUT output Created: 2018-07-13  Updated: 2021-02-28  Resolved: 2021-02-28

Status: Closed
Project: MariaDB Server
Component/s: Tests
Affects Version/s: 10.3.8
Fix Version/s: N/A

Type: Bug Priority: Minor
Reporter: Aleksey Midenkov Assignee: Unassigned
Resolution: Not a Bug Votes: 0
Labels: None

Issue Links:
Relates
relates to MDEV-16684 Wrong timestamps on restore from mysq... Closed

 Description   

There can be test failure when mysqldump is executed like this:

--exec $MYSQL_DUMP ... 2>&1

STDERR is joined to STDOUT while STDOUT buffer is in undetermined state.

Fix

Call fflush(md_result_file) before each fprintf(stderr, ...). Better ensure that md_result_file is STDOUT, otherwise flush is not needed.



 Comments   
Comment by Sergei Golubchik [ 2018-07-14 ]

I don't think mysqldump should flush stdout for the incorrect test to work. It's well known that running something with 2>&1 does not necessarily guarantee a stable order of rows in the output, so the test should not rely on it.

Comment by Elena Stepanova [ 2018-07-16 ]

midenok, did you actually encounter such MTR failures? Can you paste the output? It helps for avoiding duplicates.

Comment by Aleksey Midenkov [ 2021-02-28 ]

elenst No failures except local branches of the related bugs MDEV-16684 and MDEV-16029. But main.mysqldump-no-binlog still relies on 2>&1 so the race is still there.

main.mysqldump-no-binlog                 w1 [ fail ]
        Test ended at 2018-07-13 09:49:33
 
CURRENT_TEST: main.mysqldump-no-binlog
--- D:/win32-packages/build/src/mysql-test/main/mysqldump-no-binlog.result	2018-07-13 09:04:45.000000000 +0000
+++ D:\win32-packages\build\src\mysql-test\main\mysqldump-no-binlog.reject	2018-07-13 09:49:33.729316600 +0000
@@ -1,3 +1,3 @@
-mysqldump: Error: Binlogging on server not active
 /*!40103 SET @OLD_TIME_ZONE      = @@time_zone */ ;
 /*!40103 SET time_zone             = '+00:00' */ ;
+mysqldump: Error: Binlogging on server not active
 
mysqltest: Result content mismatch
 
 - saving 'D:/win32-packages/build/mysql-test/var/1/log/main.mysqldump-no-binlog/' to 'D:/win32-packages/build/mysql-test/var/log/main.mysqldump-no-binlog/'
 
Retrying test main.mysqldump-no-binlog, attempt(2/3)...

Generated at Thu Feb 08 08:31:17 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.