MCPcopy Create free account
hub / github.com/MariaDB/server / ha_check

Method ha_check

sql/handler.cc:5685–5717  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

5683*/
5684
5685int handler::ha_check(THD *thd, HA_CHECK_OPT *check_opt)
5686{
5687 int error;
5688 DBUG_ASSERT(table_share->tmp_table != NO_TMP_TABLE ||
5689 m_lock_type != F_UNLCK);
5690
5691 if ((table->s->mysql_version >= MYSQL_VERSION_ID) &&
5692 (check_opt->sql_flags & TT_FOR_UPGRADE))
5693 return 0;
5694
5695 if (table->s->mysql_version < MYSQL_VERSION_ID)
5696 {
5697 error= ha_check_for_upgrade(check_opt);
5698 if (unlikely(error && (error != HA_ADMIN_NEEDS_CHECK)))
5699 return error;
5700 if (unlikely(!error && (check_opt->sql_flags & TT_FOR_UPGRADE)))
5701 return 0;
5702 }
5703 if (unlikely((error= check(thd, check_opt))))
5704 return error;
5705 for (uint i= table->s->keys; i < table->s->total_keys; i++)
5706 {
5707 DBUG_ASSERT(table->s->hlindexes() == 1);
5708 if (table->hlindex_open(i) || table->hlindex_lock(i))
5709 return HA_ADMIN_FAILED;
5710 if ((error= table->hlindex->file->check(thd, check_opt)))
5711 return error;
5712 }
5713 /* Skip updating frm version if not main handler. */
5714 if (table->file != this || opt_readonly)
5715 return error;
5716 return update_frm_version(table);
5717}
5718
5719/**
5720 A helper function to mark a transaction read-write,

Callers 2

handle_opt_partMethod · 0.80
wrapper_checkMethod · 0.80

Calls 6

checkFunction · 0.85
update_frm_versionFunction · 0.85
hlindexesMethod · 0.80
hlindex_openMethod · 0.80
hlindex_lockMethod · 0.80
checkMethod · 0.45

Tested by

no test coverage detected