yugabyte / yugabyte/yugabyte-db
[DocDB][xCluster][DDL] Replication halts even if schema matches but the schema was evolved with different steps on source and target
- Dominant language
- C
- Stars
- 10.5k
- Forks
- 1.3k
- PR merge metrics
- PR metrics pending
Description
Jira Link: [DB-6027](https://yugabyte.atlassian.net/browse/DB-6027)
### Description
Replication is halted even when schema matches on both source and target.
**Version**: 2.19.x
Create table at both sides
`
create table t1(id int primary key, name text);
`
setup replication and insert some rows and read at target ---- works
At source:
```
insert into t1(id, name) values(1,'Arjun');
insert into t1(id, name) values(2,'Sandeep');
```
At target:
```
select * from t1;
id | name
----+---------
1 | Arjun
2 | Sandeep
```
then alter table at source:
`
alter table t1 add column c1 text; ----- here type is text
`
and insert some rows
```
insert into t1(id, name, c1) values(3,'Hari','a');
insert into t1(id, name, c1) values(4,'Julien','b');
insert into t1(id, name, c1) values(5,'New','c');
```
here data is not replicated --- expected as there is mismatch in schema
then alter table at target
`
alter table t1 add column c1 int; ------ here type is int
`
data is not replicated ----- expected
alter at target
```
alter table t1 drop column c1
alter table t1 add column c1 text; ------ made it to text
```
here replication is not happened ------ expected as the alter id is different
then alter at source
```
alter table t1 drop column c1;
alter table t1 add column c1 text;
insert into t1(id, name, c1) values(6,'New','d');
demo1=# select * from t1;
id | name | c1
----+---------+----
5 | New |
1 | Arjun |
6 | New | d
4 | Julien |
2 | Sandeep |
3 | Hari |
```
after this replication should happen as both table has same schema
but it is not happening
```
demo1=# select * from t1;
id | name | c1
----+---------+----
1 | Arjun |
2 | Sandeep |
```
**Expected**: Replication should happen as schemas as compatible but they are not happening.
### Warning: Please confirm that this issue does not contain any sensitive information
- [X] I confirm this issue does not contain any sensitive information.
[DB-6027]: https://yugabyte.atlassian.net/browse/DB-6027?atlOrigin=eyJpIjoiNWRkNTljNzYxNjVmNDY3MDlhMDU5Y2ZhYzA5YTRkZjUiLCJwIjoiZ2l0aHViLWNvbS1KU1cifQ
Contributor guide
No contributing guide indexed for this repository
Research direction
Start by reproducing the documented SQL sequence on version 2.19.x: create the table, configure xCluster replication, evolve the schema differently on each side, then converge both schemas. Investigate xCluster's DDL and schema-matching handling; done means replication resumes and the later insert reaches the target once the schemas are compatible.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- sql
- Domain
- databases, distributed-systems
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100