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
commitcf2e64dc2ef85aabfc4100a1c5072c09c83a0ddb (patch)
treeefbcd8182dc2ad90a10ac7681b291926ccc8192f /myisam
parent40c0948cc25490dcb897597a4104efc22556fd16 (diff)
parent610d12c54cafa2a8405234c5c0dc708dbc77562f (diff)
downloadmariadb-git-cf2e64dc2ef85aabfc4100a1c5072c09c83a0ddb.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;
}