summaryrefslogtreecommitdiff
path: root/sql
diff options
context:
space:
mode:
authormonty@mysql.com <>2004-02-04 09:51:13 +0100
committermonty@mysql.com <>2004-02-04 09:51:13 +0100
commitf7e65a76209b5cdce45675e88ca96114e18eda98 (patch)
tree31e9a2d94fcf1da78736b366ca1865d44e704f2f /sql
parent5d7ffa49ec8f053e2436710435e50a45ee281a5b (diff)
downloadmariadb-git-f7e65a76209b5cdce45675e88ca96114e18eda98.tar.gz
Fixed problem with range optimization over overlapping ranges (#2448)
Diffstat (limited to 'sql')
-rw-r--r--sql/mysqld.cc1
-rw-r--r--sql/opt_range.cc19
2 files changed, 12 insertions, 8 deletions
diff --git a/sql/mysqld.cc b/sql/mysqld.cc
index b0ab59b49e6..68b6b153f5b 100644
--- a/sql/mysqld.cc
+++ b/sql/mysqld.cc
@@ -4747,7 +4747,6 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
berkeley_env_flags|= DB_TXN_NOSYNC;
else
berkeley_env_flags&= ~DB_TXN_NOSYNC;
- printf("berkeley_env_flags: %d, arg '%s'\n", berkeley_env_flags, argument);
break;
case OPT_BDB_NO_RECOVER:
berkeley_init_flags&= ~(DB_RECOVER);
diff --git a/sql/opt_range.cc b/sql/opt_range.cc
index bed1b52a79a..188d503b767 100644
--- a/sql/opt_range.cc
+++ b/sql/opt_range.cc
@@ -1710,6 +1710,8 @@ key_or(SEL_ARG *key1,SEL_ARG *key2)
return 0; // OOM
tmp->copy_max_to_min(&key);
tmp->increment_use_count(key1->use_count+1);
+ /* Increment key count as it may be used for next loop */
+ key.increment_use_count(1);
new_arg->next_key_part=key_or(tmp->next_key_part,key.next_key_part);
key1=key1->insert(new_arg);
break;
@@ -2708,15 +2710,18 @@ int QUICK_SELECT_DESC::get_next()
}
else
{
- /* Heikki changed Sept 11, 2002: since InnoDB does not store the cursor
- position if READ_KEY_EXACT is used to a primary key with all
- key columns specified, we must use below HA_READ_KEY_OR_NEXT,
- so that InnoDB stores the cursor position and is able to move
- the cursor one step backward after the search. */
+ /*
+ Heikki changed Sept 11, 2002: since InnoDB does not store the cursor
+ position if READ_KEY_EXACT is used to a primary key with all
+ key columns specified, we must use below HA_READ_KEY_OR_NEXT,
+ so that InnoDB stores the cursor position and is able to move
+ the cursor one step backward after the search. */
DBUG_ASSERT(range->flag & NEAR_MAX || range_reads_after_key(range));
- /* Note: even if max_key is only a prefix, HA_READ_AFTER_KEY will
- * do the right thing - go past all keys which match the prefix */
+ /*
+ Note: even if max_key is only a prefix, HA_READ_AFTER_KEY will
+ do the right thing - go past all keys which match the prefix
+ */
result=file->index_read(record, (byte*) range->max_key,
range->max_length,
((range->flag & NEAR_MAX) ?