diff options
Diffstat (limited to 'storage/innobase/handler/i_s.cc')
-rw-r--r-- | storage/innobase/handler/i_s.cc | 71 |
1 files changed, 34 insertions, 37 deletions
diff --git a/storage/innobase/handler/i_s.cc b/storage/innobase/handler/i_s.cc index 632fcebc2f6..d1728db68e9 100644 --- a/storage/innobase/handler/i_s.cc +++ b/storage/innobase/handler/i_s.cc @@ -6397,6 +6397,7 @@ i_s_sys_tables_fill_table_stats( } heap = mem_heap_create(1000); + rw_lock_s_lock(dict_operation_lock); mutex_enter(&dict_sys->mutex); mtr_start(&mtr); @@ -6405,7 +6406,6 @@ i_s_sys_tables_fill_table_stats( while (rec) { const char* err_msg; dict_table_t* table_rec; - ulint ref_count; /* Fetch the dict_table_t structure corresponding to this SYS_TABLES record */ @@ -6413,16 +6413,7 @@ i_s_sys_tables_fill_table_stats( heap, rec, &table_rec, DICT_TABLE_LOAD_FROM_CACHE, &mtr); - if (table_rec != NULL) { - ut_ad(err_msg == NULL); - - ref_count = table_rec->get_ref_count(); - - /* Protect the dict_table_t object by incrementing - the reference count. */ - table_rec->acquire(); - } - + ulint ref_count = table_rec ? table_rec->get_ref_count() : 0; mutex_exit(&dict_sys->mutex); DBUG_EXECUTE_IF("test_sys_tablestats", { @@ -6431,29 +6422,30 @@ i_s_sys_tables_fill_table_stats( }}); if (table_rec != NULL) { + ut_ad(err_msg == NULL); i_s_dict_fill_sys_tablestats(thd, table_rec, ref_count, tables->table); } else { + ut_ad(err_msg != NULL); push_warning_printf(thd, Sql_condition::WARN_LEVEL_WARN, ER_CANT_FIND_SYSTEM_REC, "%s", err_msg); } + rw_lock_s_unlock(dict_operation_lock); mem_heap_empty(heap); /* Get the next record */ + rw_lock_s_lock(dict_operation_lock); mutex_enter(&dict_sys->mutex); - if (table_rec != NULL) { - table_rec->release(); - } - mtr_start(&mtr); rec = dict_getnext_system(&pcur, &mtr); } mtr_commit(&mtr); mutex_exit(&dict_sys->mutex); + rw_lock_s_unlock(dict_operation_lock); mem_heap_free(heap); DBUG_RETURN(0); @@ -8009,18 +8001,16 @@ i_s_dict_fill_sys_tablespaces( ulint flags, /*!< in: tablespace flags */ TABLE* table_to_fill) /*!< in/out: fill this table */ { - Field** fields; - ulint atomic_blobs = FSP_FLAGS_HAS_ATOMIC_BLOBS(flags); - bool is_compressed = FSP_FLAGS_GET_ZIP_SSIZE(flags); - const char* row_format; - const page_size_t page_size(flags); - const char* space_type; + Field** fields; + ulint atomic_blobs = FSP_FLAGS_HAS_ATOMIC_BLOBS(flags); + const char* file_format; + const char* row_format; DBUG_ENTER("i_s_dict_fill_sys_tablespaces"); if (is_system_tablespace(space)) { - row_format = "Compact or Redundant"; - } else if (is_compressed) { + row_format = "Compact, Redundant or Dynamic"; + } else if (FSP_FLAGS_GET_ZIP_SSIZE(flags)) { row_format = "Compressed"; } else if (atomic_blobs) { row_format = "Dynamic"; @@ -8028,12 +8018,6 @@ i_s_dict_fill_sys_tablespaces( row_format = "Compact or Redundant"; } - if (is_system_tablespace(space)) { - space_type = "System"; - } else { - space_type = "Single"; - } - fields = table_to_fill->field; OK(fields[SYS_TABLESPACES_SPACE]->store(space, true)); @@ -8044,19 +8028,32 @@ i_s_dict_fill_sys_tablespaces( OK(field_store_string(fields[SYS_TABLESPACES_ROW_FORMAT], row_format)); + OK(field_store_string(fields[SYS_TABLESPACES_SPACE_TYPE], + is_system_tablespace(space) + ? "System" : "Single")); + + ulint cflags = fsp_flags_is_valid(flags, space) + ? flags : fsp_flags_convert_from_101(flags); + if (cflags == ULINT_UNDEFINED) { + fields[SYS_TABLESPACES_PAGE_SIZE]->set_null(); + fields[SYS_TABLESPACES_ZIP_PAGE_SIZE]->set_null(); + fields[SYS_TABLESPACES_FS_BLOCK_SIZE]->set_null(); + fields[SYS_TABLESPACES_FILE_SIZE]->set_null(); + fields[SYS_TABLESPACES_ALLOC_SIZE]->set_null(); + OK(schema_table_store_record(thd, table_to_fill)); + DBUG_RETURN(0); + } + + const page_size_t page_size(cflags); + OK(fields[SYS_TABLESPACES_PAGE_SIZE]->store( - univ_page_size.physical(), true)); + page_size.logical(), true)); OK(fields[SYS_TABLESPACES_ZIP_PAGE_SIZE]->store( - page_size.is_compressed() - ? page_size.physical() - : 0, true)); - - OK(field_store_string(fields[SYS_TABLESPACES_SPACE_TYPE], - space_type)); + page_size.physical(), true)); char* filepath = NULL; - if (FSP_FLAGS_HAS_DATA_DIR(flags)) { + if (FSP_FLAGS_HAS_DATA_DIR(cflags)) { mutex_enter(&dict_sys->mutex); filepath = dict_get_first_path(space); mutex_exit(&dict_sys->mutex); |