Details
Description
Two connections run DELETE from different Cassandra tables which point at the same column family. One DELETE ends with error 1032 "Can't find record".
DROP TABLE iF EXISTS t1, t2;
CREATE TABLE t1 (
pk int primary key,
c1 varchar(256),
c2 varchar(32)
) ENGINE=Cassandra keyspace='bug' column_family='cf1' thrift_host='127.0.0.1';
CREATE TABLE t2 LIKE t1;
INSERT INTO t1 VALUES (1,'a','b'), (2,NULL,'c'), (3,'s','d');
DELETE FROM t1 WHERE pk BETWEEN 1 AND 6;
DELETE FROM t2 WHERE c2 IN ('f', 0 ) ORDER BY pk;
main.t14 [ fail ]
Test ended at 2013-01-06 02:17:29
CURRENT_TEST: main.t14
mysqltest: At line 42: query 'DELETE FROM t2 WHERE c2 IN ('f', 0 ) ORDER BY pk' failed: 1032: Can't find record in 't2'
ORDER BY in the DELETE seems to be important.
Run the test below with repeat, e.g.
perl mysql-test-run.pl --repeat=30 <test name>
--source include/have_cassandra.inc --disable_warnings DROP TABLE iF EXISTS t1, t2; --enable_warnings --remove_files_wildcard $MYSQLTEST_VARDIR cassandra_test_cleanup.cql --write_file $MYSQLTEST_VARDIR/cassandra_test_cleanup.cql drop keyspace bug; EOF --error 0,1,2 --system cqlsh -3 -f $MYSQLTEST_VARDIR/cassandra_test_cleanup.cql --remove_files_wildcard $MYSQLTEST_VARDIR cassandra_test_init.cql --write_file $MYSQLTEST_VARDIR/cassandra_test_init.cql CREATE KEYSPACE bug WITH strategy_class = 'org.apache.cassandra.locator.SimpleStrategy' AND strategy_options:replication_factor='1'; USE bug; create columnfamily cf1 ( pk int primary key, c1 ascii, c2 ascii ); EOF --system cqlsh -3 -f $MYSQLTEST_VARDIR/cassandra_test_init.cql CREATE TABLE t1 ( pk int primary key, c1 varchar(256), c2 varchar(32) ) ENGINE=Cassandra keyspace='bug' column_family='cf1' thrift_host='127.0.0.1'; CREATE TABLE t2 LIKE t1; INSERT INTO t1 VALUES (1,'a','b'), (2,NULL,'c'), (3,'s','d'); --connect (con1,localhost,root,,test) --send DELETE FROM t1 WHERE pk BETWEEN 1 AND 6; --connection default DELETE FROM t2 WHERE c2 IN ('f', 0 ) ORDER BY pk; --connection con1 --reap DROP TABLE t1, t2; --disconnect con1
Gliffy Diagrams
Attachments
Issue Links
- relates to
-
MDEV-431 Cassandra storage engine
-
- Closed
-
Activity
- All
- Comments
- Work Log
- History
- Activity
- Transitions
DELETE works by first finding records to delete, and then deleting them. If ORDER BY is present, it may also sort records before doing deletes.
It seems, the following happens:
connection1 finds a record
connection2 finds the same record
connection2 deletes it
connection1 tries to delete the record, but it is already deleted. It gets an error.
Maybe, Cassandra SE should ignore the error in this case.