# Question about Myrocks

**URL:** <https://forums.percona.com/t/question-about-myrocks/6632>\
**Category:** Other MySQL® Questions\
**Created:** [October 15, 2018, 9:52pm UTC](https://forums.percona.com/t/question-about-myrocks/6632 "2018-10-15T21:52:00Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![fuzhiyu](https://avatars.discourse-cdn.com/v4/letter/f/90db22/32.png) [@fuzhiyu](https://forums.percona.com/u/fuzhiyu)\
**Post date:** [October 15, 2018, 9:52pm UTC](https://forums.percona.com/t/question-about-myrocks/6632/1 "2018-10-15T21:52:00Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![George\_Lorch](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.percona.com/george_lorch/32/1108_2.png) [@George\_Lorch](https://forums.percona.com/u/George_Lorch)\
**Post date:** [October 16, 2018, 8:07am UTC](https://forums.percona.com/t/question-about-myrocks/6632/2 "2018-10-16T08:07:21Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![fuzhiyu](https://avatars.discourse-cdn.com/v4/letter/f/90db22/32.png) [@fuzhiyu](https://forums.percona.com/u/fuzhiyu)\
**Post date:** [October 17, 2018, 1:12am UTC](https://forums.percona.com/t/question-about-myrocks/6632/3 "2018-10-17T01:12:51Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![George\_Lorch](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.percona.com/george_lorch/32/1108_2.png) [@George\_Lorch](https://forums.percona.com/u/George_Lorch)\
**Post date:** [October 17, 2018, 6:10am UTC](https://forums.percona.com/t/question-about-myrocks/6632/4 "2018-10-17T06:10:40Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![fuzhiyu](https://avatars.discourse-cdn.com/v4/letter/f/90db22/32.png) [@fuzhiyu](https://forums.percona.com/u/fuzhiyu)\
**Post date:** [October 17, 2018, 6:39am UTC](https://forums.percona.com/t/question-about-myrocks/6632/5 "2018-10-17T06:39:19Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![George\_Lorch](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.percona.com/george_lorch/32/1108_2.png) [@George\_Lorch](https://forums.percona.com/u/George_Lorch)\
**Post date:** [October 17, 2018, 10:10am UTC](https://forums.percona.com/t/question-about-myrocks/6632/6 "2018-10-17T10:10:54Z")

</div>

[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](https://jira.percona.com/browse/PS-3992%5B/url%5D) is the reason and explanation of why it exists, introduced in this commit [url][https://github.com/percona/percona-server/commit/c9383d615bd50787973518cc8929db4d4fc57086[/url]](https://github.com/percona/percona-server/commit/c9383d615bd50787973518cc8929db4d4fc57086%5B/url%5D). 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.

---

<div class="post-metadata">

**Author:** ![fuzhiyu](https://avatars.discourse-cdn.com/v4/letter/f/90db22/32.png) [@fuzhiyu](https://forums.percona.com/u/fuzhiyu)\
**Post date:** [October 17, 2018, 9:52pm UTC](https://forums.percona.com/t/question-about-myrocks/6632/7 "2018-10-17T21:52:46Z")

</div>

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

Hope to communicate with more！

---

<div class="post-metadata">

**Author:** ![George\_Lorch](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.percona.com/george_lorch/32/1108_2.png) [@George\_Lorch](https://forums.percona.com/u/George_Lorch)\
**Post date:** [October 18, 2018, 8:46am UTC](https://forums.percona.com/t/question-about-myrocks/6632/8 "2018-10-18T08:46:10Z")

</div>

Glad to be of service.
