[MDEV-25988] No feedback on errors from mariadb-dump Created: 2021-06-22  Updated: 2021-06-22

Status: Open
Project: MariaDB Server
Component/s: Scripts & Clients
Affects Version/s: None
Fix Version/s: None

Type: Bug Priority: Major
Reporter: Gabriel PREDA Assignee: Unassigned
Resolution: Unresolved Votes: 0
Labels: Compatibility


 Description   

When dumping from a very old server (in my case 5.1.x) the program exits with correct status code 2 but now textual error:

$ mariadb-dump -hold-mysql.example.com -uuser -p --routines --triggers --events the_db > the_db.sql
Enter password: 
$ echo $?
2

But when using with a non-existent option:

$ mariadb-dump -hold-mysql.example.com -uuser -p --routines --triggers --some-unknown-option --events the_db > the_db.sql
Enter password: 
mariadb-dump: unknown option '--some-unknown-option'
$ echo $?
2

The sql file only contains:

-- MariaDB dump 10.19  Distrib 10.5.10-MariaDB, for Linux (x86_64)
--
-- Host: old-mysql.example.com    Database: the_db
-- ------------------------------------------------------
-- Server version	5.1.63-rel13.4-log
 
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8mb4 */;
/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */;
/*!40103 SET TIME_ZONE='+00:00' */;
/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;

Looking w/ `strace` I found out the problem:

sendto(3, ".\0\0\0\3SET SESSION character_set_results = 'utf8mb4'", 50, MSG_DONTWAIT|MSG_NOSIGNAL, NULL, 0) = 50
recvfrom(3, 0x55623eff1680, 16384, MSG_DONTWAIT, NULL, NULL) = -1 EAGAIN (Resource temporarily unavailable)
poll([{fd=3, events=POLLIN}], 1, -1)    = 1 ([{fd=3, revents=POLLIN}])
recvfrom(3, ")\0\0\1\377[\4#42000Unknown character set: 'utf8mb4'", 16384, MSG_DONTWAIT, NULL, NULL) = 45

So because the server doesn't know `utf8mb4` the program exits w/ an error.
It should use the charsets available on the server.

Either:

  • fix by trying more that one charset from a list provided by the server or
  • show a textual error or
  • both.


 Comments   
Comment by Gabriel PREDA [ 2021-06-22 ]

Also:

  • skip-set-charset does not work - most probably it's silently ignored, same goes for --no-set-names, -N
  • set-charset does not work in my case either [ Warning: mysqldump: ignoring option '--set-charset' due to invalid value 'utf8' ]

The only way I made the dump to work was with:
--default-character-set=utf8

Generated at Thu Feb 08 09:41:55 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.