andig / dbcopy

Configurable database backup tool for volkszaehler.org
http://volkszaehler.org
3 stars 4 forks source link

Problem using copy #6

Open ogbrugge opened 5 years ago

ogbrugge commented 5 years ago

Not sure if it is something i did but when i run dbcopy copy using an entry for table date like "data: copy" (not pk or anything else) and option batch, -b, is 1000 or so in order to copy the entire data table to another mariadb server instance, i only get like 1000 rows copied out of the currently 3.2 million rows. Even if i leave out the -b option i only get 1000 rows copied into the new database on a remote machine.

Looking at the code of andig/dbcopy/src/Command/CopyCommand.php (the most up to date one delievered with volkszaehler.org) it tells me that for MODE_COPY copyTable is called with false for keyColumn and thus the condition in while is always false and the loop is left after iterating only 1 time. I changed it locally to:

while ( ($this->batch * $loopOffsetIndex) < $totalRows);

and it is at least slowly iterating over the 3 million rows... For sure i should have used a different method of copying the database contents but i wanted to try it this way.

andig commented 5 years ago

Sounds like you‘ve found a bug. Would you mind opening a PR? Also, is there any reason why PK doesn‘t work for you?

ogbrugge commented 5 years ago

I only wanted one initial copy because i wanted to move the data from one db instance to another, no incremental data movement afterwards because this is how i interpreted what pk is used for. I should have tried if that worked but i found the problem with copy and wanted to know why it failed.

I opened an issue here, is that not the same as a bug report?

ogbrugge commented 5 years ago

Or did you mean pull request?

In that case i hesitate the send you a pull request because there is probably a valid reason for leaving the loop with keyColumn and i do not take this into account, just added a quick hack to make it work for me.

andig commented 5 years ago

Yes, I ment a pull rewuest containing your fix.

Viele Grüße, Andreas

Am 02.11.2019 um 10:33 schrieb ogbrugge notifications@github.com:

 Or did you mean pull request?

— You are receiving this because you commented. Reply to this email directly, view it on GitHub, or unsubscribe.