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

ha_rocksdb.cc:6236: void myrocks::ha_rocksdb::set_use_read_free_rpl(const char*): Assertion `whitelist != nullptr' failed. #844

Closed
georgelorchpercona opened this issue May 29, 2018 · 2 comments

Comments

@georgelorchpercona
Copy link
Contributor

@georgelorchpercona georgelorchpercona commented May 29, 2018

Initially reported against Percona Server 5.7 but reproduced on fb-mysql-5.6.35 at commit aaa5660

Reduced test case:

CREATE DATABASE test;
USE test;
CREATE EVENT ev1 ON SCHEDULE EVERY 1 SECOND DO INSERT INTO t1 VALUES (1);
SET GLOBAL rocksdb_read_free_rpl_tables=NULL;
SET @@GLOBAL.event_scheduler=ON;
CREATE TABLE t1(c1 YEAR) ENGINE=ROCKSDB;

Call stack:

(gdb) bt
#0  0x00007ffff5ccac37 in __GI_raise (sig=sig@entry=6) at ../nptl/sysdeps/unix/sysv/linux/raise.c:56
#1  0x00007ffff5cce028 in __GI_abort () at abort.c:89
#2  0x00007ffff5cc3bf6 in __assert_fail_base (fmt=0x7ffff5e18018 "%s%s%s:%u: %s%sAssertion `%s' failed.\n%n",
    assertion=assertion@entry=0x1e2075c "whitelist != nullptr",
    file=file@entry=0x1e1bc40 "/home/glorch/dev/MYR/facebook-mysql/storage/rocksdb/ha_rocksdb.cc", line=line@entry=6236,
    function=function@entry=0x1e25e40 <myrocks::ha_rocksdb::set_use_read_free_rpl(char const*)::__PRETTY_FUNCTION__> "void myrocks::ha_rocksdb::set_use_read_free_rpl(const char*)") at assert.c:92
#3  0x00007ffff5cc3ca2 in __GI___assert_fail (assertion=0x1e2075c "whitelist != nullptr",
    file=0x1e1bc40 "/home/glorch/dev/MYR/facebook-mysql/storage/rocksdb/ha_rocksdb.cc", line=6236,
    function=0x1e25e40 <myrocks::ha_rocksdb::set_use_read_free_rpl(char const*)::__PRETTY_FUNCTION__> "void myrocks::ha_rocksdb::set_use_read_free_rpl(const char*)") at assert.c:101
#4  0x000000000136d674 in myrocks::ha_rocksdb::set_use_read_free_rpl (this=0x7fffc94abd10, whitelist=0x0)
    at /home/glorch/dev/MYR/facebook-mysql/storage/rocksdb/ha_rocksdb.cc:6236
#5  0x000000000136de35 in myrocks::ha_rocksdb::open (this=0x7fffc94abd10, name=0x7fffc94443b0 "./test/t1", mode=2,
    test_if_locked=2) at /home/glorch/dev/MYR/facebook-mysql/storage/rocksdb/ha_rocksdb.cc:6367
#6  0x0000000000df091b in handler::ha_open (this=0x7fffc94abd10, table_arg=0x7fffc9422c00, name=0x7fffc94443b0 "./test/t1",
    mode=2, test_if_locked=2) at /home/glorch/dev/MYR/facebook-mysql/sql/handler.cc:2827
#7  0x00000000010df3da in open_table_from_share (thd=0x7fffc907d000, share=0x7fffc9444010, alias=0x7fffc948ac28 "t1", db_stat=39,
    prgflag=44, ha_open_flags=0, outparam=0x7fffc9422c00, is_create_table=false)
    at /home/glorch/dev/MYR/facebook-mysql/sql/table.cc:2666
#8  0x0000000000f5823d in open_table (thd=0x7fffc907d000, table_list=0x7fffc9494010, ot_ctx=0x7ffff7ed84b0)
    at /home/glorch/dev/MYR/facebook-mysql/sql/sql_base.cc:3383
#9  0x0000000000f5a9b9 in open_and_process_table (thd=0x7fffc907d000, lex=0x7fffc9489890, tables=0x7fffc9494010,
    counter=0x7fffc9489940, flags=0, prelocking_strategy=0x7ffff7ed8530, has_prelocking_list=false, ot_ctx=0x7ffff7ed84b0)
    at /home/glorch/dev/MYR/facebook-mysql/sql/sql_base.cc:4945
