Commit 4aab0588 authored by Sergei Golubchik's avatar Sergei Golubchik

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.
parent b2c8d55c
......@@ -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;
......
......@@ -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;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment