I use MySQL version 5.7.39, ENGINE=InnoDB, Isolation = Read-Uncommitted:
Table product with structure:
CREATE TABLE `product` (
`category_id` varchar(50) NOT NULL,
`product_seq` bigint(20) unsigned NOT NULL,
`product_name` varchar(255) NOT NULL,
`release_date` date NOT NULL,
`price` bigint(20) unsigned NOT NULL,
`expiry_date` date NOT NULL,
`manufacturing_date` date NOT NULL,
`deleteFlag` varchar(1) NOT NULL DEFAULT '0',
PRIMARY KEY (`category_id`,`product_seq`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
Table product_detail with structure:
CREATE TABLE `product_detail` (
`id` varchar(50) NOT NULL,
`product_seq` bigint(20) unsigned NOT NULL,
`dt_id` bigint(20) unsigned NOT NULL,
`cal_id` bigint(20) unsigned NOT NULL,
`abbreviations_nm` varchar(5) DEFAULT NULL,
`production` varchar(255) NOT NULL,
`raw_materials` varchar(1024) DEFAULT NULL,
`type` varchar(1024) DEFAULT NULL,
`period` bigint(20) NOT NULL,
`deleteFlag` varchar(1) NOT NULL DEFAULT '0',
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
One batch runs every day at a fixed time, when it runs it truncates and inserts new data into table product_detail (It's on another system so I don't have any information about the SQL statement).
At the same time batch running, my system run query to get data from 2 table above:
SELECT p.category_id, p.product_name, pd.product_seq , pd.period, pd.production
FROM product p
LEFT JOIN product_detail pd ON p.product_seq = pd.product_seq
ORDER BY p.category_id, pd.product_seq
Sometimes (Rarely happens) it returns an error log when executing SQL: Can't find record in 'product_detail'
This error log return by Outsystems so it doesn't have any other specific warnings or errors log.
I found a thread report this bug on MySQL: https://bugs.mysql.com/bug.php?id=1574
However, I still don't understand what causes the error and how to reproduce it for investigation. Can anyone help me to explain the problem?