Skip to content
This repository has been archived by the owner on May 9, 2023. It is now read-only.

Feature Request - Can we TAG our backups? #163

Closed
Komport opened this issue Nov 3, 2017 · 11 comments
Closed

Feature Request - Can we TAG our backups? #163

Komport opened this issue Nov 3, 2017 · 11 comments

Comments

@Komport
Copy link
Contributor

Komport commented Nov 3, 2017

Is it possible to add optional feature to TAG our backups. Say if I have 10 inc backups, each taken after some specific action, so It will be very handy if i can add tag to each of them or some of them (critical ones).
Like below

[root@server1 MySQL-AutoXtraBackup]# autoxtrabackup --backup --TAG "Before Testdb - test table - test column drop"
@ShahriyarR
Copy link
Owner

Hi, it is possible of course.
But how this tag will be stored?

@Komport
Copy link
Contributor Author

Komport commented Nov 3, 2017

For example you can keep as txt file in each backupdir.

@ShahriyarR
Copy link
Owner

Or we can keep 1 file inside backup_dir named as backup_tags.txt and append there each time we are doing the backup.

@ShahriyarR
Copy link
Owner

So I am going to implement this in with following steps:

  • The new --tag option can be added to add new entries for each backup.
  • --show_tags options can be added to show those tags.
  • --show_tags must be used only with --defaults_file to get the backup_dir path and other things from config.
  • --show_tags should raise an exception if backup_tags.txt missing from backup_dir.

Please feel free to add some more things here.

@Komport
Copy link
Contributor Author

Komport commented Nov 3, 2017

With one file it will be more job to do i think. What I feel is to place in each folder txt file with its tag. And it should be optional. Users do not like exceptions in tools, especially DB admins, especially in backup and restore tools :)

@ShahriyarR
Copy link
Owner

:) Well, thats means you have not used --tag option before and now you want to show tags?

Let's describe a situation where you have 1 full + 12 incremental backups:

  • For storing tags in each folder we need 13 backup_tags.txt + each time for showing tags we should recursively go through all backup folders open those files, reading appending to empty list then show in the output.
  • Another thing if somebody just wants to send this backup_tags.txt to somewhere? or for statistics? or just showing to boss? He needs to open those 13 files manually combine them or running --show_tags and redirecting the output to another file, which is more tedious.

Does it make sense now?

@Komport
Copy link
Contributor Author

Komport commented Nov 3, 2017

You knows better muallim ;)

ShahriyarR added a commit that referenced this issue Nov 7, 2017
@ShahriyarR
Copy link
Owner

ShahriyarR commented Nov 7, 2017

@Komport
I have added the status column as well.
The result of PyTest run(not from cli):

$ cat backup_tags.txt
2017-11-07_16-17-58     Full    'My first full backup'  OK
2017-11-07_16-27-26     Inc     'My first inc backup'   OK
2017-11-07_16-28-37     Inc     'My second inc backup'  OK

@ShahriyarR
Copy link
Owner

From autoxtrabackup tool:

$ autoxtrabackup -v -lf /home/shahriyar.rzaev/autoxtrabackup2.log -l DEBUG --defaults_file=/home/shahriyar.rzaev/XB_TEST/server_dir/xb_2_3_ps_5_6.conf --backup --tag="This the full backup"

The result:

[shahriyar.rzaev@qaserver-02 ps_5_6_x_2_3]$ cat backup_tags.txt 
2017-11-07_16-42-42     Full    'This the full backup'  OK

Also debug message was added:

171107 16:44:23 completed OK!
2017-11-07 16:44:23 DEBUG    Adding backup tags

Second run for incremental backups:

$ autoxtrabackup -v -lf /home/shahriyar.rzaev/autoxtrabackup2.log -l DEBUG --defaults_file=/home/shahriyar.rzaev/XB_TEST/server_dir/xb_2_3_ps_5_6.conf --backup --tag="This the INC backup"

The result:

$ cat backup_tags.txt 
2017-11-07_16-42-42     Full    'This the full backup'  OK
2017-11-07_16-44-15     Inc     'This the INC backup'   OK

