[vz-users] DBCopy Fortschrittsanzeige
Andreas Goetz
cpuidle at gmail.com
Fri Aug 19 10:49:47 CEST 2016
Ungetestet, aber kannst Du mal bitte in BackupCommand->copyTable() die
Reihenfolge am Anfang der Funktion so umdrehen:
protected function copyTable($table, $keyColumn = false) {
$columns = join(array_map(function($column) {
return $this->sc->quoteIdentifier($column->getName());
}, $table->getColumns()), ',');
$sqlParameters = array();
$maxKey = null;
// set selection range
if ($keyColumn) {
$sqlMax = 'SELECT MAX(' .
$this->tc->quoteIdentifier($keyColumn) . ') ' .
'FROM ' .
$this->tc->quoteIdentifier($table->getName());
$maxKey = $this->tc->fetchColumn($sqlMax);
if (isset($maxKey))
$sqlParameters[] = $maxKey;
}
else {
// clear target table
$this->truncateTable($this->tc, $table);
}
echo($table->getName() . ": copying ");
// count selection range
$sqlCount = 'SELECT COUNT(1) FROM (' .
$this->sc->quoteIdentifier($table->getName()) . ')';
if ($keyColumn && isset($maxKey)) {
$sqlCount .= ' WHERE ' . $this->sc->quoteIdentifier($keyColumn)
. ' > ?';
}
$totalRows = $this->sc->fetchColumn($sqlCount, $sqlParameters);
echo($totalRows . " rows (" . (($keyColumn) ? 'partial copy' :
'overwrite') . ")\n");
Viele Grüße,
Andreas
2016-08-19 9:21 GMT+02:00 Sirko <mail_ist at nurfuerspam.de>:
> Hi Andreas,
>
> ich hab gestern mal den Volkszähler und Composer usw. aktualisiert, incl.
> DBCopy. (Laut git pull alles up-to-date)
> Seit dem geht die Fortschrittsanzeige nicht mehr richtig, obwohl die
> Datensätze offenbar korrekt übertragen werden.
>
> *Vorher:*
> Start DBCopy...
> entities: copying 24 rows (overwrite)
> [>---------------------------] 0% 1 sec/1 sec 0 rows
> [============================] 100% 1 sec/1 sec 24 rows
>
> properties: copying 185 rows (overwrite)
> [>---------------------------] 0% 1 sec/1 sec 0 rows
> [============================] 100% 1 sec/1 sec 185 rows
>
> entities_in_aggregator: copying 4 rows (overwrite)
> [>---------------------------] 0% 1 sec/1 sec 0 rowsPHP
> Warning: Division by zero in /var/www/volkszaehler.org/
> vendor/symfony/console/Symfony/Component/Console/Helper/ProgressBar.php
> on line 400
> PHP Warning: Division by zero in /var/www/volkszaehler.org/
> vendor/symfony/console/Symfony/Component/Console/Helper/ProgressBar.php
> on line 401
>
> [============================] 100% 1 sec/1 sec 4 rows
>
> data: *copying 14006 rows *(partial copy)
> [>---------------------------] 0% 1 sec/1 sec 0 rows
> [=>--------------------------] 4% 2 secs/40 secs 700 rows
> [==>-------------------------] 9% 5 secs/50 secs 1400 rows
> [====>-----------------------] 14% 7 secs/47 secs 2100 rows
> [=====>----------------------] 19% 9 secs/45 secs 2800 rows
> [======>---------------------] 24% 11 secs/44 secs 3500 rows
> [========>-------------------] 29% 13 secs/43 secs 4200 rows
> [=========>------------------] 34% 15 secs/43 secs 4900 rows
> [===========>----------------] 39% 17 secs/43 secs 5600 rows
> [============>---------------] 44% 19 secs/42 secs 6300 rows
> [=============>--------------] 49% 21 secs/42 secs 7000 rows
> [===============>------------] 54% 23 secs/42 secs 7700 rows
> [================>-----------] 59% 25 secs/42 secs 8400 rows
> [==================>---------] 64% 27 secs/42 secs 9100 rows
> [===================>--------] 69% 29 secs/41 secs 9800 rows
> [====================>-------] 74% 31 secs/41 secs 10500 rows
> [======================>-----] 79% 34 secs/43 secs 11200 rows
> [=======================>----] 84% 36 secs/42 secs 11900 rows
> [=========================>--] 89% 38 secs/42 secs 12600 rows
> [==========================>-] 94% 40 secs/42 secs 13300 rows
> [===========================>] 99% 42 secs/42 secs 14000 rows
> [============================] 100% 42 secs/42 secs 14006 rows
> [============================] 100% 42 secs/42 secs 14007 rows
> [============================] 100% 42 secs/42 secs 14008 rows
> [============================] 100% 42 secs/42 secs 14009 rows
> [============================] 100% 42 secs/42 secs 14010 rows
> [============================] 100% 42 secs/42 secs 14011 rows
> [============================] 100% 42 secs/42 secs 14012 rows
> [============================] 100% 42 secs/42 secs 14013 rows
>
> aggregate: skipping
> ...
>
> *Jetzt:*
> Start DBCopy...
> entities: copying 24 rows (overwrite)
> [>---------------------------] 0% < 1 sec/< 1 sec 0 rows
> [============================] 100% < 1 sec/< 1 sec 24 rows
>
> properties: copying 185 rows (overwrite)
> [>---------------------------] 0% < 1 sec/< 1 sec 0 rows
> [============================] 100% < 1 sec/< 1 sec 185 rows
>
> entities_in_aggregator: copying 4 rows (overwrite)
> [>---------------------------] 0% < 1 sec/< 1 sec 0 rows
> [============================] 100% < 1 sec/< 1 sec 4 rows
>
> data: *copying 16153996 rows* (partial copy)
> [>---------------------------] 0% < 1 sec/< 1 sec 0 rows
> [============================] *100% < 1 sec/< 1 sec 16153996 rows*
>
> aggregate: skipping
>
> Das DBCopy tut so, als wöllte es 16 Mio Zeilen kopieren, kopiert aber
> wirklich nur die fehlenden Zeilen in wie üblich ein paar Sekunden.
> Am Ende scheint es zu funktionieren, hat mich nur erschreckt ;-)
>
> Grüße
> Sirko
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://demo.volkszaehler.org/pipermail/volkszaehler-users/attachments/20160819/a7aaece9/attachment.html>
More information about the volkszaehler-users
mailing list