We have deployed MySQL cluster version - 5.7.22-22 on Debian GNU/Linux 9, 1 Master, and 2 replicas(slaves). From the hardware, software, and MySQL configuration point of view, all the instances are identical. Both the slaves are read-only, with no direct writing happening to the slaves.
We have observed that for some tables with the same number of rows on master and slaves the .ibd file size for the table is different in master and slave. for example, if the table employee is 100GB on master it will be 120GB on slaves. The difference varies from 10-20% and even more sometimes. Generally, we have observed these issues on the partitioned schemas or schemas with column data types varchar/text/longtext.
To fix this issue, we have been running table optimization or some time rebuilding slaves from the master if the data size is more.
Sample Schema:
CREATE TABLE messages (
id int(11) NOT NULL AUTO_INCREMENT,
message_id varchar(100) NOT NULL,
relayed tinyint(1) DEFAULT NULL,
relayed_at datetime DEFAULT NULL,
exchange_name varchar(100) NOT NULL,
exchange_type varchar(10) NOT NULL DEFAULT âqueueâ,
message mediumtext,
inbound_message_id varchar(100) DEFAULT NULL,
app_id varchar(50) DEFAULT NULL,
correlation_id varchar(100) DEFAULT NULL,
group_id varchar(100) NOT NULL,
http_method varchar(10) DEFAULT NULL,
http_uri varchar(4096) DEFAULT NULL,
reply_to varchar(100) DEFAULT NULL,
reply_to_http_method varchar(10) DEFAULT NULL,
reply_to_http_uri varchar(4096) DEFAULT NULL,
txn_id varchar(100) DEFAULT NULL,
routing_key varchar(100) DEFAULT NULL,
context text,
destination_response_status int(11) DEFAULT NULL,
relay_error varchar(255) DEFAULT NULL,
retries int(11) DEFAULT â0â,
custom_headers text,
created_at datetime NOT NULL,
updated_at datetime NOT NULL,
PRIMARY KEY (id),
UNIQUE KEY message_id_idx (message_id),
KEY exchange_name_idx (exchange_name),
KEY group_id_idx (group_id),
KEY relayed_idx (relayed)
) ENGINE=InnoDB AUTO_INCREMENT=671810 DEFAULT CHARSET=latin1
Does anyone else also observing the same phenomenon in your setups, want to understand what is causing this issue?