#10 0x0000000000f5b68b in open_tables (thd=0x7fffc907d000, start=0x7ffff7ed8520, counter=0x7fffc9489940, flags=0,
    prelocking_strategy=0x7ffff7ed8530) at /home/glorch/dev/MYR/facebook-mysql/sql/sql_base.cc:5380
#11 0x0000000000f5c90f in open_normal_and_derived_tables (thd=0x7fffc907d000, tables=0x7fffc9494010, flags=0)
    at /home/glorch/dev/MYR/facebook-mysql/sql/sql_base.cc:6112
#12 0x0000000000fd2293 in mysql_insert (thd=0x7fffc907d000, table_list=0x7fffc9494010, fields=..., values_list=...,
    update_fields=..., update_values=..., duplic=DUP_ERROR, ignore=false)
    at /home/glorch/dev/MYR/facebook-mysql/sql/sql_insert.cc:695
#13 0x0000000000ffc74a in mysql_execute_command (thd=0x7fffc907d000, statement_start_time=0x7ffff7ed9ee8,
    post_parse=0x7ffff7ed9ef0) at /home/glorch/dev/MYR/facebook-mysql/sql/sql_parse.cc:4574
#14 0x00000000011eb23a in sp_instr_stmt::exec_core (this=0x7fffc948ad50, thd=0x7fffc907d000, nextp=0x7ffff7eda110)
    at /home/glorch/dev/MYR/facebook-mysql/sql/sp_instr.cc:941
#15 0x00000000011ea02b in sp_lex_instr::reset_lex_and_exec_core (this=0x7fffc948ad50, thd=0x7fffc907d000, nextp=0x7ffff7eda110,
    open_tables=false) at /home/glorch/dev/MYR/facebook-mysql/sql/sp_instr.cc:413
#16 0x00000000011eaa03 in sp_lex_instr::validate_lex_and_execute_core (this=0x7fffc948ad50, thd=0x7fffc907d000,
    nextp=0x7ffff7eda110, open_tables=false) at /home/glorch/dev/MYR/facebook-mysql/sql/sp_instr.cc:667
#17 0x00000000011eaf18 in sp_instr_stmt::execute (this=0x7fffc948ad50, thd=0x7fffc907d000, nextp=0x7ffff7eda110)
    at /home/glorch/dev/MYR/facebook-mysql/sql/sp_instr.cc:844
#18 0x0000000000f1cd67 in sp_head::execute (this=0x7fffc9489010, thd=0x7fffc907d000, merge_da_on_success=true)
    at /home/glorch/dev/MYR/facebook-mysql/sql/sp_head.cc:648
#19 0x0000000000f1ebd0 in sp_head::execute_procedure (this=0x7fffc9489010, thd=0x7fffc907d000, args=0x7ffff7eda530)
    at /home/glorch/dev/MYR/facebook-mysql/sql/sp_head.cc:1320
#20 0x0000000001113a66 in Event_job_data::execute (this=0x7ffff7edaa60, thd=0x7fffc907d000, drop=false)
    at /home/glorch/dev/MYR/facebook-mysql/sql/event_data_objects.cc:1442
#21 0x0000000001254d31 in Event_worker_thread::run (this=0x7ffff7edab6f, thd=0x7fffc907d000, event=0x7fffc9015070)
    at /home/glorch/dev/MYR/facebook-mysql/sql/event_scheduler.cc:325
#22 0x0000000001254b2f in event_worker_thread (arg=0x7fffc9015070)
    at /home/glorch/dev/MYR/facebook-mysql/sql/event_scheduler.cc:278
#23 0x0000000001b75693 in pfs_spawn_thread (arg=0x7fffc909e180)
    at /home/glorch/dev/MYR/facebook-mysql/storage/perfschema/pfs.cc:1860
#24 0x00007ffff6885184 in start_thread (arg=0x7ffff7edb700) at pthread_create.c:312
#25 0x00007ffff5d91ffd in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:111

The core issue is that the THD is that of an event handler thread, not a true client thread. This is a pseudo THD and not a full THD and is not fully populated with THDVARs, which leads to this code getting a nullptr for the value of rocksdb_read_free_rpl_tables:

 6366   /* Determine at open whether we can use Read Free Replication or not */
 6367   set_use_read_free_rpl(THDVAR(ha_thd(), read_free_rpl_tables));

