Cannot delete or update a parent row: a foreign key constraint fails

  • 7014084
  • 11-Nov-2013
  • 29-Jan-2014

Environment

Novell Filr 1.0.1

Situation

When reviewing the ssf.log from the Filr appliance, the following error is thrown repeatedly:

2013-08-21 00:00:07,691 WARN  [Sitescape_Worker-9]
[org.hibernate.util.JDBCExceptionReporter] - SQL Error: 1451, SQLState: 23000
2013-08-21 00:00:07,691 ERROR [Sitescape_Worker-9]
[org.hibernate.util.JDBCExceptionReporter] - Cannot delete or update a parent row: a foreign key constraint fails (`filr/SS_Forums`, CONSTRAINT `FKDF668A515B285D8D` FOREIGN KEY (`parentBinder`) REFERENCES `SS_Forums` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION)
2013-08-21 00:00:07,691 WARN  [Sitescape_Worker-9]
[org.kablink.teaming.module.folder.impl.DefaultFolderCoreProcessor] - Error delete folder /Home Workspace/Net Folders/CU-teachers/SBAYL/ActivSoftware/Atlas
org.springframework.dao.DataIntegrityViolationException: could not execute update query; SQL [delete from SS_Forums where id=?]; constraint [null]; nested exception is org.hibernate.exception.ConstraintViolationException: could not execute update query

Resolution

A fix for this issue is available in the Filr 1.0.1 Hot Patch 1, available via the Novell Patch Finder.

The patch does not prevent a delete operation from getting in this state rather when the system detects constraint violation error during deletion of a binder, it will try and repair the situation by clearing references from children and then give it another try to delete the binder. This repair process will continue in the background until all constraint violation errors are exposed (and corrected) by the background delete job.

Cause

The root cause which puts a system in this condition is not yet known. It appears that this is an outcome of a delete/purge attempt on a folder which ran into foreign key constraints as it was running in the background.

Additional Information

You may also see similar errors like this in the ssf.log file:

013-10-01 10:45:05,085 WARN  [Sitescape_Worker-5]
[org.hibernate.util.JDBCExceptionReporter] - SQL Error: 1451, SQLState: 23000
2013-10-01 10:45:05,085 ERROR [Sitescape_Worker-5]
[org.hibernate.util.JDBCExceptionReporter] - Cannot delete or update a parent row: a foreign key constraint fails (`filr`.`SS_Forums`, CONSTRAINT `FKDF668A511CACB780` FOREIGN KEY (`topFolder`) REFERENCES `SS_Forums` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION)