YoushouldhavereceivedacopyoftheGNUGeneralPublicLicense alongwiththisprogram;ifnot,writetotheFreeSoftware
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA */
/* close an Aria table */ /* TODO: Weneedtohaveaseparatemutexontheclosedfiletoallowotherthreads toopenotherfilesduringthetimeweflushthecacheandclosethisfile
*/
/* Check that we have unlocked key delete-links properly */
DBUG_ASSERT(info->key_del_used == 0); /* Check that file is not part of any uncommitted transactions */
DBUG_ASSERT(info->trn == 0 || info->trn == &dummy_transaction_object);
DBUG_ASSERT(info->dfile.pagecache == info->s->kfile.pagecache);
/* pagecache can be 0 if we come here from maria_recreate_table */ if (share->reopen == 1 && share->pagecache)
{ /* Ifwearegoingtoclosethefile,flushpagecachewithout aglobalmutex
*/ if (flush_pagecache_blocks(share->pagecache, &share->kfile,
share->deleting ? FLUSH_IGNORE_CHANGED : FLUSH_RELEASE))
error= my_errno;
}
/* Ensure no one can open this file while we are closing it */ if (!internal_table)
mysql_mutex_lock(&THR_LOCK_maria); if (info->lock_type == F_EXTRA_LCK)
info->lock_type=F_UNLCK; /* HA_EXTRA_NO_USER_CHANGE */
if (info->lock_type != F_UNLCK)
{ if (maria_lock_database(info,F_UNLCK))
error=my_errno;
} if (!internal_table)
{
mysql_mutex_lock(&share->close_lock);
mysql_mutex_lock(&share->intern_lock);
}
if (share->options & HA_OPTION_READ_ONLY_DATA)
{
share->r_locks--;
share->tot_locks--;
} if (info->opt_flag & (READ_CACHE_USED | WRITE_CACHE_USED))
{ if (end_io_cache(&info->rec_cache))
error=my_errno;
info->opt_flag&= ~(READ_CACHE_USED | WRITE_CACHE_USED);
}
flag= !--share->reopen; if (!internal_table)
{
maria_open_list= list_delete(maria_open_list,&info->open_list);
share->open_list= list_delete(share->open_list, &info->share_list);
}
/* Ensure that we have stopped tracking of temporary files */
DBUG_ASSERT(share->track_data.file_size == 0);
DBUG_ASSERT(share->track_index.file_size == 0);
Wehavetounlockshare->intern_lockthenlockitafter LOCK_trn_list(trnman_lock())toavoiddeadlocks.
*/ if (!internal_table)
mysql_mutex_unlock(&share->intern_lock);
_ma_remove_not_visible_states_with_lock(share, TRUE); if (!internal_table)
mysql_mutex_lock(&share->intern_lock);
if (share->in_checkpoint & MARIA_CHECKPOINT_LOOKS_AT_ME)
{ /* we cannot my_free() the share, Checkpoint would see a bad pointer */
share->in_checkpoint|= MARIA_CHECKPOINT_SHOULD_FREE_ME;
}
if (share->state_history)
{ if (share->state_history->trid) /* If not visible for all */
{
MARIA_STATE_HISTORY_CLOSED *history;
DBUG_PRINT("info", ("Storing state history")); /* Hereweignoretheunlikelycasethatwedon'thavememory tostorethestate.Intheworstcasewhathappensisthat anytransactionthattriestoaccessthistablewillgeta wrongstatusinformation.
*/ if ((history= (MARIA_STATE_HISTORY_CLOSED *)
my_malloc(PSI_INSTRUMENT_ME, sizeof(*history), MYF(MY_WME))))
{
history->create_rename_lsn= share->state.create_rename_lsn;
history->state_history= share->state_history; if (my_hash_insert(&maria_stored_state, (uchar*) history))
my_free(history);
}
} else
my_free(share->state_history); /* Marker for concurrent checkpoint */
share->state_history= 0;
}
} if (!internal_table)
{
mysql_mutex_unlock(&THR_LOCK_maria);
mysql_mutex_unlock(&share->close_lock);
}
/* free_maria_share will free share->internal_lock */
free_maria_share(share);
my_free(info->ftparser_param); if (info->dfile.file >= 0 && ! info->s3)
{ /* Thisisoutsideofmutexsowouldconfuseaconcurrent Checkpoint.FortunatelyinBLOCK_RECORDwecloseearlierundermutex.
*/ if (mysql_file_close(info->dfile.file, MYF(0)))
error= my_errno;
}
delete_dynamic(&info->pinned_pages); #ifdef WITH_S3_STORAGE_ENGINE if (info->s3)
s3f.deinit(info->s3); #endif/* WITH_S3_STORAGE_ENGINE */
my_free(info);
if (error)
{
DBUG_PRINT("error", ("Got error on close: %d", my_errno));
DBUG_RETURN(my_errno= error);
}
DBUG_RETURN(0);
} /* maria_close */
void free_maria_share(MARIA_SHARE *share)
{ if (!share->internal_table)
mysql_mutex_assert_owner(&share->intern_lock);
if (!share->reopen && !share->in_trans &&
!(share->in_checkpoint & MARIA_CHECKPOINT_SHOULD_FREE_ME))
{ /* No one can access this share anymore, time to delete it ! */ if (!share->internal_table)
mysql_mutex_unlock(&share->intern_lock);
ma_crypt_free(share);
my_free(share->s3_path);
(void) mysql_mutex_destroy(&share->intern_lock);
(void) mysql_mutex_destroy(&share->close_lock);
(void) mysql_cond_destroy(&share->key_del_cond);
my_free(share); return;
} if (!share->internal_table)
mysql_mutex_unlock(&share->intern_lock); return;
}
Messung V0.5 in Prozent
¤ Dauer der Verarbeitung: 0.14 Sekunden
(vorverarbeitet am 2026-10-08)
¤
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.