diff options
author | Sergei Golubchik <serg@mariadb.org> | 2016-10-11 16:10:47 +0200 |
---|---|---|
committer | Sergei Golubchik <serg@mariadb.org> | 2016-12-12 20:27:31 +0100 |
commit | 4aab0588541499d97ad1882ccb4481052dd2f62d (patch) | |
tree | bb6de1eceafdf8bdca0d71ecd6e7d68e2aeff12c /storage/myisam | |
parent | b2c8d55c228d560959a031d641959e86f0274c75 (diff) | |
download | mariadb-git-4aab0588541499d97ad1882ccb4481052dd2f62d.tar.gz |
cleanup: spatial indexes in MyISAM
In spatial indexes there can be only one keyseg.
Make it explicit in the code, don't pretend that this can work
with the arbitrary number of keysegs.
Diffstat (limited to 'storage/myisam')
-rw-r--r-- | storage/myisam/mi_create.c | 5 | ||||
-rw-r--r-- | storage/myisam/mi_open.c | 5 |
2 files changed, 6 insertions, 4 deletions
diff --git a/storage/myisam/mi_create.c b/storage/myisam/mi_create.c index 88b9da6f8a9..dbf2343c2a6 100644 --- a/storage/myisam/mi_create.c +++ b/storage/myisam/mi_create.c @@ -273,7 +273,7 @@ int mi_create(const char *name,uint keys,MI_KEYDEF *keydefs, so we only need to decrease keydef->keysegs. (see recreate_table() in mi_check.c) */ - keydef->keysegs-=sp_segs-1; + keydef->keysegs= 1; } for (j=0, keyseg=keydef->seg ; (int) j < keydef->keysegs ; @@ -287,7 +287,8 @@ int mi_create(const char *name,uint keys,MI_KEYDEF *keydefs, goto err_no_lock; } } - keydef->keysegs+=sp_segs; + DBUG_ASSERT(keydef->keysegs == 1); + keydef->keysegs= sp_segs + 1; key_length+=SPLEN*sp_segs; length++; /* At least one length byte */ min_key_length_skip+=SPLEN*2*SPDIMS; diff --git a/storage/myisam/mi_open.c b/storage/myisam/mi_open.c index b8cbefe6ac2..9c3a6bf5a2f 100644 --- a/storage/myisam/mi_open.c +++ b/storage/myisam/mi_open.c @@ -377,8 +377,9 @@ MI_INFO *mi_open(const char *name, int mode, uint open_flags) { #ifdef HAVE_SPATIAL uint sp_segs=SPDIMS*2; - share->keyinfo[i].seg=pos-sp_segs; - share->keyinfo[i].keysegs--; + share->keyinfo[i].seg= pos - sp_segs; + DBUG_ASSERT(share->keyinfo[i].keysegs == sp_segs + 1); + share->keyinfo[i].keysegs= sp_segs; #else my_errno=HA_ERR_UNSUPPORTED; goto err; |