[Commits] Rev 3528: MDEV-560 fixed (correct fields indexing). in file:///home/bell/maria/bzr/work-maria-5.5-cassandra/

sanja at montyprogram.com sanja at montyprogram.com
Fri Sep 28 02:24:50 EEST 2012


At file:///home/bell/maria/bzr/work-maria-5.5-cassandra/

------------------------------------------------------------
revno: 3528
revision-id: sanja at montyprogram.com-20120927232449-fv3s8f16hfj4kkn5
parent: sanja at montyprogram.com-20120927225325-93f24l6jzfwjn8ax
committer: sanja at montyprogram.com
branch nick: work-maria-5.5-cassandra
timestamp: Fri 2012-09-28 02:24:49 +0300
message:
  MDEV-560 fixed (correct fields indexing).
-------------- next part --------------
=== modified file 'mysql-test/r/cassandra.result'
--- a/mysql-test/r/cassandra.result	2012-09-27 22:53:25 +0000
+++ b/mysql-test/r/cassandra.result	2012-09-27 23:24:49 +0000
@@ -520,9 +520,23 @@ select rowkey, column_json(dyn) from t1;
 rowkey	column_json(dyn)
 1	[{"a":"ddd"},{"boolcol":1}]
 2	[{"a":"ddd"},{"dyn1":"1"}]
+update t1 set rowkey= 3, dyn=column_add(dyn, "dyn1", null, 'boolcol', 0) where rowkey= 2;
+select rowkey, column_json(dyn) from t1;
+rowkey	column_json(dyn)
+1	[{"a":"ddd"},{"boolcol":1}]
+3	[{"a":"ddd"},{"boolcol":0}]
 delete from t1;
 drop table t1;
 CREATE TABLE t1 (rowkey varchar(10) PRIMARY KEY, dyn blob DYNAMIC_COLUMN_STORAGE=yes) ENGINE=CASSANDRA thrift_host='localhost' keyspace='mariadbtest2' column_family = 'cfd1';
 select * from t1;
 ERROR HY000: Internal error: 'Unable to convert value for field `dyn` from Cassandra's data format. Name length exceed limit of 255: 'very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_ver'
 drop table t1;
+CREATE TABLE t1 (rowkey int PRIMARY KEY, dyn blob DYNAMIC_COLUMN_STORAGE=yes) 
+ENGINE=CASSANDRA thrift_host='localhost' keyspace='mariadbtest2' column_family = 'cfd2';
+DELETE FROM t1;
+insert into t1 values (1, column_create("dyn", 1));
+select rowkey, column_list(dyn) from t1;
+rowkey	column_list(dyn)
+1	`dyn`
+delete from t1;
+DROP TABLE t1;

=== modified file 'mysql-test/t/cassandra.test'
--- a/mysql-test/t/cassandra.test	2012-09-27 22:53:25 +0000
+++ b/mysql-test/t/cassandra.test	2012-09-27 23:24:49 +0000
@@ -101,6 +101,11 @@ CREATE COLUMN FAMILY cfd1
   AND default_validation_class = UTF8Type;
 SET cfd1['1']['very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_long_name']='1';
 
+CREATE COLUMN FAMILY cfd2 
+  WITH comparator = UTF8Type
+    AND key_validation_class=Int32Type
+    AND default_validation_class = UTF8Type;
+
 EOF
 
 --error 0,1,2
@@ -601,6 +606,8 @@ update t1 set dyn=column_add(dyn, "12345
 select rowkey, column_json(dyn) from t1;
 update t1 set dyn=column_add(dyn, 'boolcol', null) where rowkey= 2;
 select rowkey, column_json(dyn) from t1;
+update t1 set rowkey= 3, dyn=column_add(dyn, "dyn1", null, 'boolcol', 0) where rowkey= 2;
+select rowkey, column_json(dyn) from t1;
 delete from t1;
 drop table t1;
 
@@ -609,6 +616,16 @@ CREATE TABLE t1 (rowkey varchar(10) PRIM
 select * from t1;
 drop table t1;
 
+# MDEV-560
+CREATE TABLE t1 (rowkey int PRIMARY KEY, dyn blob DYNAMIC_COLUMN_STORAGE=yes) 
+ENGINE=CASSANDRA thrift_host='localhost' keyspace='mariadbtest2' column_family = 'cfd2';
+DELETE FROM t1;
+insert into t1 values (1, column_create("dyn", 1));
+select rowkey, column_list(dyn) from t1;
+# Cleanup
+delete from t1;
+DROP TABLE t1;
+
 ############################################################################
 ## Cassandra cleanup
 ############################################################################

=== modified file 'storage/cassandra/ha_cassandra.cc'
--- a/storage/cassandra/ha_cassandra.cc	2012-09-27 22:53:25 +0000
+++ b/storage/cassandra/ha_cassandra.cc	2012-09-27 23:24:49 +0000
@@ -1736,15 +1736,13 @@ int ha_cassandra::read_cassandra_columns
                                    &cass_value, &cass_value_len))
   {
     // map to our column. todo: use hash or something..
-    uint idx=1;
     bool found= 0;
     for (field= table->field + 1; *field; field++)
     {
-      idx++;
-      if ((!dyncol_set || dyncol_field != idx) &&
+      int fieldnr= (*field)->field_index;
+      if ((!dyncol_set || dyncol_field != fieldnr) &&
           !strcmp((*field)->field_name, cass_name))
       {
-        int fieldnr= (*field)->field_index;
         found= 1;
         (*field)->set_notnull();
         if (field_converters[fieldnr]->cassandra_to_mariadb(cass_value,



More information about the commits mailing list