Suggested fix would maybe be to check if nullptr is returned from THDVAR, then, if so, explicitly go get the global value as opposed to the session value. This same situation may be possible to hit from other actions and THDVARs throughout the code when the engine is invoked from event handler threads, so, perhaps even wrapping the call to THDVAR with this logic and replacing all direct uses of THDVAR with this new wrapper that has clearly defined behavior.

@asandryh asandryh self-assigned this Jul 24, 2018
@asandryh

This comment has been minimized.

Copy link

@asandryh asandryh commented Jul 24, 2018

#862

NULL is a valid value for rocksdb_read_free_rpl_tables. MyRocks should use the default value in this case.

facebook-github-bot added a commit that referenced this issue Nov 21, 2018
…887)

Summary:
It is valid for NULL to be passed in as an argument for
read_free_rpl_tables and skip_unique_check. Handle NULL arguments in
these functions by treating it as the default value.

Addresses #844
Pull Request resolved: #887

Differential Revision: D10392551

Pulled By: hermanlee

fbshipit-source-id: 18d2c0b
@georgelorchpercona

This comment has been minimized.

Copy link
Contributor Author

@georgelorchpercona georgelorchpercona commented Nov 28, 2018

Closed via #887

abhinav04sharma pushed a commit to abhinav04sharma/mysql-5.6 that referenced this issue Nov 29, 2018
…ree_rpl_tables

Summary:
It is valid for NULL to be passed in as an argument for
read_free_rpl_tables and skip_unique_check. Handle NULL arguments in
these functions by treating it as the default value.

Addresses facebook#844
Pull Request resolved: facebook#887
GitHub Author: Herman Lee <herman@fb.com>

Test Plan: mtr

Reviewers: svcscm

Reviewed By: svcscm

Subscribers: trunkagent, phabricatorlinter, webscalesql-eng@fb.com

Differential Revision: https://phabricator.intern.facebook.com/D10392551

Signature: 10392551:1542761303:e29d5d253a8d433eb45cb8ebc2e4949c078128c7
georgelorchpercona added a commit to georgelorchpercona/percona-server that referenced this issue Jan 9, 2019
…ercona#887)

Upstream commit ID : fb-mysql-5.6.35/274bad39f0c14aa4fbe5a90bcc320e9897a64e28
PS-5217 : Merge fb-prod201803

Summary:
It is valid for NULL to be passed in as an argument for
read_free_rpl_tables and skip_unique_check. Handle NULL arguments in
these functions by treating it as the default value.

Addresses facebook/mysql-5.6#844
Pull Request resolved: facebook/mysql-5.6#887

Differential Revision: D10392551

Pulled By: hermanlee

fbshipit-source-id: 18d2c0b2f7b
georgelorchpercona added a commit to georgelorchpercona/percona-server that referenced this issue Jan 9, 2019
…ercona#887)

Upstream commit ID : fb-mysql-5.6.35/274bad39f0c14aa4fbe5a90bcc320e9897a64e28
PS-5217 : Merge fb-prod201803

Summary:
It is valid for NULL to be passed in as an argument for
read_free_rpl_tables and skip_unique_check. Handle NULL arguments in
these functions by treating it as the default value.

Addresses facebook/mysql-5.6#844
Pull Request resolved: facebook/mysql-5.6#887

Differential Revision: D10392551

Pulled By: hermanlee

fbshipit-source-id: 18d2c0b2f7b
georgelorchpercona added a commit to georgelorchpercona/percona-server that referenced this issue Jan 10, 2019
…ercona#887)

Upstream commit ID : fb-mysql-5.6.35/274bad39f0c14aa4fbe5a90bcc320e9897a64e28
PS-5217 : Merge fb-prod201803

Summary:
It is valid for NULL to be passed in as an argument for
read_free_rpl_tables and skip_unique_check. Handle NULL arguments in
these functions by treating it as the default value.

Addresses facebook/mysql-5.6#844
Pull Request resolved: facebook/mysql-5.6#887

Differential Revision: D10392551

Pulled By: hermanlee

fbshipit-source-id: 18d2c0b2f7b
facebook-github-bot added a commit that referenced this issue Dec 23, 2019
…887)

Summary:
It is valid for NULL to be passed in as an argument for
read_free_rpl_tables and skip_unique_check. Handle NULL arguments in
these functions by treating it as the default value.

Addresses #844
Pull Request resolved: #887

Test Plan: mtr

Differential Revision: D10392551

Pulled By: hermanlee

fbshipit-source-id: 4ed384b94e0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants
You can’t perform that action at this time.