Problems with migrating data with foreign key constraints.
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 5/5
- Tiempo estimado
- Más de una semana
- Aptitud para principiantes
- 20/100
Línea de trabajo
Start with the issue's MySQL example of ON DELETE CASCADE and ON UPDATE CASCADE while FOREIGN_KEY_CHECKS is disabled. Trace how ghostferry applies parent-row updates and deletes to the target, then define a reproducible consistency check for the affected child tables; the issue does not name specific files or tests.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
The main reason behind migrating tables with foreign key constraints is that they can have referential actions for a foreign key such as ON DELETE CASCADE, ON UPDATE CASCADE.
Cascading deletes and updates in child tablees caused by foreign key constraints don't show up in binlogs because these referential actions are dealt internally by InnoDB. Check out this link - https://dba.stackexchange.com/questions/51873/replication-binary-log-parsingtableid-generation-on-delete-cascade-handling.
Let's take a look at this sql example on a source database :-
mysql> SET FOREIGN_KEY_CHECKS=0;
Query OK, 0 rows affected (0.00 sec)
mysql> use gf_test;
Database changed
mysql> CREATE TABLE IF NOT EXISTS t1 (id1 bigint(20), primary key(id1));
Query OK, 0 rows affected, 1 warning (0.01 sec)
mysql> CREATE TABLE IF NOT EXISTS t2 (id2 bigint(20), primary key(id2), CONSTRAINT fkc2 foreign key(id2) REFERENCES t1(id1) ON DELETE CASCADE ON UPDATE CASCADE);
Query OK, 0 rows affected, 1 warning (0.01 sec)
mysql> INSERT INTO t1 VALUES (1);
Query OK, 1 row affected (0.00 sec)
mysql> INSERT INTO t2 VALUES (1);
Query OK, 1 row affected (0.01 sec)
mysql> UPDATE t1 SET id1 = 2 WHERE id1 = 1;
Query OK, 1 row affected (0.00 sec)
Rows matched: 1 Changed: 1 Warnings: 0
mysql> SELECT * FROM t1;
+-----+
| id1 |
+-----+
| 2 |
+-----+
1 row in set (0.00 sec)
mysql> SELECT * FROM t2;
+-----+
| id2 |
+-----+
| 1 |
+-----+
1 row in set (0.00 sec)
We can clearly see here that since foreign key checks are disabled on the database updating the parent table does not change the foreign keys in child tables.
In terms of ghostferry migration when the rows are updated or deleted from the parent table in source database cascade won't update,delete rows in the child table if they're already present in the target database, eventually leading the database in an inconsistent state.
- Lenguaje dominante
- Go
- Estrellas
- 858
- Forks
- 77
- Merge medio
- 10 d 4 h
- PR fusionados (30 d)
- 4
Preparar el entorno
- Incluye un Dockerfile o un archivo de Docker Compose
- Sin plantilla de pull request
- Sin guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de Shopify/ghostferry
-
Gradual copy throttle recoveryAbierto
Dificultad 5/5 Más de una semana Aptitud para principiantes 15/100
Shopify/ghostferry#471 · 1 comentario ·
-
Trouble with virtual generated columnsPosiblemente ocupada @driv3r la tomó hace 222 días. Abierto
Dificultad 3/5 1-2 días Aptitud para principiantes 42/100
Shopify/ghostferry#338 · 7 comentarios ·
-
Dificultad 5/5 Más de una semana Aptitud para principiantes 30/100
Shopify/ghostferry#332 · 1 comentario ·
-
Dificultad 5/5 Más de una semana Aptitud para principiantes 25/100
Shopify/ghostferry#318 ·
-
Dificultad 4/5 3-5 días Aptitud para principiantes 35/100
Shopify/ghostferry#306 ·
Todos los issues de Shopify/ghostferry
Issues similares
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 82/100
kagent-dev/kagent#3792 ·
Los mantenedores suelen responder en 1 día
-
ai-driven-qa bug claude Minor
Dificultad 2/5 1-3 horas Aptitud para principiantes 68/100
linagora/cozy-stack#5374 ·
Los mantenedores suelen responder en 1 día
-
Bug: Potential leakageAbierto
Dificultad 1/5 Menos de una hora Aptitud para principiantes 85/100
google/certificate-transparency-go#1859 ·
Los mantenedores suelen responder en 1 día
-
[Bug]: gate 缺失Abiertobug
Dificultad 2/5 1-3 horas Aptitud para principiantes 64/100
Los mantenedores suelen responder en 1 día
-
Dificultad 1/5 Menos de una hora Aptitud para principiantes 64/100
newrelic/newrelic-cli#1958 ·
Los mantenedores suelen responder en 1 día