Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bug: (Primary/Secondary)After a column is added.Data on the primary database and that on the secondary database are inconsistent. #1074

Closed
3 tasks done
haitaoguan opened this issue Dec 6, 2022 · 5 comments
Assignees
Labels
A-bug Something isn't working A-feature feature with good idea B-DDL DDL related issues B-master-replica master/replica sync, replay B-storage data type, data storage, insert,update,delete, transactions prio: high High priority

Comments

@haitaoguan
Copy link
Collaborator

Have you read the Contributing Guidelines on issues?

Please confirm if bug report does NOT exists already ?

  • I confirm there is no existing issue for this

Describe the problem

###master

create table ttt(id int primary key,name varchar(5));
insert into ttt values(1,'AAA'),(2,'BBB');
alter table ttt add column age int not null;
mysql> select * from ttt;
+----+------+-----+
| id | name | age |
+----+------+-----+
|  1 | AAA  |   0 |
|  2 | BBB  |   0 |
+----+------+-----+
2 rows in set (0.00 sec)

###slave

mysql> select * from ttt;
+----+------+-----+
| id | name | age |
+----+------+-----+
| NULL | AAA  | NULL |
| NULL | BBB  | NULL |
+----+------+-----+
2 rows in set (0.00 sec)

Expected behavior

###slave

mysql> select * from ttt;
+----+------+-----+
| id | name | age |
+----+------+-----+
|  1 | AAA  |   0 |
|  2 | BBB  |   0 |
+----+------+-----+
2 rows in set (0.00 sec)

How To Reproduce

No response

Environment

./mysqld Ver 5.7.36-StoneDB for Linux on x86_64 (build-)
build information as follow:
Repository address: https://github.com/stoneatom/stonedb.git:HEAD
Branch name: HEAD
Last commit ID: b44a51c
Last commit time: Date: Fri Dec 2 16:11:06 2022 +0000
Build time: Date: Mon Dec 5 06:12:44 UTC 2022

Are you interested in submitting a PR to solve the problem?

  • Yes, I will!
@haitaoguan haitaoguan added the A-bug Something isn't working label Dec 6, 2022
@adofsauron adofsauron changed the title bug: After a column is added, the primary and secondary data is inconsistent bug: between master/slave, after a column is added, the primary and secondary data is inconsistent Dec 7, 2022
@DandreChen
Copy link
Collaborator

ACK

@konghaiya
Copy link
Collaborator

The reason for this problem should be that not null does not take effect when adding columns,
Innodb assigns a value of 0 by default, but tianmu directly assigns a value of null.
Therefore, we need to troubleshoot the problem that not null does not take effect when adding new columns.

@konghaiya konghaiya added this to the stonedb_5.7_v1.0.2 milestone Dec 9, 2022
@DandreChen
Copy link
Collaborator

test case without primary key:

mysql> create table ttt(id int,name varchar(5));
Query OK, 0 rows affected (0.01 sec)

mysql> insert into ttt values(1,'AAA'),(2,'BBB');
Query OK, 2 rows affected (0.00 sec)
Records: 2  Duplicates: 0  Warnings: 0

mysql> alter table ttt add column age int not null;
Query OK, 0 rows affected (0.02 sec)
Records: 0  Duplicates: 0  Warnings: 0

mysql> select * from ttt;
+------+------+-----+
| id   | name | age |
+------+------+-----+
|    1 | AAA  | NULL |
|    2 | BBB  | NULL |
+------+------+-----+
2 rows in set (0.00 sec)

@DandreChen
Copy link
Collaborator

the inplace method of tianmu don‘t support primary key
need support primary key

@wisehead wisehead added the A-feature feature with good idea label Dec 15, 2022
@haitaoguan haitaoguan changed the title bug: between master/slave, after a column is added, the primary and secondary data is inconsistent bug: between master/slave, after a column is added.Data on the primary database and that on the secondary database are inconsistent. Jan 9, 2023
@wisehead wisehead added B-DDL DDL related issues B-master-replica master/replica sync, replay labels Jan 9, 2023
@haitaoguan haitaoguan changed the title bug: between master/slave, after a column is added.Data on the primary database and that on the secondary database are inconsistent. bug: Primary/Secondary, after a column is added.Data on the primary database and that on the secondary database are inconsistent. Jan 12, 2023
@haitaoguan haitaoguan changed the title bug: Primary/Secondary, after a column is added.Data on the primary database and that on the secondary database are inconsistent. bug: (Primary/Secondary)After a column is added.Data on the primary database and that on the secondary database are inconsistent. Jan 12, 2023
@wisehead wisehead added the prio: high High priority label Jan 30, 2023
@hustjieke hustjieke added the B-storage data type, data storage, insert,update,delete, transactions label Jan 30, 2023
@konghaiya konghaiya removed their assignment Feb 3, 2023
@DandreChen
Copy link
Collaborator

the similar to #1188

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-bug Something isn't working A-feature feature with good idea B-DDL DDL related issues B-master-replica master/replica sync, replay B-storage data type, data storage, insert,update,delete, transactions prio: high High priority
Projects
None yet
Development

No branches or pull requests

5 participants