summaryrefslogtreecommitdiff
path: root/myisam
diff options
context:
space:
mode:
authorunknown <andrey@example.com>2006-12-01 23:11:44 +0100
committerunknown <andrey@example.com>2006-12-01 23:11:44 +0100
commit6b9d3ccb8bb3949df6ae95738634aa67a78b35bd (patch)
treeefbcd8182dc2ad90a10ac7681b291926ccc8192f /myisam
parente3a9d9493556d159a580d7e266770fcaf38c7343 (diff)
parenta9173ec999a04f8dc7aa4e6e373d776c6ddd3f0f (diff)
downloadmariadb-git-6b9d3ccb8bb3949df6ae95738634aa67a78b35bd.tar.gz
Merge ahristov@bk-internal.mysql.com:/home/bk/mysql-4.1-maint
into example.com:/work/bug24395-v2/my41 myisam/mi_open.c: Auto merged
Diffstat (limited to 'myisam')
-rw-r--r--myisam/mi_open.c21
1 files changed, 19 insertions, 2 deletions
diff --git a/myisam/mi_open.c b/myisam/mi_open.c
index 4cac19a24bd..4efe6f42d5e 100644
--- a/myisam/mi_open.c
+++ b/myisam/mi_open.c
@@ -1235,13 +1235,30 @@ int mi_enable_indexes(MI_INFO *info)
RETURN
0 indexes are not disabled
1 all indexes are disabled
- [2 non-unique indexes are disabled - NOT YET IMPLEMENTED]
+ 2 non-unique indexes are disabled
*/
int mi_indexes_are_disabled(MI_INFO *info)
{
MYISAM_SHARE *share= info->s;
- return (! share->state.key_map && share->base.keys);
+ /*
+ No keys or all are enabled. keys is the number of keys. Left shifted
+ gives us only one bit set. When decreased by one, gives us all all bits
+ up to this one set and it gets unset.
+ */
+ if (!share->base.keys ||
+ (share->state.key_map == (ULL(1) << share->base.keys) - ULL(1)))
+ return 0;
+
+ /* All are disabled */
+ if (!share->state.key_map)
+ return 1;
+
+ /*
+ We have keys. Some enabled, some disabled.
+ Don't check for any non-unique disabled but return directly 2
+ */
+ return 2;
}