Skip to content

ldr: it is possible to truncate a table used by LDR #159097

@jeffswenson

Description

@jeffswenson

It's possible to run truncate against a table that is the source or destination for LDR. This is a problem because truncate switches which index id is used by the primary key and LDR is not set up to handle that.

$ cockroach demo --insecure --empty

CREATE DATABASE db_a; CREATE DATABASE db_b;

CREATE TABLE db_a.test_table (id INT PRIMARY KEY, value STRING);

CREATE EXTERNAL CONNECTION conn_a AS 'postgresql://root@localhost:26257/db_a?sslmode=disable';
CREATE EXTERNAL CONNECTION conn_b AS 'postgresql://root@localhost:26257/db_b?sslmode=disable';

USE db_b;
CREATE LOGICALLY REPLICATED TABLE test_table
	FROM TABLE test_table
	ON 'external://conn_a'
	WITH BIDIRECTIONAL ON 'external://conn_b';

TRUNCATE db_a.test_db;
-- This should error

Jira issue: CRDB-57681

Epic CRDB-55074

Metadata

Metadata

Assignees

Labels

A-disaster-recoveryA-logical-data-replicationA-schema-changer-implRelated to the implementation of the new schema changerC-bugCode not up to spec/doc, specs & docs deemed correct. Solution expected to change code/behavior.T-sql-foundationsSQL Foundations Team (formerly SQL Schema + SQL Sessions)branch-release-25.4Used to mark GA and release blockers and technical advisories for 25.4branch-release-26.1Used to mark GA and release blockers, technical advisories, and bugs for 26.1target-release-26.2.0

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions