Commit dfb219f6 authored by unknown's avatar unknown
Browse files

Merge svojtovich@bk-internal.mysql.com:/home/bk/mysql-5.0

into  april.(none):/home/svoj/devel/mysql/merge/mysql-5.0-engines


mysql-test/r/myisam.result:
  Auto merged
mysql-test/t/myisam.test:
  Auto merged
sql/ha_ndbcluster.cc:
  Auto merged
sql/opt_range.cc:
  Auto merged
sql/share/errmsg.txt:
  SCCS merged
parents 24cdd480 0509d3eb
Loading
Loading
Loading
Loading
+3 −1
Original line number Diff line number Diff line
@@ -357,8 +357,10 @@ enum ha_base_keytype {
#define HA_ERR_TABLE_DEF_CHANGED 159  /* The table changed in storage engine */
#define HA_ERR_TABLE_NEEDS_UPGRADE 160  /* The table changed in storage engine */
#define HA_ERR_TABLE_READONLY    161  /* The table is not writable */
#define HA_ERR_AUTOINC_READ_FAILED 162/* Failed to get the next autoinc value */
#define HA_ERR_AUTOINC_ERANGE    163  /* Failed to set the row autoinc value */

#define HA_ERR_LAST              161  /*Copy last error nr.*/
#define HA_ERR_LAST              163  /*Copy last error nr.*/
/* Add error numbers before HA_ERR_LAST and change it accordingly. */
#define HA_ERR_ERRORS            (HA_ERR_LAST - HA_ERR_FIRST + 1)

+14 −6
Original line number Diff line number Diff line
@@ -16,7 +16,7 @@

	/* Functions to compressed records */

#include "myisamdef.h"
#include "fulltext.h"

#define IS_CHAR ((uint) 32768)		/* Bit if char (not offset) in tree */

@@ -230,11 +230,19 @@ my_bool _mi_read_pack_info(MI_INFO *info, pbool fix_keys)
  {
    for (i=0 ; i < share->base.keys ; i++)
    {
      share->keyinfo[i].keylength+=(uint16) diff_length;
      share->keyinfo[i].minlength+=(uint16) diff_length;
      share->keyinfo[i].maxlength+=(uint16) diff_length;
      share->keyinfo[i].seg[share->keyinfo[i].keysegs].length=
	(uint16) rec_reflength;
      MI_KEYDEF *keyinfo= &share->keyinfo[i];
      keyinfo->keylength+= (uint16) diff_length;
      keyinfo->minlength+= (uint16) diff_length;
      keyinfo->maxlength+= (uint16) diff_length;
      keyinfo->seg[keyinfo->flag & HA_FULLTEXT ?
                   FT_SEGS : keyinfo->keysegs].length= (uint16) rec_reflength;
    }
    if (share->ft2_keyinfo.seg)
    {
      MI_KEYDEF *ft2_keyinfo= &share->ft2_keyinfo;
      ft2_keyinfo->keylength+= (uint16) diff_length;
      ft2_keyinfo->minlength+= (uint16) diff_length;
      ft2_keyinfo->maxlength+= (uint16) diff_length;
    }
  }

+34 −20
Original line number Diff line number Diff line
@@ -94,28 +94,42 @@ int mi_rkey(MI_INFO *info, byte *buf, int inx, const byte *key, uint key_len,
                    myisam_read_vec[search_flag], info->s->state.key_root[inx]))
    {
      /*
        If we are searching for an exact key (including the data pointer)
        and this was added by an concurrent insert,
        then the result is "key not found".
        If we searching for a partial key (or using >, >=, < or <=) and
        the data is outside of the data file, we need to continue searching
        for the first key inside the data file
      */
      if ((search_flag == HA_READ_KEY_EXACT) &&
          (info->lastpos >= info->state->data_file_length))
      if (info->lastpos >= info->state->data_file_length &&
          (search_flag != HA_READ_KEY_EXACT ||
           last_used_keyseg != keyinfo->seg + keyinfo->keysegs))
      {
        my_errno= HA_ERR_KEY_NOT_FOUND;
        info->lastpos= HA_OFFSET_ERROR;
      }
      else while (info->lastpos >= info->state->data_file_length)
        do
        {
          uint not_used[2];
          /*
            Skip rows that are inserted by other threads since we got a lock
            Note that this can only happen if we are not searching after an
	  exact key, because the keys are sorted according to position
            full length exact key, because the keys are sorted
            according to position
          */
          if  (_mi_search_next(info, keyinfo, info->lastkey,
                               info->lastkey_length,
                               myisam_readnext_vec[search_flag],
                               info->s->state.key_root[inx]))
            break;
          /*
            Check that the found key does still match the search.
            _mi_search_next() delivers the next key regardless of its
            value.
          */
          if (search_flag == HA_READ_KEY_EXACT &&
              ha_key_cmp(keyinfo->seg, key_buff, info->lastkey, use_key_length,
                         SEARCH_FIND, not_used))
          {
            my_errno= HA_ERR_KEY_NOT_FOUND;
            info->lastpos= HA_OFFSET_ERROR;
            break;
          }
        } while (info->lastpos >= info->state->data_file_length);
      }
    }
  }
+28 −0
Original line number Diff line number Diff line
#
# Test for strict-mode autoincrement
#

set @org_mode=@@sql_mode;
eval create table t1
(
  `a` tinyint(4) NOT NULL auto_increment,
  primary key (`a`)
) engine = $type ;
set @@sql_mode='strict_all_tables';
--error ER_WARN_DATA_OUT_OF_RANGE
insert into t1 values(1000);
select count(*) from t1;

set auto_increment_increment=1000;
set auto_increment_offset=700;
--error ER_WARN_DATA_OUT_OF_RANGE
insert into t1 values(null);
select count(*) from t1;

set @@sql_mode=@org_mode;
insert into t1 values(null);
select * from t1;

drop table t1;

# End of test
+31 −0
Original line number Diff line number Diff line
@@ -424,3 +424,34 @@ id select_type table type possible_keys key key_len ref rows Extra
1	SIMPLE	t3	index_merge	a,b	a,b	5,5	NULL	#	Using intersect(a,b); Using where
drop table t3;
drop table t0, t1, t2;
CREATE TABLE t1(a INT);
INSERT INTO t1 VALUES(1);
CREATE TABLE t2(a INT, b INT, dummy CHAR(16) DEFAULT '', KEY(a), KEY(b));
INSERT INTO t2(a,b) VALUES
(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),
(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),
(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),
(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),
(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),
(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),
(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),
(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),
(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),
(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),
(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),
(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),
(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),
(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),
(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),
(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),
(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),
(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),
(1,2);
LOCK TABLES t1 WRITE, t2 WRITE;
INSERT INTO t2(a,b) VALUES(1,2);
SELECT t2.a FROM t1,t2 WHERE t2.b=2 AND t2.a=1;
a
1
1
UNLOCK TABLES;
DROP TABLE t1, t2;
Loading