Commit 655e3045 authored by unknown's avatar unknown

MDEV-4005 fix.

Field matching fixed.
DBUG_ASSERT fixed.
parent ffd5f8c8
......@@ -580,3 +580,14 @@ select rowkey, column_json(dyn) from t1;
rowkey column_json(dyn)
delete from t1;
DROP TABLE t1;
#
# MDEV-4005 #Server crashes on creating a Cassandra table
# with a mix of static and dynamic columns
#
DROP TABLE IF EXISTS t1, t2;
CREATE TABLE t1 (
pk int primary key,
col_int int,
dyncol blob DYNAMIC_COLUMN_STORAGE=yes
) ENGINE=cassandra keyspace='bug' thrift_host = '127.0.0.1' column_family='cf1';
drop table t1;
......@@ -664,6 +664,42 @@ select rowkey, column_json(dyn) from t1;
delete from t1;
DROP TABLE t1;
--echo #
--echo # MDEV-4005 #Server crashes on creating a Cassandra table
--echo # with a mix of static and dynamic columns
--echo #
--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, col_int int, a bigint );
EOF
--system cqlsh -3 -f $MYSQLTEST_VARDIR/cassandra_test_init.cql
CREATE TABLE t1 (
pk int primary key,
col_int int,
dyncol blob DYNAMIC_COLUMN_STORAGE=yes
) ENGINE=cassandra keyspace='bug' thrift_host = '127.0.0.1' column_family='cf1';
drop table t1;
############################################################################
## Cassandra cleanup
......
......@@ -1517,6 +1517,7 @@ bool ha_cassandra::setup_field_converters(Field **field_arg, uint n_fields)
DBUG_RETURN(true);
}
(*conv)->field= *field;
break;
}
}
if (dyncol_set && !(*field)) // is needed and not found
......@@ -1611,7 +1612,7 @@ void ha_cassandra::free_field_converters()
for (uint i=0; i < n_field_converters; i++)
if (field_converters[i])
{
DBUG_ASSERT(!dyncol_set || i == dyncol_field);
DBUG_ASSERT(!dyncol_set || i != dyncol_field);
delete field_converters[i];
}
my_free(field_converters);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment