← Back to team overview

mylvmbackup-discuss team mailing list archive

Re: mylvmbackup -- handle flush table with read lock solution. script to share

 

Hi, Lenz
Thanks for your suggestion. I followed your instruction to 1. copy the current branch2. modify the mylvmbackup.pl.in and mylvmback.conf3. commit the changes and reload the brand as ~lxu8/mylvmbackup/mylvmbackup-ftwr
Other modification 1. all database command are in upper case
2. added the feature of check slave temp table when stop_replication option is 1    if stop_replication == 1        if wait_tmp_table_close ==1             child process will stop slave then check if slave has temp table open                if there are temp table open, child process will start slave wait 5 seconds and recheck                      after number of trials (tmp_table_trials), if slave still has temp table open, child process will exit with error                 if there is no temp table open, replication is stop success and move to next step (put FTWRL LOCK)
Since child process should abort for different kind of reason after successful stop replication, the parent will start replication if child process was exit with error.    if stop_replication ==0       wait_tmp_table_close and tmp_table_trials setting will be ignore.       child stop replication then move to next step               3. better formatted on content and style  (sorry, the previous script was rush, only focus on the function)
Let me know if there is question.
ThanksLinda


| #
[ftwrl] 

#ftwrl_mode: 0|1|2
# 0, run ftwrl first, check ftwrl session status, kill long run query which block ftwrl if any after ftwrl_trials  [backup priority]
# 1, run ftwrl first, check ftwrl session status, abort backup process if got block after ftwrl trials [application priority]
# 2, check long run query first, if exists, recheck. 
#    Abort backup script after wait period [old mode except backup script stop after given time] 
ftwrl_mode=2

#ftwrl_wait, wait n seconds between recheck ftwrl status
ftwrl_wait=10

#ftwrl_trials, n of times to check ftwrl status before action. 
ftwl_trials=6

#query_override, file name where find long run query stored. Default is no override
#if no override following where condition will be used to address long run query
#            where TIME>0 and  USER<>'system user' and STATE like '%ing%'
#             and INFO not in ('flush tables with read lock','flush tables')

query_overide='';

#stop_replication before take snapshot, 1 stop, 0 do not stop
stop_replication=1

#wait_tmp_table_close, wait tmp table close on slave when stop replication. 1 yes, 0 no
#    1: backup will wait slave temp table close before run snapshot or abort backup after tmp_table_trials

wait_tmp_table_close=1

#tmp_table_trials : n of times to check slave temp table before abort 
tmp_table_trials=20


 |

 
    

  From: Lenz Grimmer <lenz@xxxxxxxxxxx>
 To: mylvmbackup-discuss@xxxxxxxxxxxxxxxxxxx 
 Sent: Monday, September 21, 2015 12:48 AM
 Subject: Re: [Mylvmbackup-discuss] mylvmbackup -- handle flush table with read lock solution. script to share
   
Hi Linda,

again thank you for your contribution and sorry for the delay in responding.

On 09/15/2015 12:12 AM, Linda Xu wrote:

> I uploaded the changes to launchpad as
> "lp:~lxu8/mylvmbackup/mylvmbackup-0.16lx
> <https://code.launchpad.net/~lxu8/mylvmbackup/mylvmbackup-0.16lx>"
>
> Only the main script mylvmbackup is been changed. Please let me know if
> there is any question or other modification needed.

I finally found some time to review your changes. Unfortunately reviewing and
merging your changes is somewhat difficult, as the bzr tree does not seem to
be a full clone of the "trunk", but rather a single checkin of an extracted
source tarbell.

In order to preserve the commit history, and to ease the process of merging
your changes, would it be possible for you to amend your contribution as follows?

Please create a full branch off the trunk by using "bzr branch
lp:mylvmbackup". Then, apply your modifications on top of this tree, in file
mylvmbackup.pl.in (not the final mylvmbackup file).

Commit and push your modifications to a new branch on Launchpad, e.g. "bzr
push lp:~lxu8/mylvmbackup/mylvmbackup-ftwr". This would allow me to cleanly
merge your changes and maintain your commit messages.

The comments you added below the GPL header look somewhat truncated, some
sentences seem to be incomplete and end with "»" instead. So it is difficult
to fully understand the various modes.

A question about the $stop_replication option: enabling this option issues a
"STOP SLAVE SQL_THREAD" before the tables are locked. How would this affect
temporary tables? According to the documentation, there are some things you
have to consider in this case:

https://dev.mysql.com/doc/refman/5.6/en/replication-features-temptables.html

I also have a pending bug report about temporary tables, so I wonder if this
is related: https://bugs.launchpad.net/mylvmbackup/+bug/1217747

Can you please comment on this?

With regards to the new options you want to introduce: I find "flush_ftwrl_*"
somewhat long and redundant. How about removing the "flush_" prefix?

Instead of describing the options in the code, would you mind adding these,
including your complete comments to the mylvmbackup.conf file?

Some general comments: would you mind to adjust your indendations so they
match the rest of the code, which uses two spaces per indendation level?

Also another style question, could you please put SQL keywords in uppercase,
e.g. the ones you defined in $find_long_query_cnt and so on.

Thank you very much!



Lenz

-- 
  Lenz Grimmer <lenz@xxxxxxxxxxx> - http://www.lenzg.net/

_______________________________________________
Mailing list: https://launchpad.net/~mylvmbackup-discuss
Post to    : mylvmbackup-discuss@xxxxxxxxxxxxxxxxxxx
Unsubscribe : https://launchpad.net/~mylvmbackup-discuss
More help  : https://help.launchpad.net/ListHelp


   

  

Follow ups

References