uint _mi_ft_convert_to_ft2(MI_INFO *info, uint keynr, uchar *key) { my_off_t root; DYNAMIC_ARRAY *da=info->ft1_to_ft2; MI_KEYDEF *keyinfo=&info->s->ft2_keyinfo; uchar *key_ptr= (uchar*) dynamic_array_ptr(da, 0), *end; uint length, key_length; DBUG_ENTER("_mi_ft_convert_to_ft2"); /* we'll generate one pageful at once, and insert the rest one-by-one */ /* calculating the length of this page ...*/ length=(keyinfo->block_length-2) / keyinfo->keylength; set_if_smaller(length, da->elements); length=length * keyinfo->keylength; get_key_full_length_rdonly(key_length, key); while (_mi_ck_delete(info, keynr, key, key_length) == 0) { /* nothing to do here. _mi_ck_delete() will populate info->ft1_to_ft2 with deleted keys */ } /* creating pageful of keys */ mi_putint(info->buff,length+2,0); memcpy(info->buff+2, key_ptr, length); info->buff_used=info->page_changed=1; /* info->buff is used */ if ((root= _mi_new(info,keyinfo,DFLT_INIT_HITS)) == HA_OFFSET_ERROR || _mi_write_keypage(info,keyinfo,root,DFLT_INIT_HITS,info->buff)) DBUG_RETURN(-1); /* inserting the rest of key values */ end= (uchar*) dynamic_array_ptr(da, da->elements); for (key_ptr+=length; key_ptr < end; key_ptr+=keyinfo->keylength) if(_mi_ck_real_write_btree(info, keyinfo, key_ptr, 0, &root, SEARCH_SAME)) DBUG_RETURN(-1); /* now, writing the word key entry */ ft_intXstore(key+key_length, - (int) da->elements); _mi_dpointer(info, key+key_length+HA_FT_WLEN, root); DBUG_RETURN(_mi_ck_real_write_btree(info, info->s->keyinfo+keynr, key, 0, &info->s->state.key_root[keynr], SEARCH_SAME)); }
void _ma_unpin_all_pages(MARIA_HA *info, LSN undo_lsn) { MARIA_PINNED_PAGE *page_link= ((MARIA_PINNED_PAGE*) dynamic_array_ptr(&info->pinned_pages, 0)); MARIA_PINNED_PAGE *pinned_page= page_link + info->pinned_pages.elements; DBUG_ENTER("_ma_unpin_all_pages"); DBUG_PRINT("info", ("undo_lsn: %lu", (ulong) undo_lsn)); if (!info->s->now_transactional) DBUG_ASSERT(undo_lsn == LSN_IMPOSSIBLE || maria_in_recovery); while (pinned_page-- != page_link) { /* Note this assert fails if we got a disk error or the record file is corrupted, which means we should have this enabled only in debug builds. */ #ifdef EXTRA_DEBUG DBUG_ASSERT((!pinned_page->changed || undo_lsn != LSN_IMPOSSIBLE || !info->s->now_transactional) || (info->s->state.changed & STATE_CRASHED_FLAGS)); #endif pagecache_unlock_by_link(info->s->pagecache, pinned_page->link, pinned_page->unlock, PAGECACHE_UNPIN, info->trn->rec_lsn, undo_lsn, pinned_page->changed, FALSE); } info->pinned_pages.elements= 0; DBUG_VOID_RETURN; }