summaryrefslogtreecommitdiff
path: root/storage/myisam
diff options
context:
space:
mode:
authorpgalbraith@bk-internal.mysql.com <>2006-12-09 02:34:42 +0100
committerpgalbraith@bk-internal.mysql.com <>2006-12-09 02:34:42 +0100
commit23f0c6d7658de7a5c465d7afb66ae2f87d8ea96a (patch)
treea683748b700b98b6f378009228727821e369623b /storage/myisam
parent37f7e29db2ff83e2e4407d49f3d00d6575206f2e (diff)
parentc24381bdaaca307148888f2cf7c223570266c4f0 (diff)
downloadmariadb-git-23f0c6d7658de7a5c465d7afb66ae2f87d8ea96a.tar.gz
Merge bk-internal.mysql.com:/data0/bk/mysql-5.1
into bk-internal.mysql.com:/data0/bk/mysql-5.1-arch
Diffstat (limited to 'storage/myisam')
-rw-r--r--storage/myisam/mi_open.c21
-rw-r--r--storage/myisam/myisampack.c2
2 files changed, 21 insertions, 2 deletions
diff --git a/storage/myisam/mi_open.c b/storage/myisam/mi_open.c
index 010f7233c32..bc705a3bf7a 100644
--- a/storage/myisam/mi_open.c
+++ b/storage/myisam/mi_open.c
@@ -1282,13 +1282,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 (! mi_is_any_key_active(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 ||
+ (mi_is_all_keys_active(share->state.key_map, share->base.keys)))
+ return 0;
+
+ /* All are disabled */
+ if (mi_is_any_key_active(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;
}
diff --git a/storage/myisam/myisampack.c b/storage/myisam/myisampack.c
index d16821d3cda..2753ed5f7b2 100644
--- a/storage/myisam/myisampack.c
+++ b/storage/myisam/myisampack.c
@@ -2923,6 +2923,8 @@ static void flush_bits(void)
bits-= 8;
*file_buffer.pos++= (uchar) (bit_buffer >> bits);
}
+ if (file_buffer.pos >= file_buffer.end)
+ VOID(flush_buffer(~ (ulong) 0));
file_buffer.bits= BITS_SAVED;
file_buffer.bitbucket= 0;
}