@ShahriyarR
Copy link
Owner

@Komport
Also I have decided not to put column names into backup_tags.txt file.
Instead of this I will print it with --show_tags option.

What do you think about this?

@ShahriyarR
Copy link
Owner

Changed the output a bit:

$ cat backup_tags.txt
2017-11-07_16-57-38     Full    OK      'This the Full backup'
2017-11-07_16-58-08     Inc     OK      'This INC backup'

ShahriyarR pushed a commit that referenced this issue Nov 7, 2017
* Preliminary fix for issue #163

* TypeError: add_tag() missing 1 required positional argument: 'tag_string'

* Changed the type column

* changed the open mode

* Changed full_backup() and added pytest test

* Changed inc_backup() and added pytest test

* prepared test_inc_backup() test

* Added the tag passing facilities to autoxtrabackup

* Changed the sequence of input for backup_tags.txt

* Removing quotes for status value
ShahriyarR pushed a commit that referenced this issue Nov 16, 2017
* Bugfix issue144 (#146)

* Preliminary fix for issue #144

* Fixing option passing

* Opening the config file in w+ mode

* [ERROR] --gtid-mode=ON or UPGRADE_STEP_1 or UPGRADE_STEP_2 requires --log-bin and --log-slave-updates

* Preliminary fix for issue #144

* Added slave_count option to config generator

* Changd start_mysql_func() to accept start tool as well

* First test run

* TypeError: prepare_start_slave_options() missing 2 required positional arguments: 'basedir' and 'slave_number'

* TypeError: prepare_start_slave_options() missing 1 required positional argument: 'slave_number'

* [ERROR] The socket file path is too long (> 107): /home/shahriyar.rzaev/XB_TEST/server_dir/PS231017-percona-server-5.6.37-82.2-linux-x86_64-debug/node0/slave_socket.sock

* Now trying to fix slave start up problem

* Added few tests and also pt-table-checksum run

* Added assert statement

* Trying to make started server to be slave

* Added unit test test_run_change_master()

* Added returns to method

* Trying to fix sql error

* Trying to fix sql error again

* Trying to escape characters

* Escaping some characters here also

* Checking again for failed thing

* Passing master port for slave's change master statement

* Fixed port checking call

* Found the value of port

* Passing port number to change master statement

* Trying to pass proper create statement

* Passed true values for master server

* Fix the string

* Successfully made the started node as slave

* Added run for pt-table-checksum tool on master

* Trying to run pt-table-checksum on master server

* TypeError: 'int' object is not iterable

* Fixing some dependent tasks

* Passing start slave command to slave server

* Trying to fix this weird situation on returning True from method

* Check if prepare methods also returning something

* returning True from functions

* Changed the structure of run_change_master()

* Raising RuntimeError here

* Added new check_slave_output() static method

* Fixing open issue for stop_node{} file

* Added sleep(10)

* Fixing small things

* Giving some sleep(10)

* Added new debug message

* Added few mor fixes here

* Added drop_blank_mysql_users() static method

* Trying to fix failed test

* Again trying to fix failed test sql syntax error

* Next attempt

* next attempt n2

* seems to be final attempt

* Finalized dropping blank users

* Added final docstrings and other checks

* Changed binlog_format to row

* Added get_gtid_address() static method

* Running gtid_purged

* RuntimeError: Failed to run SQL command -> ERROR 1193 (HY000) at line 1: Unknown system variable 'gitd_purged'

* Increased the sleep time

* Added pytest for check_slave_status()

* Could find the fail reason. it was due to not using lstrip()

* Changed assert to check against None

* Added new tests and create_dsns_table()

* Creating table

* Added pytest test_populate_dsns_table()

* Fix for failed mysql client command

* for the right syntax to use near 's=/home/shahriyar.rzaev/XB_TEST/server_dir/PS231017-percona-server-5.6.37-82.2-l' at line 1

* Another sql syntax error

* Adding some fix for sql syntax

* Again trying to fix sql syntax issue

* Added --recursion-method

* Added pytest test_run_pt_table_checksum()

* Using localhost instead of ip

* removed p=

* Passing slave port

* changed to 127.0.0.1

* Finalizing the #144 implementation

* Bugfix issue147 (#148)

* Adding log file support

* Adding handlers.RotateFileHandler usage

* Bugfix issue150 (#153)

* Preliminary fix for issue #150 changed CheckEnv class

* Pushing some other changes now.

* Added much more things here

* Finalizing the issue #150

* Preliminary fix for issue #152 (#155)

* Preliminary fix for issue #151 (#156)

* Bugfix issue157 (#159)

* Preliminary fix for issue #157

* Added shutdown call for slave

* Bugfix issue158 (#161)

* Preliminary fix for issue #158

* Trying to fix, failed check

* Finalized the fix for issue #158

* Using try/except to catch exceptions

* Removed redundant logger.error messages

* Printing the RuntimError name

* Bugfix issue162 (#165)

* Preliminary fix for issue #162

* Checking failed thing

* Commenting for test purposes

* removed comments

* Commenting the function

* Uncommented

* Checking something here

* Passing ctx

* Trying to figure out something

* Removed help and version

* Added few other things

* Printed message

* Calling click.help_option()

* Ugly way of implementing --help

* reverted the changes

* Added print_help() wrapper

* Changed print_help

* Added some code

* Now it must be fixed

* changed a bit

* Eliminated options with default values

* using show_default inside option

* Changing some options

* Finalizing the issue fix

* Bugfix issue166 (#167)

* Preliminary fix for issue #166

* changed setup.py

* Added file name

* Changed back

* Changed a bit

* Changed to print() statement

* Using sys.exit()

* Bugfix issue168 (#169)

* Preliminary fix for issue #168

* The fix for partial.py file

* Fixing partial.py issue

* preliminary fix for issue #170 (#173)

* Bugfix issue163 (#174)

* Preliminary fix for issue #163

* TypeError: add_tag() missing 1 required positional argument: 'tag_string'

* Changed the type column

* changed the open mode

* Changed full_backup() and added pytest test

* Changed inc_backup() and added pytest test

* prepared test_inc_backup() test

* Added the tag passing facilities to autoxtrabackup

* Changed the sequence of input for backup_tags.txt

* Removing quotes for status value

* Bugfix issue164 (#175)

* Preliminary fix for issue #164

* Calling from CLI

* Trying to print the output in a good way

* Adding some extra strings

* Trying to fix something

* Hard coding the output

* Adding error message if there is no backup_tags.txt

* Changed the print message a bit

* Bugfix issue171 (#178)

* Preliminary fix for issue #171

* passing basedir path

* Failed with PS 5.6

* Added run_sql_stetement()

* Passing correct SQL

* Trying to figure out the fail reason

* passing --keyring-file-data to xtrabackup

* Added flush tables statement

* Added sleep statement here

* Bugfix issue172 (#180)

* Preliminary fix for issue #172

* Get the output for SQL

* Adding optimize table running

* Disabling the compression support due to bug 1641745

* Bugfix issue176 (#181)

* Preliminary fix for issue #176

* Passing tag to Prepare class from autoxtrabackup

* Fix for issue related to iteration

* Preliminary fix for issue #182 (#183)

* Bugfix issue185 (#186)

* Preliminary fix for issue #185

* Finalizing the fix

* Bugfix issue188 (#189)

* Preliminary fix for issue #188

* Again updating VagrantFile

* Introducing huge changes

* Committing some few changes as well

* decreasing the --parallel=10 to 1 for PS 5.7

* Committing few other changes

* Committing another change

* Fixing config generation

* Fixing path name

* Trying to finalize bug fix for issue #188

* changing to vagrant:vagrant

* Fixing small issue

* Fixing failed sql statement

* Now finished for sure :)

* Added another sleep(5)

* Increased random number range

* Finalized, can be merged to release_v_1.5.0

* Bugfix issue190 (#191)

* Preliminary fix for issue #190

* Fixing missing thing

* Disabling this features

* Preliminary fix for issue #149 (#160)

* Preliminary fix for issue #149

* Final review for v1.5.0 release

* Version bump
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants