summaryrefslogtreecommitdiff
path: root/storage/perfschema
Commit message (Collapse)AuthorAgeFilesLines
* Merge 10.11 into 11.0Marko Mäkelä2023-03-292-28/+23
|\
| * Merge 10.10 into 10.11Marko Mäkelä2023-03-291-27/+22
| |\
| | * MDEV-26071: rpl.rpl_perfschema_applier_status_by_worker failed in bb …Andrei2023-03-241-27/+22
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | …with: Test assertion failed Problem: ======= Assertion text: 'Value returned by SSS and PS table for Last_Error_Number should be same.' Assertion condition: '"1146" = "0"' Assertion condition, interpolated: '"1146" = "0"' Assertion result: '0' Analysis: ======== In parallel replication when slave is started the worker pool gets activated and it gets cleared when slave stops. Each time the worker pool gets activated a backup worker pool also gets created to store worker specific perforance schema information in case of errors. On error, all relevant information is copied from rpl_parallel_thread to rli and it gets cleared from thread. Then server waits for all workers to complete their work, during this stage performance schema table specific worker info is stored into the backup pool and finally the actual pool gets cleared. If users query the performance schema table to know the status of workers the information from backup pool will be used. The test simulates ER_NO_SUCH_TABLE error and verifies the worker information in pfs table. Test works fine if execution occurs in following order. Step 1. Error occurred 'worker information is copied to backup pool'. Step 2. handle_slave_sql invokes 'rpl_parallel_resize_pool_if_no_slaves' to deactivate worker pool, it marks the pool->count=0 Step 3. PFS table is queried, since actual pool is deactivated backup pool information is read. If the Step 3 happens prior to Step2 the pool is yet to be deactivated and the actual pool is read, which doesn't have any error details as they were cleared. Hence test ocasionally fails. Fix: === Upon error mark the back pool as being active so that if PFS table is quried since the backup pool is flagged as valid its information will be read, in case it is not flagged regular pool will be read. This work is one of the last pieces created by the late Sujatha Sivakumar.
| * | Fix trivial spelling errorsOtto Kekalainen2023-03-241-1/+1
| |/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | - agressively -> aggressively - exising -> existing - occured -> occurred - releated -> related - seperated -> separated - sucess -> success - use use -> use All new code of the whole pull request, including one or several files that are either new files or modified ones, are contributed under the BSD-new license. I am contributing on behalf of my employer Amazon Web Services, Inc.
* | Merge 10.11 into 11.0Marko Mäkelä2023-02-1655-213/+114
|\ \ | |/
| * Merge 10.5 into 10.6Marko Mäkelä2023-02-1055-213/+114
| |\
| | * Merge 10.4 into 10.5Marko Mäkelä2023-02-1055-213/+114
| | |\
| | | * Apply clang-tidy to remove empty constructors / destructorsVicențiu Ciorbaru2023-02-0955-212/+113
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch is the result of running run-clang-tidy -fix -header-filter=.* -checks='-*,modernize-use-equals-default' . Code style changes have been done on top. The result of this change leads to the following improvements: 1. Binary size reduction. * For a -DBUILD_CONFIG=mysql_release build, the binary size is reduced by ~400kb. * A raw -DCMAKE_BUILD_TYPE=Release reduces the binary size by ~1.4kb. 2. Compiler can better understand the intent of the code, thus it leads to more optimization possibilities. Additionally it enabled detecting unused variables that had an empty default constructor but not marked so explicitly. Particular change required following this patch in sql/opt_range.cc result_keys, an unused template class Bitmap now correctly issues unused variable warnings. Setting Bitmap template class constructor to default allows the compiler to identify that there are no side-effects when instantiating the class. Previously the compiler could not issue the warning as it assumed Bitmap class (being a template) would not be performing a NO-OP for its default constructor. This prevented the "unused variable warning".
* | | | Changing all cost calculation to be given in millisecondsMonty2023-02-021-2/+4
|/ / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This makes it easier to compare different costs and also allows the optimizer to optimizer different storage engines more reliably. - Added tests/check_costs.pl, a tool to verify optimizer cost calculations. - Most engine costs has been found with this program. All steps to calculate the new costs are documented in Docs/optimizer_costs.txt - User optimizer_cost variables are given in microseconds (as individual costs can be very small). Internally they are stored in ms. - Changed DISK_READ_COST (was DISK_SEEK_BASE_COST) from a hard disk cost (9 ms) to common SSD cost (400MB/sec). - Removed cost calculations for hard disks (rotation etc). - Changed the following handler functions to return IO_AND_CPU_COST. This makes it easy to apply different cost modifiers in ha_..time() functions for io and cpu costs. - scan_time() - rnd_pos_time() & rnd_pos_call_time() - keyread_time() - Enhanched keyread_time() to calculate the full cost of reading of a set of keys with a given number of ranges and optional number of blocks that need to be accessed. - Removed read_time() as keyread_time() + rnd_pos_time() can do the same thing and more. - Tuned cost for: heap, myisam, Aria, InnoDB, archive and MyRocks. Used heap table costs for json_table. The rest are using default engine costs. - Added the following new optimizer variables: - optimizer_disk_read_ratio - optimizer_disk_read_cost - optimizer_key_lookup_cost - optimizer_row_lookup_cost - optimizer_row_next_find_cost - optimizer_scan_cost - Moved all engine specific cost to OPTIMIZER_COSTS structure. - Changed costs to use 'records_out' instead of 'records_read' when recalculating costs. - Split optimizer_costs.h to optimizer_costs.h and optimizer_defaults.h. This allows one to change costs without having to compile a lot of files. - Updated costs for filter lookup. - Use a better cost estimate in best_extension_by_limited_search() for the sorting cost. - Fixed previous issues with 'filtered' explain column as we are now using 'records_out' (min rows seen for table) to calculate filtering. This greatly simplifies the filtering code in JOIN_TAB::save_explain_data(). This change caused a lot of queries to be optimized differently than before, which exposed different issues in the optimizer that needs to be fixed. These fixes are in the following commits. To not have to change the same test case over and over again, the changes in the test cases are done in a single commit after all the critical change sets are done. InnoDB changes: - Updated InnoDB to not divide big range cost with 2. - Added cost for InnoDB (innobase_update_optimizer_costs()). - Don't mark clustered primary key with HA_KEYREAD_ONLY. This will prevent that the optimizer is trying to use index-only scans on the clustered key. - Disabled ha_innobase::scan_time() and ha_innobase::read_time() and ha_innobase::rnd_pos_time() as the default engine cost functions now works good for InnoDB. Other things: - Added --show-query-costs (\Q) option to mysql.cc to show the query cost after each query (good when working with query costs). - Extended my_getopt with GET_ADJUSTED_VALUE which allows one to adjust the value that user is given. This is used to change cost from microseconds (user input) to milliseconds (what the server is internally using). - Added include/my_tracker.h ; Useful include file to quickly test costs of a function. - Use handler::set_table() in all places instead of 'table= arg'. - Added SHOW_OPTIMIZER_COSTS to sys variables. These are input and shown in microseconds for the user but stored as milliseconds. This is to make the numbers easier to read for the user (less pre-zeros). Implemented in 'Sys_var_optimizer_cost' class. - In test_quick_select() do not use index scans if 'no_keyread' is set for the table. This is what we do in other places of the server. - Added THD parameter to Unique::get_use_cost() and check_index_intersect_extension() and similar functions to be able to provide costs to called functions. - Changed 'records' to 'rows' in optimizer_trace. - Write more information to optimizer_trace. - Added INDEX_BLOCK_FILL_FACTOR_MUL (4) and INDEX_BLOCK_FILL_FACTOR_DIV (3) to calculate usage space of keys in b-trees. (Before we used numeric constants). - Removed code that assumed that b-trees has similar costs as binary trees. Replaced with engine calls that returns the cost. - Added Bitmap::find_first_bit() - Added timings to join_cache for ANALYZE table (patch by Sergei Petrunia). - Added records_init and records_after_filter to POSITION to remember more of what best_access_patch() calculates. - table_after_join_selectivity() changed to recalculate 'records_out' based on the new fields from best_access_patch() Bug fixes: - Some queries did not update last_query_cost (was 0). Fixed by moving setting thd->...last_query_cost in JOIN::optimize(). - Write '0' as number of rows for const tables with a matching row. Some internals: - Engine cost are stored in OPTIMIZER_COSTS structure. When a handlerton is created, we also created a new cost variable for the handlerton. We also create a new variable if the user changes a optimizer cost for a not yet loaded handlerton either with command line arguments or with SET @@global.engine.optimizer_cost_variable=xx. - There are 3 global OPTIMIZER_COSTS variables: default_optimizer_costs The default costs + changes from the command line without an engine specifier. heap_optimizer_costs Heap table costs, used for temporary tables tmp_table_optimizer_costs The cost for the default on disk internal temporary table (MyISAM or Aria) - The engine cost for a table is stored in table_share. To speed up accesses the handler has a pointer to this. The cost is copied to the table on first access. If one wants to change the cost one must first update the global engine cost and then do a FLUSH TABLES. This was done to be able to access the costs for an open table without any locks. - When a handlerton is created, the cost are updated the following way: See sql/keycaches.cc for details: - Use 'default_optimizer_costs' as a base - Call hton->update_optimizer_costs() to override with the engines default costs. - Override the costs that the user has specified for the engine. - One handler open, copy the engine cost from handlerton to TABLE_SHARE. - Call handler::update_optimizer_costs() to allow the engine to update cost for this particular table. - There are two costs stored in THD. These are copied to the handler when the table is used in a query: - optimizer_where_cost - optimizer_scan_setup_cost - Simply code in best_access_path() by storing all cost result in a structure. (Idea/Suggestion by Igor)
* | | Merge 10.5 into 10.6Marko Mäkelä2023-01-131-2/+2
|\ \ \ | |/ /
| * | Merge 10.4 into 10.5Marko Mäkelä2023-01-131-2/+2
| |\ \ | | |/
| | * Merge 10.3 into 10.4Marko Mäkelä2023-01-131-2/+2
| | |\
| | | * fix typoslilinjie2023-01-121-2/+2
| | | | | | | | | | | | | | | | Signed-off-by: lilinjie <lilinjie@uniontech.com>
* | | | Merge branch '10.5' into bb-10.6-releaseOleksandr Byelkin2022-08-03256-370/+1677
|\ \ \ \ | |/ / /
| * | | Merge branch 'merge-perfschema-5.7' into 10.5Oleksandr Byelkin2022-08-02256-370/+1676
| |\ \ \
| | * | | mysql-5.7.39Oleksandr Byelkin2022-07-29257-465/+1775
| | | | |
* | | | | MDEV-28836 fixupMarko Mäkelä2022-06-221-1/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | On GNU/Linux, even though the C11 aligned_alloc() appeared in GNU libc early on, some custom memory allocators did not implement it until recently. For example, before gperftools/gperftools@d406f2285390c402e824dd28e6992f7f890dcdf9 the free() in tcmalloc would fail to free memory that was returned by aligned_alloc(), because the latter would map to the built-in allocator of libc. The Linux specific memalign() has a similar interface and is safer to use, because it has been available for a longer time. For AddressSanitizer, we will use aligned_alloc() so that the constraint on size can be enforced. buf_tmp_reserve_compression_buf(): When HAVE_ALIGNED_ALLOC holds, round up the size to be an integer multiple of the alignment. pfs_malloc(): In the unit test stub, round up the size to be an integer multiple of the alignment.
* | | | | MDEV-28836: Memory alignment cleanupMarko Mäkelä2022-06-219-89/+25
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Table_cache_instance: Define the structure aligned at the CPU cache line, and remove a pad[] data member. Krunal Bauskar reported this to improve performance on ARMv8. aligned_malloc(): Wrapper for the Microsoft _aligned_malloc() and the ISO/IEC 9899:2011 <stdlib.h> aligned_alloc(). Note: The parameters are in the Microsoft order (size, alignment), opposite of aligned_alloc(alignment, size). Note: The standard defines that size must be an integer multiple of alignment. It is enforced by AddressSanitizer but not by GNU libc on Linux. aligned_free(): Wrapper for the Microsoft _aligned_free() and the standard free(). HAVE_ALIGNED_ALLOC: A new test. Unfortunately, support for aligned_alloc() may still be missing on some platforms. We will fall back to posix_memalign() for those cases. HAVE_MEMALIGN: Remove, along with any use of the nonstandard memalign(). PFS_ALIGNEMENT (sic): Removed; we will use CPU_LEVEL1_DCACHE_LINESIZE. PFS_ALIGNED: Defined using the C++11 keyword alignas. buf_pool_t::page_hash_table::create(), lock_sys_t::hash_table::create(): lock_sys_t::hash_table::resize(): Pad the allocation size to an integer multiple of the alignment. Reviewed by: Vladislav Vaintroub
* | | | | Merge branch '10.5' into 10.6Sergei Golubchik2022-05-101-1/+2
|\ \ \ \ \ | |/ / / /
| * | | | Merge branch 'merge-perfschema-5.7' into 10.5Oleksandr Byelkin2022-05-081-1/+2
| |\ \ \ \ | | |/ / /
| | * | | 5.7.38Oleksandr Byelkin2022-05-051-1/+2
| | | | |
* | | | | Merge 10.5 into 10.6Marko Mäkelä2022-03-291-0/+14
|\ \ \ \ \ | |/ / / /
| * | | | Merge 10.4 into 10.5Marko Mäkelä2022-03-291-0/+14
| |\ \ \ \ | | | |/ / | | |/| |
| | * | | Merge 10.3 into 10.4Marko Mäkelä2022-03-291-0/+14
| | |\ \ \ | | | | |/ | | | |/|
| | | * | Merge 10.2 into 10.3Marko Mäkelä2022-03-291-0/+14
| | | |\ \
| | | | * | MDEV-28091 PERFORMANCE_SCHEMA unit tests fail due to memory misalignmentMarko Mäkelä2022-03-161-0/+14
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Let us make the mocked-up pfs_malloc() return aligned memory, just like the actual implementation does.
* | | | | | Merge 10.5 into 10.6Marko Mäkelä2022-02-141-0/+4
|\ \ \ \ \ \ | |/ / / / /
| * | | | | MDEV-27804 Fails to build - perf schema - thread id of type uintptr_t ↵Samuel Thibault2022-02-111-0/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | requires header While building on GNU/Hurd and kfreebsd. On the C++ standard uintptr_t can be defined in <cstdint> ref: https://www.cplusplus.com/reference/cstdint/ Fixes: 0d44792a835128a83ff07f14dbbcdd621df9f7da
* | | | | | Merge branch '10.5' into 10.6Oleksandr Byelkin2022-02-03254-898/+898
|\ \ \ \ \ \ | |/ / / / /
| * | | | | Merge branch 'merge-perfschema-5.7' into 10.5Oleksandr Byelkin2022-01-28254-903/+903
| |\ \ \ \ \ | | | |_|_|/ | | |/| | |
| | * | | | 5.7.37Oleksandr Byelkin2022-01-252-4/+3
| | | | | |
| | * | | | 5.7.34Sergei Golubchik2021-05-03255-932/+932
| | | | | |
* | | | | | Merge 10.5 into 10.6Marko Mäkelä2022-01-041-1/+1
|\ \ \ \ \ \ | |/ / / / /
| * | | | | MDEV-27304 SHOW ... result columns are right-alignedSergei Golubchik2021-12-271-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | --version=value was setting sys_var::CONFIG (meaning, the value came from the config file), but the filename was left as NULL.
* | | | | | Merge 10.5 into 10.6Marko Mäkelä2021-11-255-55/+58
|\ \ \ \ \ \ | |/ / / / /
| * | | | | PFS_events_statements cleanup: Use offsetofMarko Mäkelä2021-11-245-55/+58
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The macro my_offsetof() performs pointer arithmetics that may be undefined behavior. As reported in MDEV-26272, it may cause clang -fsanitize=undefined to generate invalid memory references. struct PFS_events_statements: Convert to std::is_standard_layout by encapsulating the standard-layout struct PFS_events instead of deriving from it, so that the standard macro offsetof() can be used. PFS_events_statements::copy(): Renamed from copy_events_statements(). A cast to void* is now needed in memcpy() to avoid GCC -Wclass-memaccess "writing to an object ... leaves 64 bytes unchanged".
* | | | | | Merge 10.5 into 10.6Marko Mäkelä2021-09-161-1/+1
|\ \ \ \ \ \ | |/ / / / /
| * | | | | perfschema: use correct type for left shiftsSergei Golubchik2021-09-121-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | set_item() uses 1UL << bit, so is_set_item() must do the same. This fixes sporadic perfschema.show_aggregate failures (sporadic, because `bit` is the thread id, so depending on how many tests were run before perfschema.show_aggregate it can be above or below 32).
* | | | | | Merge 10.5 into 10.6Marko Mäkelä2021-09-1171-1174/+1174
|\ \ \ \ \ \ | |/ / / / /
| * | | | | Expand performance_schema tables definitions with column commentsVicențiu Ciorbaru2021-09-1024-315/+315
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Cover all columns that did not have comments. Adjust docs based off of MariaDB implementation.
| * | | | | MDEV-25325 built-in documentation for performance_schema tablesHaidong Ji2021-09-107-78/+78
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Improve documentation of performance_schema tables by appending COLUMN comments to tables. Additionally improve test coverage and update corresponding tests. This is part of the patch covering newer columns and tables in 10.5.
| * | | | | Merge remote-tracking branch 'upstream/10.4' into 10.5Vicențiu Ciorbaru2021-09-1044-795/+795
| |\ \ \ \ \ | | | |/ / / | | |/| | |
| | * | | | Merge remote-tracking branch 'upstream/10.3' into 10.4Vicențiu Ciorbaru2021-09-0944-795/+795
| | |\ \ \ \ | | | | |/ / | | | |/| |
| | | * | | Merge branch '10.2' into 10.3Vicențiu Ciorbaru2021-09-0744-795/+795
| | | |\ \ \ | | | | | |/ | | | | |/|
| | | | * | MDEV-25325 built-in documentation for performance_schema tablesHaidong Ji2021-09-0744-795/+795
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Improve documentation of performance_schema tables by appending COLUMN comments to tables. Additionally improve test coverage and update corresponding tests.
* | | | | | Merge 10.5 into 10.6Marko Mäkelä2021-08-311-3/+3
|\ \ \ \ \ \ | |/ / / / /
| * | | | | Merge 10.4 into 10.5Marko Mäkelä2021-08-311-3/+3
| |\ \ \ \ \ | | |/ / / /
| | * | | | Merge 10.3 into 10.4Marko Mäkelä2021-08-311-3/+3
| | |\ \ \ \ | | | |/ / /
| | | * | | Merge 10.2 into 10.3Marko Mäkelä2021-08-311-3/+3
| | | |\ \ \ | | | | |/ /
| | | | * | Fix GCC 11 -Wmaybe-uninitialized for PLUGIN_PERFSCHEMAMarko Mäkelä2021-08-301-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | init_mutex_v1_t: Stop lying that the mutex parameter is const. GCC 11.2.0 assumes that it is and could complain about any mysql_mutex_t being uninitialized even after mysql_mutex_init() as long as PLUGIN_PERFSCHEMA is enabled. init_rwlock_v1_t, init_cond_v1_t: Remove untruthful const qualifiers. Note: init_socket_v1_t is expecting that the socket fd has already been created before PSI_SOCKET_CALL(init_socket), and therefore that parameter really is being treated as a pointer to const.