readysettech / readyset

Readyset is a MySQL and Postgres wire-compatible caching layer that sits in front of existing databases to speed up queries and horizontally scale read throughput. Under the hood, ReadySet caches the results of cached select statements and incrementally updates these results over time as the underlying data changes.
https://readyset.io
Other
4.04k stars 115 forks source link

Check how we handle FKs #1300

Open altmannmarcelo opened 5 days ago

altmannmarcelo commented 5 days ago

Description

Currently when snapshotting, we require to replicate all tables from FK's example:

CREATE TABLE c (ID INT PRIMARY KEY);
CREATE TABLE b (ID INT PRIMARY KEY, c_ID INT, CONSTRAINT `c_id` FOREIGN KEY (c_ID) REFERENCES `c` (ID) ON DELETE CASCADE ON UPDATE CASCADE);

readyset --upstream-db-url=mysql://root:noria@127.1:3306/fks --replication-tables=fks.b
. . .
2024-06-25T16:40:07.298905Z  WARN taking database snapshot: replicators::mysql_connector::snapshot: Error extending CREATE TABLE, table will not be used error=Error during RPC (extend_recipe (in readyset-client/src/controller/rpc.rs:49:26)): Table 'fks.c' is not being replicated by ReadySet
2024-06-25T16:40:07.301424Z  INFO taking database snapshot: replicators::table_filter: denying replication schema=fks table=b

Validate if we need FK's for anything other than parsing. If not we should get rid of this limitation

Change in user-visible behavior

Requires documentation change