Details
-
Type:
Bug
-
Status: Closed
-
Priority:
Major
-
Resolution: Fixed
-
Affects Version/s: 5.5.39, 10.0.13
-
Component/s: Storage Engine - TokuDB
-
Labels:
-
Environment:Ubuntu 64bit 14.4 LTS: linux-kernel-3.13.0-24-generic
Description
I have a table partitioned by range created with the tokudb engine on mariadb 10.0.12. When I have one client inserting into this table everything works as expected. However, as soon as I have a second client inserting more data into this table I get the following error: Failed to read auto-increment value from storage engine. When I see the table status the Auto_increment value is 2049. My auto increment description is "id bigint not null auto_increment".
I can reproduce this problem with the below table and Java client side code. Another tokudb user on the tokudb-user group performed the test on Percona Server 5.6, which did not fail: https://groups.google.com/forum/#!topic/tokudb-user/2pnjQxuuvUo
CREATE TABLE `auto_inc_test` (
`id` bigint(20) NOT NULL AUTO_INCREMENT,
`time` bigint(20) NOT NULL,
PRIMARY KEY (`time`,`id`)
) ENGINE=TokuDB AUTO_INCREMENT=1001 DEFAULT CHARSET=latin1 `compression`='tokudb_zlib'
ALTER TABLE order_books partition by range (time) (
partition p0 values less than (1507495611880)
);
public class MultipleClientsInsertingDataIntoPartitionedTokudbTable { public static final String INSERT_STATEMENT = "INSERT INTO test.auto_inc_test (time) values (?)"; private final CountDownLatch countDownLatch; public MultipleClientsInsertingDataIntoPartitionedTokudbTable() { countDownLatch = new CountDownLatch(2); } public static void main(String[] args) throws InterruptedException { MultipleClientsInsertingDataIntoPartitionedTokudbTable multipleClientsInsertingDataIntoPartitionedTokudbTable = new MultipleClientsInsertingDataIntoPartitionedTokudbTable(); multipleClientsInsertingDataIntoPartitionedTokudbTable.start(); } private void start() throws InterruptedException { DataSource dataSource = createDataSource(); new Thread(new InsertRunnable(dataSource)).start(); new Thread(new InsertRunnable(dataSource)).start(); countDownLatch.await(); } private DataSource createDataSource() { String jdbcUrl = "jdbc:mysql://xxx.xxx.xxx.xxx/test?tcpNoDelay=true&tcpKeepAlive=true&rewriteBatchedStatements=true"; String username = "user"; String password = "password"; MysqlDataSource mysqlDataSource = new MysqlDataSource(); mysqlDataSource.setURL(jdbcUrl); mysqlDataSource.setUser(username); mysqlDataSource.setPassword(password); return mysqlDataSource; } private void insertData(DataSource dataSource) { try (Connection connection = dataSource.getConnection(); PreparedStatement preparedStatement = connection .prepareStatement(INSERT_STATEMENT)) { connection.setAutoCommit(false); for (int i = 0; i < 1000; i++) { preparedStatement.setLong(1, System.currentTimeMillis()); preparedStatement.addBatch(); } preparedStatement.executeBatch(); } catch (SQLException e) { e.printStackTrace(); } } private class InsertRunnable implements Runnable { private final DataSource dataSource; private InsertRunnable(DataSource dataSource) { this.dataSource = dataSource; } @Override public void run() { for (int i = 0; i < 1000; i++) { insertData(dataSource); } countDownLatch.countDown(); } } }
Gliffy Diagrams
Attachments
Activity
- All
- Comments
- Work Log
- History
- Activity
- Transitions
Reproducible on current 5.5 and 10.0 trees.
On debug versions, the test case causes the assertion failure:
Slightly tweaked Java class (imports added, connection parameters changed to MTR-like). Apparently, Java 7 is required for it to work.
Also slightly tweaked version of SQL (table name fixed, COMPRESSION clause removed):
CREATE TABLE `auto_inc_test` ( `id` bigint(20) NOT NULL AUTO_INCREMENT, `time` bigint(20) NOT NULL, PRIMARY KEY (`time`,`id`) ) ENGINE=TokuDB AUTO_INCREMENT=1001 DEFAULT CHARSET=latin1; ALTER TABLE auto_inc_test partition by range (time) ( partition p0 values less than (1507495611880) );Couldn't reproduce on the Tokutek MariaDB 5.5.38 build.