|
38 | 38 | #include "mysqld_error.h"
|
39 | 39 | #include "sql/dd/cache/multi_map_base.h"
|
40 | 40 | #include "sql/dd/dd_schema.h" // dd::Schema_MDL_locker
|
| 41 | +#include "sql/dd/dd_utility.h" |
41 | 42 | #include "sql/dd/impl/bootstrap/bootstrap_ctx.h" // bootstrap_stage
|
42 | 43 | #include "sql/dd/impl/cache/shared_dictionary_cache.h" // get(), release(), ...
|
43 | 44 | #include "sql/dd/impl/cache/storage_adapter.h" // store(), drop(), ...
|
@@ -1226,11 +1227,9 @@ bool Dictionary_client::acquire_uncached_uncommitted_impl(Object_id id,
|
1226 | 1227 | return false;
|
1227 | 1228 | }
|
1228 | 1229 |
|
1229 |
| - // Read the uncached dictionary object using ISO_READ_UNCOMMITTED |
1230 |
| - // isolation level. |
1231 | 1230 | const typename T::Cache_partition *stored_object = nullptr;
|
1232 | 1231 | bool error = Shared_dictionary_cache::instance()->get_uncached(
|
1233 |
| - m_thd, key, ISO_READ_UNCOMMITTED, &stored_object); |
| 1232 | + m_thd, key, get_dd_isolation_level(), &stored_object); |
1234 | 1233 | if (!error) {
|
1235 | 1234 | // Here, stored_object is a newly created instance, so we do not need to
|
1236 | 1235 | // clone() it, but we must delete it if dynamic cast fails.
|
@@ -1657,11 +1656,7 @@ static bool get_index_statistics_entries(
|
1657 | 1656 | THD *thd, const String_type &schema_name, const String_type &table_name,
|
1658 | 1657 | std::vector<String_type> &index_names,
|
1659 | 1658 | std::vector<String_type> &column_names) {
|
1660 |
| - /* |
1661 |
| - Use READ UNCOMMITTED isolation, so this method works correctly when |
1662 |
| - called from the middle of atomic ALTER TABLE statement. |
1663 |
| - */ |
1664 |
| - dd::Transaction_ro trx(thd, ISO_READ_UNCOMMITTED); |
| 1659 | + dd::Transaction_ro trx(thd, get_dd_isolation_level()); |
1665 | 1660 |
|
1666 | 1661 | // Open the DD tables holding dynamic table statistics.
|
1667 | 1662 | trx.otx.register_tables<dd::Table_stat>();
|
@@ -1734,11 +1729,7 @@ bool Dictionary_client::remove_table_dynamic_statistics(
|
1734 | 1729 | tables::Index_stats::create_object_key(schema_name, table_name,
|
1735 | 1730 | *it_idxs, *it_cols));
|
1736 | 1731 |
|
1737 |
| - /* |
1738 |
| - Use READ UNCOMMITTED isolation, so this method works correctly when |
1739 |
| - called from the middle of atomic ALTER TABLE statement. |
1740 |
| - */ |
1741 |
| - if (Storage_adapter::get(m_thd, *key, ISO_READ_UNCOMMITTED, false, |
| 1732 | + if (Storage_adapter::get(m_thd, *key, get_dd_isolation_level(), false, |
1742 | 1733 | &idx_stat)) {
|
1743 | 1734 | assert(m_thd->is_error() || m_thd->killed);
|
1744 | 1735 | return true;
|
@@ -1767,12 +1758,8 @@ bool Dictionary_client::remove_table_dynamic_statistics(
|
1767 | 1758 | std::unique_ptr<Table_stat::Name_key> key(
|
1768 | 1759 | tables::Table_stats::create_object_key(schema_name, table_name));
|
1769 | 1760 |
|
1770 |
| - /* |
1771 |
| - Use READ UNCOMMITTED isolation, so this method works correctly when |
1772 |
| - called from the middle of atomic ALTER TABLE statement. |
1773 |
| - */ |
1774 | 1761 | const Table_stat *tab_stat = nullptr;
|
1775 |
| - if (Storage_adapter::get(m_thd, *key, ISO_READ_UNCOMMITTED, false, |
| 1762 | + if (Storage_adapter::get(m_thd, *key, get_dd_isolation_level(), false, |
1776 | 1763 | &tab_stat)) {
|
1777 | 1764 | assert(m_thd->is_error() || m_thd->killed);
|
1778 | 1765 | return true;
|
@@ -2295,12 +2282,7 @@ template <typename T>
|
2295 | 2282 | bool Dictionary_client::fetch_referencing_views_object_id(
|
2296 | 2283 | const char *schema, const char *tbl_or_sf_name,
|
2297 | 2284 | std::vector<Object_id> *view_ids) const {
|
2298 |
| - /* |
2299 |
| - Use READ UNCOMMITTED isolation, so this method works correctly when |
2300 |
| - called from the middle of atomic DROP TABLE/DATABASE or |
2301 |
| - RENAME TABLE statements. |
2302 |
| - */ |
2303 |
| - dd::Transaction_ro trx(m_thd, ISO_READ_UNCOMMITTED); |
| 2285 | + dd::Transaction_ro trx(m_thd, get_dd_isolation_level()); |
2304 | 2286 |
|
2305 | 2287 | // Register View_table_usage/View_routine_usage.
|
2306 | 2288 | trx.otx.register_tables<T>();
|
@@ -2344,7 +2326,7 @@ bool Dictionary_client::fetch_fk_children_uncached(
|
2344 | 2326 | std::vector<String_type> *children_schemas,
|
2345 | 2327 | std::vector<String_type> *children_names) {
|
2346 | 2328 | dd::Transaction_ro trx(
|
2347 |
| - m_thd, uncommitted ? ISO_READ_UNCOMMITTED : ISO_READ_COMMITTED); |
| 2329 | + m_thd, uncommitted ? get_dd_isolation_level() : ISO_READ_COMMITTED); |
2348 | 2330 |
|
2349 | 2331 | trx.otx.register_tables<Foreign_key>();
|
2350 | 2332 | Raw_table *foreign_keys_table = trx.otx.get_table<Foreign_key>();
|
@@ -2823,7 +2805,7 @@ void Dictionary_client::remove_uncommitted_objects(
|
2823 | 2805 | DBUG_EVALUATE_IF("skip_dd_table_access_check", false, true)) {
|
2824 | 2806 | const typename T::Cache_partition *stored_object = nullptr;
|
2825 | 2807 | if (!Shared_dictionary_cache::instance()->get_uncached(
|
2826 |
| - m_thd, id_key, ISO_READ_UNCOMMITTED, &stored_object)) |
| 2808 | + m_thd, id_key, get_dd_isolation_level(), &stored_object)) |
2827 | 2809 | assert(stored_object == nullptr);
|
2828 | 2810 | }
|
2829 | 2811 |
|
|
0 commit comments