Commit 38949183 authored by serg@sergbook.mysql.com's avatar serg@sergbook.mysql.com

Merge bk-internal.mysql.com:/home/bk/mysql-5.1-new

into sergbook.mysql.com:/usr/home/serg/Abk/mysql-5.1
parents baba405c f15dde45
...@@ -750,7 +750,10 @@ dnl --------------------------------------------------------------------------- ...@@ -750,7 +750,10 @@ dnl ---------------------------------------------------------------------------
AC_DEFUN([_MYSQL_INCLUDE_LIST],[ AC_DEFUN([_MYSQL_INCLUDE_LIST],[
ifelse([$1], [], [], [ ifelse([$1], [], [], [
m4_define([__mysql_include__],[$1]) m4_define([__mysql_include__],[$1])
sinclude($1) dnl We have to use builtin(), because sinclude($1) generates an error
dnl "file $1 does not exists" in aclocal-1.8 - which is a bug, clearly
dnl violating m4 specs, and which is fixed in aclocal-1.9
builtin([include],$1)
m4_undefine([__mysql_include__]) m4_undefine([__mysql_include__])
_MYSQL_INCLUDE_LIST(m4_shift($@)) _MYSQL_INCLUDE_LIST(m4_shift($@))
]) ])
......
...@@ -340,7 +340,7 @@ enum ha_base_keytype { ...@@ -340,7 +340,7 @@ enum ha_base_keytype {
#define HA_ERR_WRONG_COMMAND 131 /* Command not supported */ #define HA_ERR_WRONG_COMMAND 131 /* Command not supported */
#define HA_ERR_OLD_FILE 132 /* old databasfile */ #define HA_ERR_OLD_FILE 132 /* old databasfile */
#define HA_ERR_NO_ACTIVE_RECORD 133 /* No record read in update() */ #define HA_ERR_NO_ACTIVE_RECORD 133 /* No record read in update() */
#define HA_ERR_RECORD_DELETED 134 /* Intern error-code */ #define HA_ERR_RECORD_DELETED 134 /* A record is not there */
#define HA_ERR_RECORD_FILE_FULL 135 /* No more room in file */ #define HA_ERR_RECORD_FILE_FULL 135 /* No more room in file */
#define HA_ERR_INDEX_FILE_FULL 136 /* No more room in file */ #define HA_ERR_INDEX_FILE_FULL 136 /* No more room in file */
#define HA_ERR_END_OF_FILE 137 /* end in next/prev/first/last */ #define HA_ERR_END_OF_FILE 137 /* end in next/prev/first/last */
......
...@@ -4306,7 +4306,8 @@ TRP_ROR_INTERSECT *get_best_covering_ror_intersect(PARAM *param, ...@@ -4306,7 +4306,8 @@ TRP_ROR_INTERSECT *get_best_covering_ror_intersect(PARAM *param,
DBUG_EXECUTE("info", print_ror_scans_arr(param->table, DBUG_EXECUTE("info", print_ror_scans_arr(param->table,
"building covering ROR-I", "building covering ROR-I",
ror_scan_mark, ror_scans_end);); ror_scan_mark, ror_scans_end););
do { do
{
/* /*
Update changed sorting info: Update changed sorting info:
#covered fields, #covered fields,
...@@ -7387,64 +7388,69 @@ int QUICK_ROR_INTERSECT_SELECT::get_next() ...@@ -7387,64 +7388,69 @@ int QUICK_ROR_INTERSECT_SELECT::get_next()
uint last_rowid_count=0; uint last_rowid_count=0;
DBUG_ENTER("QUICK_ROR_INTERSECT_SELECT::get_next"); DBUG_ENTER("QUICK_ROR_INTERSECT_SELECT::get_next");
/* Get a rowid for first quick and save it as a 'candidate' */ do
quick= quick_it++;
if (cpk_quick)
{ {
do { /* Get a rowid for first quick and save it as a 'candidate' */
quick= quick_it++;
if (cpk_quick)
{
do
{
error= quick->get_next();
}while (!error && !cpk_quick->row_in_ranges());
}
else
error= quick->get_next(); error= quick->get_next();
}while (!error && !cpk_quick->row_in_ranges());
}
else
error= quick->get_next();
if (error) if (error)
DBUG_RETURN(error); DBUG_RETURN(error);
quick->file->position(quick->record); quick->file->position(quick->record);
memcpy(last_rowid, quick->file->ref, head->file->ref_length); memcpy(last_rowid, quick->file->ref, head->file->ref_length);
last_rowid_count= 1; last_rowid_count= 1;
while (last_rowid_count < quick_selects.elements) while (last_rowid_count < quick_selects.elements)
{
if (!(quick= quick_it++))
{ {
quick_it.rewind(); if (!(quick= quick_it++))
quick= quick_it++; {
} quick_it.rewind();
quick= quick_it++;
do { }
if ((error= quick->get_next()))
DBUG_RETURN(error);
quick->file->position(quick->record);
cmp= head->file->cmp_ref(quick->file->ref, last_rowid);
} while (cmp < 0);
/* Ok, current select 'caught up' and returned ref >= cur_ref */ do
if (cmp > 0) {
{ if ((error= quick->get_next()))
/* Found a row with ref > cur_ref. Make it a new 'candidate' */ DBUG_RETURN(error);
if (cpk_quick) quick->file->position(quick->record);
cmp= head->file->cmp_ref(quick->file->ref, last_rowid);
} while (cmp < 0);
/* Ok, current select 'caught up' and returned ref >= cur_ref */
if (cmp > 0)
{ {
while (!cpk_quick->row_in_ranges()) /* Found a row with ref > cur_ref. Make it a new 'candidate' */
if (cpk_quick)
{ {
if ((error= quick->get_next())) while (!cpk_quick->row_in_ranges())
DBUG_RETURN(error); {
if ((error= quick->get_next()))
DBUG_RETURN(error);
}
} }
memcpy(last_rowid, quick->file->ref, head->file->ref_length);
last_rowid_count= 1;
}
else
{
/* current 'candidate' row confirmed by this select */
last_rowid_count++;
} }
memcpy(last_rowid, quick->file->ref, head->file->ref_length);
last_rowid_count= 1;
}
else
{
/* current 'candidate' row confirmed by this select */
last_rowid_count++;
} }
}
/* We get here iff we got the same row ref in all scans. */ /* We get here iff we got the same row ref in all scans. */
if (need_to_fetch_row) if (need_to_fetch_row)
error= head->file->rnd_pos(head->record[0], last_rowid); error= head->file->rnd_pos(head->record[0], last_rowid);
} while (error == HA_ERR_RECORD_DELETED);
DBUG_RETURN(error); DBUG_RETURN(error);
} }
...@@ -7473,41 +7479,44 @@ int QUICK_ROR_UNION_SELECT::get_next() ...@@ -7473,41 +7479,44 @@ int QUICK_ROR_UNION_SELECT::get_next()
do do
{ {
if (!queue.elements) do
DBUG_RETURN(HA_ERR_END_OF_FILE); {
/* Ok, we have a queue with >= 1 scans */ if (!queue.elements)
DBUG_RETURN(HA_ERR_END_OF_FILE);
/* Ok, we have a queue with >= 1 scans */
quick= (QUICK_SELECT_I*)queue_top(&queue); quick= (QUICK_SELECT_I*)queue_top(&queue);
memcpy(cur_rowid, quick->last_rowid, rowid_length); memcpy(cur_rowid, quick->last_rowid, rowid_length);
/* put into queue rowid from the same stream as top element */ /* put into queue rowid from the same stream as top element */
if ((error= quick->get_next())) if ((error= quick->get_next()))
{ {
if (error != HA_ERR_END_OF_FILE) if (error != HA_ERR_END_OF_FILE)
DBUG_RETURN(error); DBUG_RETURN(error);
queue_remove(&queue, 0); queue_remove(&queue, 0);
} }
else else
{ {
quick->save_last_pos(); quick->save_last_pos();
queue_replaced(&queue); queue_replaced(&queue);
} }
if (!have_prev_rowid) if (!have_prev_rowid)
{ {
/* No rows have been returned yet */ /* No rows have been returned yet */
dup_row= FALSE; dup_row= FALSE;
have_prev_rowid= TRUE; have_prev_rowid= TRUE;
} }
else else
dup_row= !head->file->cmp_ref(cur_rowid, prev_rowid); dup_row= !head->file->cmp_ref(cur_rowid, prev_rowid);
}while (dup_row); } while (dup_row);
tmp= cur_rowid; tmp= cur_rowid;
cur_rowid= prev_rowid; cur_rowid= prev_rowid;
prev_rowid= tmp; prev_rowid= tmp;
error= head->file->rnd_pos(quick->record, prev_rowid); error= head->file->rnd_pos(quick->record, prev_rowid);
} while (error == HA_ERR_RECORD_DELETED);
DBUG_RETURN(error); DBUG_RETURN(error);
} }
......
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