View Issue Details

IDProjectCategoryView StatusLast Update
0013504Tine 2.0Setuppublic2017-11-16 14:59
ReporterestradisAssigned Topschuele 
PrioritynormalSeverityblockReproducibilityalways
Status resolvedResolutionfixed 
PlatformVMware Virtual MachineOSUbuntu LinuxOS Version16.04 LTS
Product Version 
Target Version2017.11.1 Caroline Business EditionFixed in Version2017.11.1 Caroline Business Edition 
Summary0013504: setup.php --restore -- db=1 bails out and leave database unusable
DescriptionWhile trying to restore database from last backup, i found following problem:

When an error occours during table creation after it was deleted in first, setup.php bails out and leaves database unusable.

I my case the statements

DROP TABLE IF EXISTS `tine20_addressbook`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `tine20_addressbook` (
[...]
  CONSTRAINT `tine20_addressbook::container_id--container::id` FOREIGN KEY (`container_id`) REFERENCES `tine20_container` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;

will cause the error. At this point the database seems not to be able to reference the constraint and therefore the execution fails.

Maybe the better solution will be to create the table without constraint in first and alter it afterwards to set the constraint.

- or -

- Delete constraints
- Rename table
- create new table
- Create constraints
Additional InformationFlow:

root@tine:~# /usr/bin/php /usr/share/tine20/setup.php --restore -- db=1 backupDir=/tmp/tine-20170929-120600/
ERROR 1215 (HY000) at line 336: Cannot add foreign key constraint

bzcat: I/O or other error, bailing out. Possible reason follows.
bzcat: Broken pipe
        Input file = /tmp/tine-20170929-120600//tine20_mysql.sql.bz2, output file = (stdout)

root@tine:~# /usr/bin/php /usr/share/tine20/setup.php --restore -- db=1 backupDir=/tmp/tine-20170929-120600/
PHP Fatal error: Uncaught PDOException: SQLSTATE[42S02]: Base table or view not found: 1146 Table 'tine20db.tine20_addressbook' doesn't exist in /usr/share/tine20/vendor/zendframework/zendframework1/library/Zend/Db/Statement/Pdo.php:228
Stack trace:
#0 /usr/share/tine20/vendor/zendframework/zendframework1/library/Zend/Db/Statement/Pdo.php(228): PDOStatement->execute(Array)
#1 /usr/share/tine20/vendor/zendframework/zendframework1/library/Zend/Db/Statement.php(303): Zend_Db_Statement_Pdo->_execute(Array)
0000002 /usr/share/tine20/vendor/zendframework/zendframework1/library/Zend/Db/Adapter/Abstract.php(480): Zend_Db_Statement->execute(Array)
#3 /usr/share/tine20/vendor/zendframework/zendframework1/library/Zend/Db/Adapter/Pdo/Abstract.php(238): Zend_Db_Adapter_Abstract->query('SELECT `tine20_...', Array)
0000004 /usr/share/tine20/vendor/zendframework/zendframework1/library/Zend/Db/Select.php(711): Zend_Db_Adapter_Pdo_Abstract->query(Object(Zend_Db_Select))
#5 /usr/share/tine20/Tinebase/User/Sql.php(328): Zend_Db_Select->query()
#6 /usr/sha in /usr/share/tine20/vendor/zendframework/zendframework1/library/Zend/Db/Statement/Pdo.php on line 235

Fatal error: Uncaught PDOException: SQLSTATE[42S02]: Base table or view not found: 1146 Table 'tine20db.tine20_addressbook' doesn't exist in /usr/share/tine20/vendor/zendframework/zendframework1/library/Zend/Db/Statement/Pdo.php:228
Stack trace:
#0 /usr/share/tine20/vendor/zendframework/zendframework1/library/Zend/Db/Statement/Pdo.php(228): PDOStatement->execute(Array)
#1 /usr/share/tine20/vendor/zendframework/zendframework1/library/Zend/Db/Statement.php(303): Zend_Db_Statement_Pdo->_execute(Array)
0000002 /usr/share/tine20/vendor/zendframework/zendframework1/library/Zend/Db/Adapter/Abstract.php(480): Zend_Db_Statement->execute(Array)
#3 /usr/share/tine20/vendor/zendframework/zendframework1/library/Zend/Db/Adapter/Pdo/Abstract.php(238): Zend_Db_Adapter_Abstract->query('SELECT `tine20_...', Array)
0000004 /usr/share/tine20/vendor/zendframework/zendframework1/library/Zend/Db/Select.php(711): Zend_Db_Adapter_Pdo_Abstract->query(Object(Zend_Db_Select))
#5 /usr/share/tine20/Tinebase/User/Sql.php(328): Zend_Db_Select->query()
#6 /usr/sha in /usr/share/tine20/vendor/zendframework/zendframework1/library/Zend/Db/Statement/Pdo.php on line 235
TagsNo tags attached.
mwticket

Relationships

related to 0013500 new MYSQL-DB PASSWORD LEAKED AFTER UPGRADE !!! 

Activities

pschuele

pschuele

2017-11-03 09:52

administrator   ~0021068

as we just use mysqldump to create the sql backup, there is little room for improvement. maybe there are options for mysqldump that add more stability here?
estradis

estradis

2017-11-03 12:38

reporter   ~0021082

ah, didn't know that! I also have absolutly no idea about any options using mysqldump. I'm not firm with mysql and to be honest, i don't really like it.

Unfortunatly using a built-in method of mysql which fails afterwards by using another build-in method means that there might something wrong with the data consinstency. Therefore i try to cleanup and audit the contents in first, before proceeding with this issue, but please be patient. It might take a while!
pschuele

pschuele

2017-11-16 11:22

administrator   ~0021140

we'll add the -f param to the mysql import command (see https://stackoverflow.com/questions/11263018/mysql-ignore-errors-when-importing). that should skip the errors with fk constraints during the import.
pschuele

pschuele

2017-11-16 14:59

administrator   ~0021146

if you see any errors, you might have to run the --restore multiple times. the problems can occur when you restore into an existing database of an older tine version with a different sql schema.

Issue History

Date Modified Username Field Change
2017-09-29 14:57 estradis New Issue
2017-11-01 16:31 pschuele Relationship added related to 0013500
2017-11-03 09:52 pschuele Note Added: 0021068
2017-11-03 12:38 estradis Note Added: 0021082
2017-11-16 11:21 pschuele Assigned To => pschuele
2017-11-16 11:22 pschuele Note Added: 0021140
2017-11-16 11:23 pschuele Status new => gerrit
2017-11-16 11:23 pschuele Target Version => 2017.11.1 Caroline Business Edition
2017-11-16 14:59 pschuele Note Added: 0021146
2017-11-16 14:59 pschuele Status gerrit => resolved
2017-11-16 14:59 pschuele Resolution open => fixed
2017-11-16 14:59 pschuele Fixed in Version => 2017.11.1 Caroline Business Edition