-
Notifications
You must be signed in to change notification settings - Fork 4.1k
Bug #81814: InnoDB adaptive hash index uses a bad partitioning algorithm for the real world #122
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
…thm for the real world This patch replaces hash-based AHI partitioning with index ID based one. Index ID based partitioning is better than the current bad hash function. It is also not any worse than any 'good' hash function for real world workloads. Adding space IDs would only make sense if index IDs were not guaranteed to be unique. They are unique in 5.7 and the current public release of 8.0.
Hi, thank you for your contribution. Please confirm this code is submitted under the terms of the OCA (Oracle's Contribution Agreement) you have previously signed by cutting and pasting the following text as a comment: |
I confirm the code being submitted is offered under the terms of the OCA, and that I am authorized to contribute it. |
Hi, thank you for your contribution. Your code has been assigned to an internal queue. Please follow |
…ioning algorithm for the real world) by applying a patch by Alexey Kopytov at mysql/mysql-server#122: Bug #81814: InnoDB adaptive hash index uses a bad partitioning algorithm for the real world This patch replaces hash-based AHI partitioning with index ID based one. Index ID based partitioning is better than the current bad hash function. It is also not any worse than any 'good' hash function for real world workloads. Adding space IDs would only make sense if index IDs were not guaranteed to be unique. They are unique in 5.7 and the current public release of 8.0. (cherry picked from commit d0fb95d1cbab6670b508145954e57a1fe3383885)
Summary: RocksDB has some static object dependencies, and without following dependencies, it hits SIGABRT. This diff has two fixes. 1. Updating RocksDB revision. D51789 in RocksDB changes the problematic mutex from global variable to local (function-level) static variable. 2. Changing MyRocks no to call ddl_manager.persist_stats() by kill_server_thread (which calls rocksdb_done_func()). By calling ddl_manager.persist_stats(), rocksdb::ThreadLocalPtr::StaticMeta::OnThreadExit() (which calls pthread_mutex_lock on "static port::Mutex mutex") is called at the end of the thread. On the other hand, there is a race between main thread and kill_server_thread. main thread calls pthread_mutex_destroy for the mutex. To guarantee not to call pthread_mutex_lock() after pthread_mutex_destroy(), it is necessary not to call ddl_manager.persist_stats() from kill_server_thread. This diff fixes the issue. @update-submodule: rocksdb Test Plan: mtr cardinality --repeat=100 Reviewers: hermanlee4, spetrunia, jkedgar Reviewed By: jkedgar Subscribers: yhchiang, webscalesql-eng Differential Revision: https://reviews.facebook.net/D51933
Summary: RocksDB has some static object dependencies, and without following dependencies, it hits SIGABRT. This diff has two fixes. 1. Updating RocksDB revision. D51789 in RocksDB changes the problematic mutex from global variable to local (function-level) static variable. 2. Changing MyRocks no to call ddl_manager.persist_stats() by kill_server_thread (which calls rocksdb_done_func()). By calling ddl_manager.persist_stats(), rocksdb::ThreadLocalPtr::StaticMeta::OnThreadExit() (which calls pthread_mutex_lock on "static port::Mutex mutex") is called at the end of the thread. On the other hand, there is a race between main thread and kill_server_thread. main thread calls pthread_mutex_destroy for the mutex. To guarantee not to call pthread_mutex_lock() after pthread_mutex_destroy(), it is necessary not to call ddl_manager.persist_stats() from kill_server_thread. This diff fixes the issue. @update-submodule: rocksdb Test Plan: mtr cardinality --repeat=100 Reviewers: hermanlee4, spetrunia, jkedgar Reviewed By: jkedgar Subscribers: yhchiang, webscalesql-eng Differential Revision: https://reviews.facebook.net/D51933
) (mysql#122) Signed-off-by: Shlomi Noach <[email protected]>
) (mysql#122) Signed-off-by: Shlomi Noach <[email protected]>
) (mysql#122) Signed-off-by: Shlomi Noach <[email protected]>
This patch replaces hash-based AHI partitioning with index ID based
one.
Index ID based partitioning is better than the current bad hash
function. It is also not any worse than any 'good' hash function for
real world workloads.
Adding space IDs would only make sense if index IDs were not guaranteed
to be unique. They are unique in 5.7 and the current public release of
8.0.