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

not converting event type when trying undelete #5

Open
n0099 opened this issue Oct 31, 2023 · 3 comments
Open

not converting event type when trying undelete #5

n0099 opened this issue Oct 31, 2023 · 3 comments

Comments

@n0099
Copy link

n0099 commented Oct 31, 2023

Run

sudo python2 ~/MyUndelete/MyUndelete.py -b binlog.000117 -s 148418658 -e 484776616

only gives me the following error in mysql error log:

[ERROR] [MY-010584] [Repl] Replica SQL: Could not execute Delete_rows event on table db.table; Can't find record in 'table', Error_code: 1032; handler error HA_ERR_KEY_NOT_FOUND; the event's source log FIRST, end_log_pos 148425162, Error_code: MY-001032

but it's able to replace the event type with the original awk script in http://thenoyes.com/littlenoise/?p=307:

BEGIN { regexp = "$^" }

/^BINLOG/ {
  print;
  getline;
  regexp = "^" substr($0, 1, 5) "[CSiy][ABCD]" substr($0, 8, 4);
}

$0 ~ regexp {
  n = $0;
  $0 = substr(n, 1, 5)
  $0 = $0 substr("BRhx", index("CSiy", substr(n, 6, 1)), 1)
  $0 = $0 substr("4567", index("ABCD", substr(n, 7, 1)), 1)
  $0 = $0 substr(n, 8) ;
}

{ print; }
sudo mysqlbinlog --start-position=148418658 --stop-position=484776616 binlog.000117 | awk -f undelete.awk | mysql
@n0099
Copy link
Author

n0099 commented Oct 31, 2023

and there's another warn by gawk KittyKatt/screenFetch#627 in the stdout of python2:

awk: cmd. line:1: warning: regexp escape sequence `\;' is not a known regexp operator

can be fix by change this line

c2 = ['awk', '/\/*!*\/\;/{flag=0}flag;/^BINLOG /{flag=1}']

to

- c2 = ['awk', '/\/*!*\/\;/{flag=0}flag;/^BINLOG /{flag=1}'] 
+ c2 = ['awk', '/\/*!*\/;/{flag=0}flag;/^BINLOG /{flag=1}'] 

@lefred
Copy link
Owner

lefred commented Oct 31, 2023

Hello this is a very old program that I didn't maintain.
I do have in mind something better to handle this, but not much time.

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