List:Commits« Previous MessageNext Message »
From:holyfoot Date:October 30 2006 8:57am
Subject:bk commit into 5.1 tree (holyfoot:1.2338) BUG#22451
View as plain text  
Below is the list of changes that have just been committed into a local
5.1 repository of hf. When hf 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, 2006-10-30 12:57:22+04:00, holyfoot@stripped +3 -0
  bug #22451 (Partitions: duplicate results with FEDERATED)
  
  We should not create PARTITION hton over FEDERATED engine table.
  Here i fix open_binary_frm to not create PARTITION hton if it's over
  FEDERATED.

  mysql-test/r/federated_partition.result@stripped, 2006-10-30 12:57:18+04:00, holyfoot@stripped +36 -0
    New BitKeeper file ``mysql-test/r/federated_partition.result''

  mysql-test/r/federated_partition.result@stripped, 2006-10-30 12:57:18+04:00, holyfoot@stripped +0 -0

  mysql-test/t/federated_partition.test@stripped, 2006-10-30 12:57:18+04:00, holyfoot@stripped +26 -0
    New BitKeeper file ``mysql-test/t/federated_partition.test''

  mysql-test/t/federated_partition.test@stripped, 2006-10-30 12:57:18+04:00, holyfoot@stripped +0 -0

  sql/table.cc@stripped, 2006-10-30 12:57:18+04:00, holyfoot@stripped +14 -6
    we don't create PARTITION hton over FEDERATED

# This is a BitKeeper patch.  What follows are the unified diffs for the
# set of deltas contained in the patch.  The rest of the patch, the part
# that BitKeeper cares about, is below these diffs.
# User:	holyfoot
# Host:	deer.(none)
# Root:	/home/hf/work/22451/my51

--- 1.249/sql/table.cc	2006-10-30 12:57:30 +04:00
+++ 1.250/sql/table.cc	2006-10-30 12:57:30 +04:00
@@ -451,14 +451,18 @@ static int open_binary_frm(THD *thd, TAB
   if (share->frm_version == FRM_VER_TRUE_VARCHAR -1 && head[33] == 5)
     share->frm_version= FRM_VER_TRUE_VARCHAR;
 
+  legacy_db_type= (enum legacy_db_type) (uint) *(head+3);
 #ifdef WITH_PARTITION_STORAGE_ENGINE
-  if (*(head+61) &&
-      !(share->default_part_db_type= 
-        ha_checktype(thd, (enum legacy_db_type) (uint) *(head+61), 1, 0)))
+  enum legacy_db_type partition_db_type=(enum legacy_db_type) (uint) *(head+61);
+  /* We don't create PARTITION handler over FEDERATED table */
+  if (partition_db_type == DB_TYPE_FEDERATED_DB)
+    legacy_db_type= partition_db_type;
+  else if (partition_db_type &&
+           !(share->default_part_db_type=
+               ha_checktype(thd, partition_db_type, 1,0)))
     goto err;
   DBUG_PRINT("info", ("default_part_db_type = %u", head[61]));
 #endif
-  legacy_db_type= (enum legacy_db_type) (uint) *(head+3);
   share->db_type= ha_checktype(thd, legacy_db_type, 0, 0);
   share->db_create_options= db_create_options= uint2korr(head+30);
   share->db_options_in_use= share->db_create_options;
@@ -629,7 +633,8 @@ static int open_binary_frm(THD *thd, TAB
 #ifdef WITH_PARTITION_STORAGE_ENGINE
       else
       {
-        if (!strncmp(next_chunk + 2, "partition", str_db_type_length))
+        if ((partition_db_type != DB_TYPE_FEDERATED_DB) &&
+            !strncmp(next_chunk + 2, "partition", str_db_type_length))
         {
           /* Use partition handler */
           share->db_type= partition_hton;
@@ -645,7 +650,10 @@ static int open_binary_frm(THD *thd, TAB
     {
       uint32 partition_info_len = uint4korr(next_chunk);
 #ifdef WITH_PARTITION_STORAGE_ENGINE
-      if ((share->partition_info_len= partition_info_len))
+      /* We don't create PARTITION hton over FEDERATED */
+      if (partition_db_type == DB_TYPE_FEDERATED_DB)
+        share->partition_info_len= 0;
+      else if ((share->partition_info_len= partition_info_len))
       {
         if (!(share->partition_info=
               (uchar*) memdup_root(&share->mem_root, next_chunk + 4,
--- New file ---
+++ mysql-test/r/federated_partition.result	06/10/30 12:57:18
stop slave;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
reset master;
reset slave;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
start slave;
stop slave;
DROP DATABASE IF EXISTS federated;
CREATE DATABASE federated;
DROP DATABASE IF EXISTS federated;
CREATE DATABASE federated;
DROP TABLE IF EXISTS federated.t1;
Warnings:
Note	1051	Unknown table 't1'
create table federated.t1 (s1 int) partition by list (s1) (partition p1 values in (1), partition p2 values in (2));
insert into federated.t1 values (1),(2);
select * from federated.t1;
s1
1
2
DROP TABLE IF EXISTS federated.t2;
Warnings:
Note	1051	Unknown table 't2'
create table federated.t2 (s1 int)
ENGINE="FEDERATED" DEFAULT CHARSET=latin1
CONNECTION='mysql://root@stripped:SLAVE_PORT/federated/t1'
  partition by list (s1) (partition p1 values in (1), partition p2 values in (2));
select * from federated.t2;
s1
1
2
drop table federated.t1;
DROP TABLE IF EXISTS federated.t1;
DROP DATABASE IF EXISTS federated;
DROP TABLE IF EXISTS federated.t1;
DROP DATABASE IF EXISTS federated;

--- New file ---
+++ mysql-test/t/federated_partition.test	06/10/30 12:57:18
# should work with embedded server after mysqltest is fixed
--source include/not_embedded.inc
--source include/have_partition.inc
--source include/federated.inc

connection slave;
DROP TABLE IF EXISTS federated.t1;
create table federated.t1 (s1 int) partition by list (s1) (partition p1 values in (1), partition p2 values in (2));
insert into federated.t1 values (1),(2);

select * from federated.t1;

connection master;
DROP TABLE IF EXISTS federated.t2;
--replace_result $SLAVE_MYPORT SLAVE_PORT
eval create table federated.t2 (s1 int)
  ENGINE="FEDERATED" DEFAULT CHARSET=latin1
  CONNECTION='mysql://root@stripped:$SLAVE_MYPORT/federated/t1'
  partition by list (s1) (partition p1 values in (1), partition p2 values in (2));

select * from federated.t2;

connection slave;
drop table federated.t1;

source include/federated_cleanup.inc;

Thread
bk commit into 5.1 tree (holyfoot:1.2338) BUG#22451holyfoot30 Oct