Skip to content
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

PS-5562 : index_merge + partitioning + MyRocks crashes the server #3162

Merged
merged 1 commit into from
Apr 30, 2019

Conversation

satya-bodapati
Copy link
Contributor

Problem:

With native paritioning and index_merge, the native partition handler
is cloned.

One important point missed when fixing PS-5206 is that both the original
and clone share the parition_info object (m_part_info). It has bitmap of
partitions read and used.

The cloned handler, which has reference to the shared to partition_info
object, resets the partition bitmap during creation. This causes problem
during the actual index scan.

Fix:

  1. Create context to identify if the native partition handler creation is
    from clone or brand new.

  2. When it is clone, do not reset the partition bitmaps (i.e avoid calling
    m_part_info->set_partition_bitmaps()). This is the core fix.

  3. Additionally, we fix the cloned object creation to use clone mem_root
    instead of TABLE*->mem_root. Optimizer can destroy the cloned handler
    immediately after its use. (See QUICK_RANGE_SELECT::~QUICK_RANGE_SELECT).

@satya-bodapati
Copy link
Contributor Author

8.0 version will have testcase because the optimizer hint to force /*+ INDEX_MERGE */ is introduced only in 8.0. This is not present in 5.7.

To reproduce the crash, we need native partitioning + index_merge + only a subset of partitions should be used for query. Tried for two days before giving up.

8.0 version has simple testcase.

@satya-bodapati satya-bodapati force-pushed the PS-5.7-5562 branch 2 times, most recently from bdb5c71 to c01ad54 Compare April 30, 2019 04:16
@satya-bodapati
Copy link
Contributor Author

./mtr --mem --suite=tokudb.parts --parallel=4 --force --retry-failure=0|tee mtr.log
 93%] tokudb.parts.upgrade_from_prev_ver 'native-partitioning' w4 [ pass ]  13338
[ 94%] tokudb.parts.partition_float_tokudb 'native-partitioning' w4 [ pass ]   1185
[ 95%] tokudb.parts.partition_syntax_tokudb 'native-partitioning' w4 [ pass ]    165
[ 96%] tokudb.parts.partition_value_tokudb 'native-partitioning' w4 [ skipped ]  # CAST() in partitioning function is currently not supported.
[ 97%] tokudb.parts.partition_exchange_tokudb 'non-native-partitioning' w1 [ pass ]  40126
[ 98%] tokudb.parts.partition_exchange_tokudb 'native-partitioning' w2 [ pass ]  40175
[100%] tokudb.parts.partition_special_tokudb 'native-partitioning' w3 [ pass ]  27387
--------------------------------------------------------------------------
The servers were restarted 12 times
Spent 181.175 of 80 seconds executing testcases

Completed: All 55 tests were successful.

36 tests were skipped, 25 by the test itself.


===============================
./mtr --mem --suite=rocksdb --parallel=4 --force --retry-failure=0|tee mtr.log


[100%] rocksdb.autoinc_crash_safe_partition 'write_committed' w2 [ pass ]  80331
--------------------------------------------------------------------------
The servers were restarted 119 times
Spent 3606.150 of 1161 seconds executing testcases

Completed: Failed 5/495 tests, 98.99% were successful.

mysql-test-run: *** ERROR: there were failing test cases
Failing test(s): rocksdb.multi_con_read rocksdb.persistent_cache

@satya-bodapati
Copy link
Contributor Author

multi_con_read is result content mismatch. I hve recorded this as part of this commit.

Problem:
--------
With native paritioning and index_merge, the native partition handler
is cloned.

One important point missed when fixing PS-5206 is that both the original
and clone share the parition_info object (m_part_info). It has bitmap of
partitions read and used.

The cloned handler, which has reference to the shared to partition_info
object, resets the partition bitmap during creation. This causes problem
during the actual index scan.

Fix:
----
1. Create context to identify if the native partition handler creation is
from clone or brand new.

2. When it is clone, do not reset the partition bitmaps (i.e avoid calling
m_part_info->set_partition_bitmaps()). This is the core fix.

3. Additionally, we fix the cloned object creation to use clone mem_root
instead of TABLE->mem_root. Optimizer can destroy the cloned handler
immediately after its use. (See QUICK_RANGE_SELECT::~QUICK_RANGE_SELECT).
So the memory used by cloned handler objects is freed immediately at end
of query execution.
@satya-bodapati satya-bodapati merged commit 870bb92 into percona:5.7 Apr 30, 2019
@satya-bodapati satya-bodapati deleted the PS-5.7-5562 branch June 14, 2019 12:48
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