Add Group Import graceful failure
requested to merge georgekoltsov/group-import-graceful-failure into georgekoltsov/group-structure-import
What does this MR do?
This MR adds graceful failure to Group Import process.
Similarly to Project Import graceful failures (!20727 (merged)), instead of failing hard during import we save failure to the database, to allow import process to finish.
There is existing db table import_failures
that was scoped to projects only. I am adding group_id
foreign key to it to allow one table to contain both group and project import failures, instead of creating a new table.
Migrations output
== 20191216135235 AddGroupIdToImportFailures: migrating =======================
-- add_column(:import_failures, :group_id, :bigint, {:null=>true})
-> 0.0011s
== 20191216135235 AddGroupIdToImportFailures: migrated (0.0012s) ==============
== 20191216135355 AddGroupFkToImportFailures: migrating =======================
-- transaction_open?()
-> 0.0000s
-- foreign_keys(:import_failures)
-> 0.0025s
-- execute("ALTER TABLE import_failures\nADD CONSTRAINT fk_24b824da43\nFOREIGN KEY (group_id)\nREFERENCES namespaces (id)\nON DELETE CASCADE\nNOT VALID;\n")
-> 0.0015s
-- execute("SET statement_timeout TO 0")
-> 0.0003s
-- execute("ALTER TABLE import_failures VALIDATE CONSTRAINT fk_24b824da43;")
-> 0.0157s
-- execute("RESET ALL")
-> 0.0003s
-- transaction_open?()
-> 0.0000s
-- index_exists?(:import_failures, :group_id, {:where=>"group_id IS NOT NULL", :algorithm=>:concurrently})
-> 0.0022s
-- execute("SET statement_timeout TO 0")
-> 0.0002s
-- add_index(:import_failures, :group_id, {:where=>"group_id IS NOT NULL", :algorithm=>:concurrently})
-> 0.0029s
-- execute("RESET ALL")
-> 0.0002s
== 20191216135355 AddGroupFkToImportFailures: migrated (0.0262s) ==============
== 20191216155410 RemoveNullConstraintOnProjectIdInImportFailures: migrating ==
-- change_column_null(:import_failures, :project_id, true)
-> 0.0003s
== 20191216155410 RemoveNullConstraintOnProjectIdInImportFailures: migrated (0.0003s)
Screenshots
N/A
Does this MR meet the acceptance criteria?
Conformity
- [-] Changelog entry
- [-] Documentation (if required)
-
Code review guidelines - [-] Merge request performance guidelines
-
Style guides -
Database guides - [-] Separation of EE specific content
Availability and Testing
N/A
Security
N/A
Edited by 🤖 GitLab Bot 🤖