Skip to content

[Bug]: prep remove does not work with mysql database #465

@YurkoWasHere

Description

@YurkoWasHere

Description

Singularity will note remove a preparation using the `prep remove` command. Error indicates a sql issue

Steps to Reproduce

  1. run singularity with mysql as backend
  2. start a prep
  3. Run below commands
singularity prep remove --cars 1

Version

singularity v0.5.14-f54c4c1

Operating System

Linux

Database Backend

MySQL

Additional context

$ singularity prep remove --cars 5
2025-03-11T11:23:58.251-0400    INFO    database        database/connstring.go:45       Opening mysql database
2025-03-11T11:23:58.260-0400    ERROR   database        database/util.go:80     DELETE FROM `preparations` WHERE `preparations`.`id` = '8'      {"rowsAffected": 0, "elapsed": 0.002745421, "err": "Error 1296 (HY000): Got error 193 '`singularity`.`file_ranges`, CONSTRAINT `fk_files_file_ranges` FOREIGN KEY (`file_id`) REFERENCES `files` (`id`) ON DELETE CASCADE' from InnoDB"}
Error 1296 (HY000): Got error 193 '`singularity`.`file_ranges`, CONSTRAINT `fk_files_file_ranges` FOREIGN KEY (`file_id`) REFERENCES `files` (`id`) ON DELETE CASCADE' from InnoDB

This issue exists also when trying to run the delete command manually in mysql. This indicates some sort of mysql issues.

I managed to work around by first manually deleting file_ranges.

DELETE FROM file_ranges WHERE file_id IN (SELECT id FROM files WHERE attachment_id= 5);

Then performing the remove again.

singularity prep remove --cars 5

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingtriage

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions