Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

grep detects binary data in dump and does not output any data #19

Open
Phone911 opened this issue Nov 12, 2022 · 3 comments
Open

grep detects binary data in dump and does not output any data #19

Phone911 opened this issue Nov 12, 2022 · 3 comments

Comments

@Phone911
Copy link

if there is any binary data detected in the mysqldump output, the grep command that searches for databases and tables will not output any data. On RedHat Linux system you can add the "-a" option to grep to treat the data as text and then the script will work normally.

@Phone911
Copy link
Author

Note that the binary data is from a header line added by mysql-zrm. It would be nice to have an option to remove this header line in the script without having to extract the backup and re-save the file.

kedarvj added a commit that referenced this issue Nov 13, 2022
Updated grep to include "-a" option as per issue #19
@kedarvj
Copy link
Owner

kedarvj commented Nov 13, 2022

Hi Gary @Phone911 ,
I added the -a as per your suggestion. I am not sure about binary data added in the header by mysql-zrm; would you be able to submit a PR for this and/or submit with sample data to test?
Thank

@Phone911
Copy link
Author

The dump may be more complex than the splitter program will support. The first part of the backup contains the dump of the databases and tables, then after that is done for all databases, it then contains a dump of all views. You end up with a primary "Current Database: DBNAME" section; then at the end you have a second "Current Database: DBNAME" section for views and possible other non-table content. Hopefully the following sanitized edit of a real mysql-zrm dump output will illustrate the problem(s).

I ran: "zcat db.sql.gz | tail -n +2 | grep -n '^-- ' >dump.example" to see all the dump sections. This resulted in (simulated) output like:
LINENO: DUMP SECTON COMMENT
2:-- Host: dbhost.example.com Database:
3:-- ------------------------------------------------------
4:-- Server version 8.0.26
20:-- Current Database: DB_ONE
28:-- Table structure for table TABLE_ONE
45:-- Dumping data for table TABLE_ONE
1729:-- Dumping events for database 'DB_ONE'
1733:-- Dumping routines for database 'DB_ONE'
3480:-- Current Database: DB_TWO
3488:-- Table structure for table TABLE_TWO_A
3506:-- Dumping data for table TABLE_TWO_A
3555:-- Temporary view structure for view VIEW_TWO_A_V
3570:-- Temporary view structure for view VIEW_TWO_B_V
3488:-- Table structure for table TABLE_TWO_B
3506:-- Dumping data for table TABLE_TWO_B
3570:-- Temporary view structure for view VIEW_TWO_C_V
11355:-- Dumping events for database 'DB_TWO'
11359:-- Dumping routines for database 'DB_TWO'
11512:-- Current Database: mysql
11520:-- Table structure for table columns_priv
11539:-- Dumping data for table columns_priv
11548:-- Table structure for table component
11563:-- Dumping data for table component
... (skipping lots of mysql DB tables)
12481:-- Dumping events for database 'mysql'
12485:-- Dumping routines for database 'mysql'
12489:-- Table structure for table general_log
12505:-- Table structure for table slow_log
12533:-- Current Database: DB_ONE
12539:-- Current Database: DB_TWO
12545:-- Final view structure for view VIEW_TWO_A_V
12545:-- Final view structure for view VIEW_TWO_B_V
12545:-- Final view structure for view VIEW_TWO_C_V
12641:-- Current Database: mysql
12656:-- Dump completed on 2022-09-16 23:30:06

The way splitter is structured and the way this dump is structured all the databases will be processed twice and the second half will not be included in the individual dump files.

I would understand if you just close this issue without a solution at this time for mysql-zrm mysqldumps.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants