1994
if (!entry->s || !entry->s->crashed)
1996
// Code below is for repairing a crashed cursor
1997
if ((error= lock_table_name(session, table_list, true)))
2001
if (wait_for_locked_table_names(session, table_list))
2003
unlock_table_name(table_list);
2007
pthread_mutex_unlock(&LOCK_open);
2008
session->clear_error(); // Clear error message
2010
if (open_table_from_share(session, share, alias,
2011
(uint32_t) (HA_OPEN_KEYFILE | HA_OPEN_RNDFILE |
2015
ha_open_options | HA_OPEN_FOR_REPAIR,
2016
entry) || ! entry->cursor)
2018
/* Give right error message */
2019
session->clear_error();
2020
my_error(ER_NOT_KEYFILE, MYF(0), share->table_name.str, my_errno);
2021
errmsg_printf(ERRMSG_LVL_ERROR, _("Couldn't repair table: %s.%s"), share->db.str,
2022
share->table_name.str);
2024
entry->closefrm(false);
2028
session->clear_error(); // Clear error message
2029
pthread_mutex_lock(&LOCK_open);
2030
unlock_table_name(table_list);
2038
If we are here, there was no fatal error (but error may be still
2041
if (unlikely(entry->cursor->implicit_emptied))
2043
ReplicationServices &replication_services= ReplicationServices::singleton();
2044
entry->cursor->implicit_emptied= 0;
2047
uint32_t query_buf_size= 20 + share->db.length + share->table_name.length +1;
2048
if ((query= (char*) malloc(query_buf_size)))
2051
"this DELETE FROM is needed even with row-based binlogging"
2053
We inherited this from MySQL. TODO: fix it to issue a propper truncate
2054
of the table (though that may not be completely right sematics).
2057
end+= sprintf(query, "DELETE FROM `%s`.`%s`", share->db.str,
2058
share->table_name.str);
2059
replication_services.rawStatement(session, query, (size_t)(end - query));
2064
errmsg_printf(ERRMSG_LVL_ERROR, _("When opening HEAP table, could not allocate memory "
2065
"to write 'DELETE FROM `%s`.`%s`' to replication"),
2066
table_list->db, table_list->table_name);
2067
my_error(ER_OUTOFMEMORY, MYF(0), query_buf_size);
2068
entry->closefrm(false);