Commit 3346feb8 authored by unknown's avatar unknown

Merge tulin@bk-internal.mysql.com:/home/bk/mysql-4.1

into poseidon.ndb.mysql.com:/home/tomas/mysql-5.0


mysql-test/r/fulltext.result:
  Auto merged
sql/item_func.cc:
  Auto merged
sql/item_sum.h:
  Auto merged
sql/table.cc:
  Auto merged
parents a0f2ecf7 20767681
...@@ -40,7 +40,7 @@ ...@@ -40,7 +40,7 @@
#endif #endif
const char *filename= "test3.MSI"; const char *filename= "test3";
uint tests=10,forks=10,key_cacheing=0,use_log=0; uint tests=10,forks=10,key_cacheing=0,use_log=0;
static void get_options(int argc, char *argv[]); static void get_options(int argc, char *argv[]);
...@@ -363,7 +363,7 @@ int test_write(MI_INFO *file,int id,int lock_type) ...@@ -363,7 +363,7 @@ int test_write(MI_INFO *file,int id,int lock_type)
} }
sprintf(record.id,"%7d",getpid()); sprintf(record.id,"%7d",getpid());
strmov(record.text,"Testing..."); strnmov(record.text,"Testing...", sizeof(record.text));
tries=(uint) rnd(100)+10; tries=(uint) rnd(100)+10;
for (i=count=0 ; i < tries ; i++) for (i=count=0 ; i < tries ; i++)
......
...@@ -165,12 +165,7 @@ err: ...@@ -165,12 +165,7 @@ err:
{ {
uint j; uint j;
for (j=0 ; j < share->base.keys ; j++) for (j=0 ; j < share->base.keys ; j++)
{ mi_flush_bulk_insert(info, j);
if (is_tree_inited(&info->bulk_insert[j]))
{
reset_tree(&info->bulk_insert[j]);
}
}
} }
info->errkey= (int) i; info->errkey= (int) i;
while ( i-- > 0) while ( i-- > 0)
...@@ -329,7 +324,7 @@ static int w_search(register MI_INFO *info, register MI_KEYDEF *keyinfo, ...@@ -329,7 +324,7 @@ static int w_search(register MI_INFO *info, register MI_KEYDEF *keyinfo,
uchar *temp_buff,*keypos; uchar *temp_buff,*keypos;
uchar keybuff[MI_MAX_KEY_BUFF]; uchar keybuff[MI_MAX_KEY_BUFF];
my_bool was_last_key; my_bool was_last_key;
my_off_t next_page; my_off_t next_page, dupp_key_pos;
DBUG_ENTER("w_search"); DBUG_ENTER("w_search");
DBUG_PRINT("enter",("page: %ld",page)); DBUG_PRINT("enter",("page: %ld",page));
...@@ -349,9 +344,9 @@ static int w_search(register MI_INFO *info, register MI_KEYDEF *keyinfo, ...@@ -349,9 +344,9 @@ static int w_search(register MI_INFO *info, register MI_KEYDEF *keyinfo,
/* get position to record with duplicated key */ /* get position to record with duplicated key */
tmp_key_length=(*keyinfo->get_key)(keyinfo,nod_flag,&keypos,keybuff); tmp_key_length=(*keyinfo->get_key)(keyinfo,nod_flag,&keypos,keybuff);
if (tmp_key_length) if (tmp_key_length)
info->dupp_key_pos=_mi_dpos(info,0,keybuff+tmp_key_length); dupp_key_pos=_mi_dpos(info,0,keybuff+tmp_key_length);
else else
info->dupp_key_pos= HA_OFFSET_ERROR; dupp_key_pos= HA_OFFSET_ERROR;
if (keyinfo->flag & HA_FULLTEXT) if (keyinfo->flag & HA_FULLTEXT)
{ {
uint off; uint off;
...@@ -370,7 +365,7 @@ static int w_search(register MI_INFO *info, register MI_KEYDEF *keyinfo, ...@@ -370,7 +365,7 @@ static int w_search(register MI_INFO *info, register MI_KEYDEF *keyinfo,
else else
{ {
/* popular word. two-level tree. going down */ /* popular word. two-level tree. going down */
my_off_t root=info->dupp_key_pos; my_off_t root=dupp_key_pos;
keyinfo=&info->s->ft2_keyinfo; keyinfo=&info->s->ft2_keyinfo;
get_key_full_length_rdonly(off, key); get_key_full_length_rdonly(off, key);
key+=off; key+=off;
...@@ -389,6 +384,7 @@ static int w_search(register MI_INFO *info, register MI_KEYDEF *keyinfo, ...@@ -389,6 +384,7 @@ static int w_search(register MI_INFO *info, register MI_KEYDEF *keyinfo,
} }
else /* not HA_FULLTEXT, normal HA_NOSAME key */ else /* not HA_FULLTEXT, normal HA_NOSAME key */
{ {
info->dupp_key_pos= dupp_key_pos;
my_afree((byte*) temp_buff); my_afree((byte*) temp_buff);
my_errno=HA_ERR_FOUND_DUPP_KEY; my_errno=HA_ERR_FOUND_DUPP_KEY;
DBUG_RETURN(-1); DBUG_RETURN(-1);
......
...@@ -399,3 +399,9 @@ select count(*) from t1; ...@@ -399,3 +399,9 @@ select count(*) from t1;
count(*) count(*)
1 1
drop table t1; drop table t1;
create table t1 (a int primary key, b text, fulltext(b));
create table t2 (a int, b text);
insert t1 values (1, "aaaa"), (2, "bbbb");
insert t2 values (10, "aaaa"), (2, "cccc");
replace t1 select * from t2;
drop table t1, t2;
...@@ -308,3 +308,16 @@ REPAIR TABLE t1; ...@@ -308,3 +308,16 @@ REPAIR TABLE t1;
select count(*) from t1; select count(*) from t1;
drop table t1; drop table t1;
#
# bug#6784
# mi_flush_bulk_insert (on dup key error in mi_write)
# was mangling info->dupp_key_pos
#
create table t1 (a int primary key, b text, fulltext(b));
create table t2 (a int, b text);
insert t1 values (1, "aaaa"), (2, "bbbb");
insert t2 values (10, "aaaa"), (2, "cccc");
replace t1 select * from t2;
drop table t1, t2;
...@@ -117,10 +117,9 @@ LogHandler::parseParams(const BaseString &_params) { ...@@ -117,10 +117,9 @@ LogHandler::parseParams(const BaseString &_params) {
_params.split(v_args, ","); _params.split(v_args, ",");
for(size_t i=0; i < v_args.size(); i++) { for(size_t i=0; i < v_args.size(); i++) {
Vector<BaseString> v_param_value; Vector<BaseString> v_param_value;
if(v_args[i].split(v_param_value, "=", 2) != 2)
v_args[i].split(v_param_value, "=", 2); ret = false;
if(v_param_value.size() == 2 && else if (!setParam(v_param_value[0], v_param_value[1]))
!setParam(v_param_value[0], v_param_value[1]))
ret = false; ret = false;
} }
......
...@@ -169,10 +169,13 @@ Logger::addHandler(const BaseString &logstring) { ...@@ -169,10 +169,13 @@ Logger::addHandler(const BaseString &logstring) {
size_t i; size_t i;
Vector<BaseString> logdest; Vector<BaseString> logdest;
Vector<LogHandler *>loghandlers; Vector<LogHandler *>loghandlers;
DBUG_ENTER("Logger::addHandler");
logstring.split(logdest, ";"); logstring.split(logdest, ";");
for(i = 0; i < logdest.size(); i++) { for(i = 0; i < logdest.size(); i++) {
DBUG_PRINT("info",("adding: %s",logdest[i]));
Vector<BaseString> v_type_args; Vector<BaseString> v_type_args;
logdest[i].split(v_type_args, ":", 2); logdest[i].split(v_type_args, ":", 2);
...@@ -191,16 +194,16 @@ Logger::addHandler(const BaseString &logstring) { ...@@ -191,16 +194,16 @@ Logger::addHandler(const BaseString &logstring) {
handler = new ConsoleLogHandler(); handler = new ConsoleLogHandler();
if(handler == NULL) if(handler == NULL)
return false; DBUG_RETURN(false);
if(!handler->parseParams(params)) if(!handler->parseParams(params))
return false; DBUG_RETURN(false);
loghandlers.push_back(handler); loghandlers.push_back(handler);
} }
for(i = 0; i < loghandlers.size(); i++) for(i = 0; i < loghandlers.size(); i++)
addHandler(loghandlers[i]); addHandler(loghandlers[i]);
return true; /* @todo handle errors */ DBUG_RETURN(true); /* @todo handle errors */
} }
bool bool
......
...@@ -8573,12 +8573,10 @@ Uint32 Dblqh::initScanrec(const ScanFragReq* scanFragReq) ...@@ -8573,12 +8573,10 @@ Uint32 Dblqh::initScanrec(const ScanFragReq* scanFragReq)
/** /**
* Used for scan take over * Used for scan take over
*/ */
{
FragrecordPtr tFragPtr; FragrecordPtr tFragPtr;
tFragPtr.i = fragptr.p->tableFragptr; tFragPtr.i = fragptr.p->tableFragptr;
ptrCheckGuard(tFragPtr, cfragrecFileSize, fragrecord); ptrCheckGuard(tFragPtr, cfragrecFileSize, fragrecord);
scanptr.p->fragPtrI = fragptr.p->tableFragptr; scanptr.p->fragPtrI = fragptr.p->tableFragptr;
}
/** /**
* !idx uses 1 - (MAX_PARALLEL_SCANS_PER_FRAG - 1) = 1-11 * !idx uses 1 - (MAX_PARALLEL_SCANS_PER_FRAG - 1) = 1-11
...@@ -8587,7 +8585,7 @@ Uint32 Dblqh::initScanrec(const ScanFragReq* scanFragReq) ...@@ -8587,7 +8585,7 @@ Uint32 Dblqh::initScanrec(const ScanFragReq* scanFragReq)
Uint32 start = (idx ? MAX_PARALLEL_SCANS_PER_FRAG : 1 ); Uint32 start = (idx ? MAX_PARALLEL_SCANS_PER_FRAG : 1 );
Uint32 stop = (idx ? MAX_PARALLEL_INDEX_SCANS_PER_FRAG : MAX_PARALLEL_SCANS_PER_FRAG - 1); Uint32 stop = (idx ? MAX_PARALLEL_INDEX_SCANS_PER_FRAG : MAX_PARALLEL_SCANS_PER_FRAG - 1);
stop += start; stop += start;
Uint32 free = fragptr.p->m_scanNumberMask.find(start); Uint32 free = tFragPtr.p->m_scanNumberMask.find(start);
if(free == Fragrecord::ScanNumberMask::NotFound || free >= stop){ if(free == Fragrecord::ScanNumberMask::NotFound || free >= stop){
jam(); jam();
...@@ -8607,9 +8605,8 @@ Uint32 Dblqh::initScanrec(const ScanFragReq* scanFragReq) ...@@ -8607,9 +8605,8 @@ Uint32 Dblqh::initScanrec(const ScanFragReq* scanFragReq)
return ZOK; return ZOK;
} }
scanptr.p->scanNumber = free; scanptr.p->scanNumber = free;
fragptr.p->m_scanNumberMask.clear(free);// Update mask tFragPtr.p->m_scanNumberMask.clear(free);// Update mask
LocalDLList<ScanRecord> active(c_scanRecordPool, fragptr.p->m_activeScans); LocalDLList<ScanRecord> active(c_scanRecordPool, fragptr.p->m_activeScans);
active.add(scanptr); active.add(scanptr);
...@@ -8693,8 +8690,12 @@ void Dblqh::finishScanrec(Signal* signal) ...@@ -8693,8 +8690,12 @@ void Dblqh::finishScanrec(Signal* signal)
LocalDLList<ScanRecord> scans(c_scanRecordPool, fragptr.p->m_activeScans); LocalDLList<ScanRecord> scans(c_scanRecordPool, fragptr.p->m_activeScans);
scans.release(scanptr); scans.release(scanptr);
FragrecordPtr tFragPtr;
tFragPtr.i = scanptr.p->fragPtrI;
ptrCheckGuard(tFragPtr, cfragrecFileSize, fragrecord);
const Uint32 scanNumber = scanptr.p->scanNumber; const Uint32 scanNumber = scanptr.p->scanNumber;
ndbrequire(!fragptr.p->m_scanNumberMask.get(scanNumber)); ndbrequire(!tFragPtr.p->m_scanNumberMask.get(scanNumber));
ScanRecordPtr restart; ScanRecordPtr restart;
/** /**
...@@ -8702,13 +8703,13 @@ void Dblqh::finishScanrec(Signal* signal) ...@@ -8702,13 +8703,13 @@ void Dblqh::finishScanrec(Signal* signal)
*/ */
if(scanNumber == NR_ScanNo || !queue.first(restart)){ if(scanNumber == NR_ScanNo || !queue.first(restart)){
jam(); jam();
fragptr.p->m_scanNumberMask.set(scanNumber); tFragPtr.p->m_scanNumberMask.set(scanNumber);
return; return;
} }
if(ERROR_INSERTED(5034)){ if(ERROR_INSERTED(5034)){
jam(); jam();
fragptr.p->m_scanNumberMask.set(scanNumber); tFragPtr.p->m_scanNumberMask.set(scanNumber);
return; return;
} }
......
...@@ -213,48 +213,41 @@ InitConfigFileParser::parseConfig(FILE * file) { ...@@ -213,48 +213,41 @@ InitConfigFileParser::parseConfig(FILE * file) {
// Parse Name-Value Pair // Parse Name-Value Pair
//**************************************************************************** //****************************************************************************
bool InitConfigFileParser::parseNameValuePair(Context& ctx, const char* line) { bool InitConfigFileParser::parseNameValuePair(Context& ctx, const char* line)
{
char tmpLine[MAX_LINE_LENGTH];
char fname[MAX_LINE_LENGTH], rest[MAX_LINE_LENGTH];
char* t;
const char *separator_list[]= {":", "=", 0};
const char *separator= 0;
if (ctx.m_currentSection == NULL){ if (ctx.m_currentSection == NULL){
ctx.reportError("Value specified outside section"); ctx.reportError("Value specified outside section");
return false; return false;
} }
strncpy(tmpLine, line, MAX_LINE_LENGTH);
// ************************************* // *************************************
// Check if a separator exists in line // Split string at first occurrence of
// '=' or ':'
// ************************************* // *************************************
for(int i= 0; separator_list[i] != 0; i++) {
if(strchr(tmpLine, separator_list[i][0])) {
separator= separator_list[i];
break;
}
}
if (separator == 0) { Vector<BaseString> tmp_string_split;
if (BaseString(line).split(tmp_string_split,
BaseString("=:"),
2) != 2)
{
ctx.reportError("Parse error"); ctx.reportError("Parse error");
return false; return false;
} }
// ******************************************* // *************************************
// Get pointer to substring before separator // Remove leading and trailing chars
// ******************************************* // *************************************
t = strtok(tmpLine, separator); {
for (int i = 0; i < 2; i++)
// ***************************************** tmp_string_split[i].trim("\r\n \t");
// Count number of tokens before separator
// *****************************************
if (sscanf(t, "%120s%120s", fname, rest) != 1) {
ctx.reportError("Multiple names before \'%c\'", separator[0]);
return false;
} }
// *************************************
// First in split is fname
// *************************************
const char *fname= tmp_string_split[0].c_str();
if (!ctx.m_currentInfo->contains(fname)) { if (!ctx.m_currentInfo->contains(fname)) {
ctx.reportError("[%s] Unknown parameter: %s", ctx.fname, fname); ctx.reportError("[%s] Unknown parameter: %s", ctx.fname, fname);
return false; return false;
...@@ -273,24 +266,11 @@ bool InitConfigFileParser::parseNameValuePair(Context& ctx, const char* line) { ...@@ -273,24 +266,11 @@ bool InitConfigFileParser::parseNameValuePair(Context& ctx, const char* line) {
} }
} }
// ******************************************
// Get pointer to substring after separator
// ******************************************
t = strtok(NULL, "\0");
if (t == NULL) {
ctx.reportError("No value for parameter");
return false;
}
// ******************************************
// Remove prefix and postfix spaces and tabs
// *******************************************
trim(t);
// *********************** // ***********************
// Store name-value pair // Store name-value pair
// *********************** // ***********************
return storeNameValuePair(ctx, fname, t);
return storeNameValuePair(ctx, fname, tmp_string_split[1].c_str());
} }
......
...@@ -1684,6 +1684,8 @@ longlong Item_func_bit_count::val_int() ...@@ -1684,6 +1684,8 @@ longlong Item_func_bit_count::val_int()
udf_handler::~udf_handler() udf_handler::~udf_handler()
{ {
if (!not_original)
{
if (initialized) if (initialized)
{ {
if (u_d->func_deinit != NULL) if (u_d->func_deinit != NULL)
...@@ -1696,6 +1698,7 @@ udf_handler::~udf_handler() ...@@ -1696,6 +1698,7 @@ udf_handler::~udf_handler()
} }
if (buffers) // Because of bug in ecc if (buffers) // Because of bug in ecc
delete [] buffers; delete [] buffers;
}
} }
......
...@@ -571,7 +571,7 @@ public: ...@@ -571,7 +571,7 @@ public:
:Item_sum( list ), udf(udf_arg) :Item_sum( list ), udf(udf_arg)
{ quick_group=0;} { quick_group=0;}
Item_udf_sum(THD *thd, Item_udf_sum *item) Item_udf_sum(THD *thd, Item_udf_sum *item)
:Item_sum(thd, item), udf(item->udf) {} :Item_sum(thd, item), udf(item->udf) { udf.not_original= TRUE; }
const char *func_name() const { return udf.name(); } const char *func_name() const { return udf.name(); }
bool fix_fields(THD *thd, TABLE_LIST *tables, Item **ref) bool fix_fields(THD *thd, TABLE_LIST *tables, Item **ref)
{ {
......
...@@ -56,8 +56,9 @@ class udf_handler :public Sql_alloc ...@@ -56,8 +56,9 @@ class udf_handler :public Sql_alloc
public: public:
table_map used_tables_cache; table_map used_tables_cache;
bool const_item_cache; bool const_item_cache;
bool not_original;
udf_handler(udf_func *udf_arg) :u_d(udf_arg), buffers(0), error(0), udf_handler(udf_func *udf_arg) :u_d(udf_arg), buffers(0), error(0),
is_null(0), initialized(0) is_null(0), initialized(0), not_original(0)
{} {}
~udf_handler(); ~udf_handler();
const char *name() const { return u_d ? u_d->name.str : "?"; } const char *name() const { return u_d ? u_d->name.str : "?"; }
......
...@@ -486,7 +486,26 @@ int openfrm(THD *thd, const char *name, const char *alias, uint db_stat, ...@@ -486,7 +486,26 @@ int openfrm(THD *thd, const char *name, const char *alias, uint db_stat,
/* old frm file */ /* old frm file */
field_type= (enum_field_types) f_packtype(pack_flag); field_type= (enum_field_types) f_packtype(pack_flag);
charset=f_is_binary(pack_flag) ? &my_charset_bin : outparam->table_charset; if (f_is_binary(pack_flag))
{
/*
Try to choose the best 4.1 type:
- for 4.0 "CHAR(N) BINARY" or "VARCHAR(N) BINARY"
try to find a binary collation for character set.
- for other types (e.g. BLOB) just use my_charset_bin.
*/
if (!f_is_blob(pack_flag))
{
// 3.23 or 4.0 string
if (!(charset= get_charset_by_csname(outparam->table_charset->csname,
MY_CS_BINSORT, MYF(0))))
charset= &my_charset_bin;
}
else
charset= &my_charset_bin;
}
else
charset= outparam->table_charset;
bzero((char*) &comment, sizeof(comment)); bzero((char*) &comment, sizeof(comment));
} }
*field_ptr=reg_field= *field_ptr=reg_field=
......
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