List:Commits« Previous MessageNext Message »
From:Frazer Clement Date:November 20 2007 6:03pm
Subject:bk commit into 5.1 tree (frazer:1.2685) BUG#30674
View as plain text  
Below is the list of changes that have just been committed into a local
5.1 repository of frazer. When frazer does a push these changes will
be propagated to the main repository and, within 24 hours after the
push, to the public repository.
For information on how to access the public repository
see http://dev.mysql.com/doc/mysql/en/installing-source-tree.html

ChangeSet@stripped, 2007-11-20 17:03:37+00:00, frazer@stripped +3 -0
  Bug # 30674
  Changes after review - we need to set all Blob values in the Insert case.
  Added testcase and results to suite/ndb/t/ndb_blob.test to verify this via an Insert
which uses
  default values

  mysql-test/suite/ndb/r/ndb_blob.result@stripped, 2007-11-20 17:03:25+00:00,
frazer@stripped +21 -0
    Results for insert using built-in defaults for Blob

  mysql-test/suite/ndb/t/ndb_blob.test@stripped, 2007-11-20 17:03:27+00:00,
frazer@stripped +20 -0
    Test use of built-in Blob defaults

  sql/ha_ndbcluster.cc@stripped, 2007-11-20 17:03:28+00:00, frazer@stripped +12 -2
    Modification to previous bug fix to ensure that all Blobs are set in the Insert()
case.
    Behavior of bug 22045 unaffected by this change.

diff -Nrup a/mysql-test/suite/ndb/r/ndb_blob.result
b/mysql-test/suite/ndb/r/ndb_blob.result
--- a/mysql-test/suite/ndb/r/ndb_blob.result	2007-08-28 19:29:53 +01:00
+++ b/mysql-test/suite/ndb/r/ndb_blob.result	2007-11-20 17:03:25 +00:00
@@ -572,3 +572,24 @@ select count(*) from t1;
 count(*)
 0
 drop table t1;
+create table t1(
+a int,
+blob_nn blob not null,
+text_nn text not null,
+blob_nl blob,
+text_nl text,
+primary key(a)
+) engine=ndb;
+insert into t1(a) values (1);
+Warnings:
+Warning	1364	Field 'blob_nn' doesn't have a default value
+Warning	1364	Field 'text_nn' doesn't have a default value
+insert into t1(a, text_nl) values (2, 'MySQL Cluster NDB');
+Warnings:
+Warning	1364	Field 'blob_nn' doesn't have a default value
+Warning	1364	Field 'text_nn' doesn't have a default value
+select a, length(blob_nn), length(text_nn), blob_nl, text_nl from t1 order by a;
+a	length(blob_nn)	length(text_nn)	blob_nl	text_nl
+1	0	0	NULL	NULL
+2	0	0	NULL	MySQL Cluster NDB
+drop table t1;
diff -Nrup a/mysql-test/suite/ndb/t/ndb_blob.test b/mysql-test/suite/ndb/t/ndb_blob.test
--- a/mysql-test/suite/ndb/t/ndb_blob.test	2007-07-04 21:06:22 +01:00
+++ b/mysql-test/suite/ndb/t/ndb_blob.test	2007-11-20 17:03:27 +00:00
@@ -497,3 +497,23 @@ select count(*) from t1;
 drop table t1;
 
 # End of 4.1 tests
+
+
+# bug # 30674 :
+#   NOT NULL Blobs should default to zero-length.  Not NULL TEXT
+#   should default to zero-chars
+create table t1(
+  a int,
+  blob_nn blob not null,
+  text_nn text not null,
+  blob_nl blob,
+  text_nl text,
+  primary key(a)
+) engine=ndb;
+
+insert into t1(a) values (1);
+insert into t1(a, text_nl) values (2, 'MySQL Cluster NDB');
+
+select a, length(blob_nn), length(text_nn), blob_nl, text_nl from t1 order by a;
+
+drop table t1;
diff -Nrup a/sql/ha_ndbcluster.cc b/sql/ha_ndbcluster.cc
--- a/sql/ha_ndbcluster.cc	2007-11-19 16:58:07 +00:00
+++ b/sql/ha_ndbcluster.cc	2007-11-20 17:03:28 +00:00
@@ -3344,12 +3344,17 @@ int ha_ndbcluster::ndb_write_row(uchar *
     intact.
     This means that we now suffer from BUG#22045... :-/
   */
-
+  const MY_BITMAP *user_cols_written_bitmap;
+  
   if (m_use_write)
   {
     const NdbRecord *key_rec;
     const uchar *key_row;
     uchar *mask;
+
+    /* Using write, the only user-visible cols we write are in the write_set */
+    user_cols_written_bitmap= table->write_set;
+
     if (table_share->primary_key == MAX_KEY || m_user_defined_partitioning)
     {
       mask= copy_column_set(table->write_set);
@@ -3375,7 +3380,11 @@ int ha_ndbcluster::ndb_write_row(uchar *
                           m_ndb_record, (char *)row, mask);
   }
   else
+  {
+    /* Using insert, we write all user visible columns */
+    user_cols_written_bitmap= NULL;
     op= trans->insertTuple(m_ndb_record, (char *)row);
+  }
   if (!(op))
     ERR_RETURN(trans->getNdbError());
 
@@ -3388,7 +3397,8 @@ int ha_ndbcluster::ndb_write_row(uchar *
   if (table_share->blob_fields > 0)
   {
     my_bitmap_map *old_map= dbug_tmp_use_all_columns(table, table->read_set);
-    int res= set_blob_values(op, row - table->record[0], table->write_set,
&blob_count);
+    /* Set Blob values for all columns updated by the operation */
+    int res= set_blob_values(op, row - table->record[0], user_cols_written_bitmap,
&blob_count);
     dbug_tmp_restore_column_map(table->read_set, old_map);
     if (res != 0)
       ERR_RETURN(op->getNdbError());
Thread
bk commit into 5.1 tree (frazer:1.2685) BUG#30674Frazer Clement20 Nov