Skip to content

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

Closed
wants to merge 1 commit into from

Conversation

akopytov
Copy link

@akopytov akopytov commented Mar 1, 2017

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.

…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.
@mysql-oca-bot
Copy link

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."
Thanks

@akopytov
Copy link
Author

akopytov commented Mar 2, 2017

I confirm the code being submitted is offered under the terms of the OCA, and that I am authorized to contribute it.

@mysql-oca-bot
Copy link

Hi, thank you for your contribution. Your code has been assigned to an internal queue. Please follow
bug http://bugs.mysql.com/bug.php?id=81814 for updates.
Thanks

laurynas-biveinis added a commit to laurynas-biveinis/percona-server that referenced this pull request Apr 3, 2017
…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)
gunnarku pushed a commit to facebook/mysql-8.0 that referenced this pull request Jul 21, 2017
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
gunnarku pushed a commit to facebook/mysql-8.0 that referenced this pull request Jul 25, 2017
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
dbussink pushed a commit to planetscale/mysql-server that referenced this pull request Mar 6, 2024
dbussink pushed a commit to planetscale/mysql-server that referenced this pull request May 21, 2024
dbussink pushed a commit to planetscale/mysql-server that referenced this pull request May 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants