|
|
|
@ -1172,11 +1172,13 @@ static void setup_key_functions(register MARIA_KEYDEF *keyinfo) |
|
|
|
Then calls _ma_state_info_write_sub(). |
|
|
|
|
|
|
|
@param share table |
|
|
|
@param pWrite bitmap: if 1 is set my_pwrite() is used otherwise |
|
|
|
my_write(); if 2 is set, info about keys is written |
|
|
|
(should only be needed after ALTER TABLE |
|
|
|
ENABLE/DISABLE KEYS, and REPAIR/OPTIMIZE); if 4 is |
|
|
|
set, MARIA_SHARE::intern_lock is taken. |
|
|
|
@param pWrite bitmap: if 1 (MA_STATE_INFO_WRITE_DONT_MOVE_OFFSET) |
|
|
|
is set my_pwrite() is used otherwise my_write(); |
|
|
|
if 2 (MA_STATE_INFO_WRITE_FULL_INFO) is set, info |
|
|
|
about keys is written (should only be needed |
|
|
|
after ALTER TABLE ENABLE/DISABLE KEYS, and |
|
|
|
REPAIR/OPTIMIZE); if 4 (MA_STATE_INFO_WRITE_LOCK) |
|
|
|
is set, MARIA_SHARE::intern_lock is taken. |
|
|
|
|
|
|
|
@return Operation status |
|
|
|
@retval 0 OK |
|
|
|
@ -1189,7 +1191,7 @@ uint _ma_state_info_write(MARIA_SHARE *share, uint pWrite) |
|
|
|
if (share->options & HA_OPTION_READ_ONLY_DATA) |
|
|
|
return 0; |
|
|
|
|
|
|
|
if (pWrite & 4) |
|
|
|
if (pWrite & MA_STATE_INFO_WRITE_LOCK) |
|
|
|
pthread_mutex_lock(&share->intern_lock); |
|
|
|
else if (maria_multi_threaded) |
|
|
|
{ |
|
|
|
@ -1208,7 +1210,7 @@ uint _ma_state_info_write(MARIA_SHARE *share, uint pWrite) |
|
|
|
LSN_IN_PARTS(share->state.is_of_horizon))); |
|
|
|
} |
|
|
|
res= _ma_state_info_write_sub(share->kfile.file, &share->state, pWrite); |
|
|
|
if (pWrite & 4) |
|
|
|
if (pWrite & MA_STATE_INFO_WRITE_LOCK) |
|
|
|
pthread_mutex_unlock(&share->intern_lock); |
|
|
|
share->changed= 0; |
|
|
|
return res; |
|
|
|
@ -1222,10 +1224,12 @@ uint _ma_state_info_write(MARIA_SHARE *share, uint pWrite) |
|
|
|
|
|
|
|
@param file descriptor of the index file to write |
|
|
|
@param state state information to write to the file |
|
|
|
@param pWrite bitmap: if 1 is set my_pwrite() is used otherwise |
|
|
|
my_write(); if 2 is set, info about keys is written |
|
|
|
(should only be needed after ALTER TABLE |
|
|
|
ENABLE/DISABLE KEYS, and REPAIR/OPTIMIZE). |
|
|
|
@param pWrite bitmap: if 1 (MA_STATE_INFO_WRITE_DONT_MOVE_OFFSET) |
|
|
|
is set my_pwrite() is used otherwise my_write(); |
|
|
|
if 2 (MA_STATE_INFO_WRITE_FULL_INFO) is set, info |
|
|
|
about keys is written (should only be needed |
|
|
|
after ALTER TABLE ENABLE/DISABLE KEYS, and |
|
|
|
REPAIR/OPTIMIZE). |
|
|
|
|
|
|
|
@notes |
|
|
|
For transactional multiuser tables, this function is called |
|
|
|
@ -1285,7 +1289,7 @@ uint _ma_state_info_write_sub(File file, MARIA_STATE_INFO *state, uint pWrite) |
|
|
|
mi_sizestore(ptr,state->key_root[i]); ptr+= 8; |
|
|
|
} |
|
|
|
mi_sizestore(ptr,state->key_del); ptr+= 8; |
|
|
|
if (pWrite & 2) /* From maria_chk */ |
|
|
|
if (pWrite & MA_STATE_INFO_WRITE_FULL_INFO) /* From maria_chk */ |
|
|
|
{ |
|
|
|
uint key_parts= mi_uint2korr(state->header.key_parts); |
|
|
|
mi_int4store(ptr,state->sec_index_changed); ptr+= 4; |
|
|
|
@ -1305,7 +1309,7 @@ uint _ma_state_info_write_sub(File file, MARIA_STATE_INFO *state, uint pWrite) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
res= (pWrite & 1) ? |
|
|
|
res= (pWrite & MA_STATE_INFO_WRITE_DONT_MOVE_OFFSET) ? |
|
|
|
my_pwrite(file, buff, (size_t) (ptr-buff), 0L, |
|
|
|
MYF(MY_NABP | MY_THREADSAFE)) : |
|
|
|
my_write(file, buff, (size_t) (ptr-buff), |
|
|
|
|