-
Notifications
You must be signed in to change notification settings - Fork 207
fix: Restore fails with bufio.Scanner: token too long when importing large dump files #486
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
Conversation
6008f71 to
9250cc1
Compare
|
I guess #469 was not totally fixed? What is the root cause? Looking at the code here, it looks to me like you just recreated what scanner does? So why does this work? |
|
The core issue lead to this bug is the const value of |
|
We can simply reproduce the issue by restore the database by below SQL. create database test_restore;
use test_restore;
create table test_large(
id int not null primary key,
content mediumtext null
);
insert into test_large values(1, REPEAT('A', 4194304)); Once restore the backup, the restore got error. $ ./mysql-backup restore db_backup_2025-11-17T02:27:02Z.tgz
INFO[0000] beginning restore run=e911423c-32d8-4196-b305-a1917a4bb172
Error: error restoring: failed to restore database: failed to restore database: bufio.Scanner: token too long
FATA[0035] error restoring: failed to restore database: failed to restore database: bufio.Scanner: token too long |
|
So something about |
|
Thanks for the reproduction use case; it is very helpful. |
|
Right. Scanner has a max size, which you can increase via s.Buffer(). Reader, on the other hand, does not appear to have such a limit, which is strange. Either way, I can see why what you did here makes sense. |
|
I think it needs a rebase. |
9250cc1 to
f60c182
Compare
|
rebase has done. |
|
Let CI do its magic. |
|
linting error |
|
I should remove the unused const field. I will commit a update. |
…large dump files Signed-off-by: chenen <itfunx@hotmail.com>
Signed-off-by: chenen <itfunx@hotmail.com>
6a1eb12 to
fd1bca4
Compare
bug fix for #469