Question about Myrocks

File:ha_rocksdb.cc
Function:rocksdb_init_func
Code:
Rdb_hton_init_state::Scoped_lock state_lock(*rdb_get_hton_init_state(), true);
SHIP_ASSERT(!rdb_get_hton_init_state()->initialized());
Question:
Why add the above code? for what? Because the facebook myrocks source code does not have the above code.

There are many differences between Percona MyRocks and Facebook MyRocks and this is just one small one. Facebook MyRocks is ‘compiled in’ to Facebook MySQL and can not be unloaded as a plugin. Percona MyRocks can be unloaded and reloaded, although it is not suggested to do so. This is the result of a partial fix to try to prevent crashing on load/unload/load cycles, but there are still many problems in executing that sequence.

Thank you for your answer!!

in the Facebook MyRocks CMakeLists.txt, See the following:
MYSQL_ADD_PLUGIN(rocksdb_se ${ROCKSDB_SOURCES} STORAGE_ENGINE DEFAULT STATIC_ONLY LINK_LIBRARIES ${rocksdb_static_libs}

in the Percona MyRocks CMakeLists.txt, See the following:
MYSQL_ADD_PLUGIN(rocksdb ${ROCKSDB_SOURCES} STORAGE_ENGINE DEFAULT MODULE_ONLY LINK_LIBRARIES ${rocksdb_static_libs}

Facebook MyRocks is ‘compiled in’ to Facebook MySQL means that when compiling Facebook MyRocks to use STATIC_ONLY, Is that right?

Correct. Facebook MySQL 5.6.35 with MyRocks is intended to be used with MyRocks as the only transactional engine (no InnoDB present). Percona Server 5.7 and 8.0, MyRocks is an installable plugin that is not installed by default, only upon request.

Thank you very much for answering my questions. Thank you very much!

however I want to know :

  1. what the function of Rdb_hton_init_state::Scoped_lock in rocksdb_init_func or rocksdb_done_func?
  2. read the annotation of struct Rdb_hton_init_state :plus a reader-writer lock to protect it without serializing reads Does parallel reading occur?

[url][PS-3992] handle_fatal_signal (sig=11) in myrocks::Rdb_dict_manager::get_value when querying I_S when MyRocks is not loaded, but rocksdb_global_info is - Percona JIRA is the reason and explanation of why it exists, introduced in this commit [url]https://github.com/percona/percona-server/commit/c9383d615bd50787973518cc8929db4d4fc57086[/url]. It exists solely to serialize access to the knowledge of whether the MyRocks plugin is installed and initialized or not, primarily for the benefit of the MyRocks information_schema plugins.

I don’t know how to express my gratitude to you. Thank you very much.

Hope to communicate with more!

Glad to be of service.