Skip to content

using ThreadLocalPtr to hide ROCKSDB_SUPPORT_THREAD_LOCAL from public…#2380

Closed
lightmark wants to merge 5 commits intofacebook:masterfrom
lightmark:remove_ROCKSDB_SUPPORT_THREAD_LOCAL_in_public_headers
Closed

using ThreadLocalPtr to hide ROCKSDB_SUPPORT_THREAD_LOCAL from public…#2380
lightmark wants to merge 5 commits intofacebook:masterfrom
lightmark:remove_ROCKSDB_SUPPORT_THREAD_LOCAL_in_public_headers

Conversation

@lightmark
Copy link
Copy Markdown
Contributor

@lightmark lightmark commented May 27, 2017

… headers

#2199 should not reference RocksDB-specific macros (like ROCKSDB_SUPPORT_THREAD_LOCAL in this case) to public headers, iostats_context.h and perf_context.h. We shouldn't do that because users have to provide these compiler flags when building their binary with RocksDB.

We should hide the thread local global variable inside our implementation and just expose a function api to retrieve these variables. It may break some users for now but good for long term.

make check -j64

@igorcanadi
Copy link
Copy Markdown
Contributor

Thanks @lightmark , this will fix the problem, although it might be a bit disruptive, since it will cause any code that uses perf_context to stop compiling. To help out with the conversion, I'd add #define ROCKSDB_PERF_CONTEXT_FUNCTION, so that people can do

#ifdef ROCKSDB_PERF_CONTEXT_FUNCTION
GetPerfContext() something
#else
perf_context something
#endif

in their codebases.

An alternative would be to create a build-process-generated rocksdb-defs.h public header file that would be full of necessary#defines.

Copy link
Copy Markdown
Contributor

@siying siying left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I didn't see a modification of HISTORY.md. It is very important to mention the breaking interface change there.

#endif
// Get Thread-local PerfContext object pointer
// if defined(NPERF_CONTEXT), then the pointer is not thread-local
PerfContext* GetPerfContext();
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the naming convention is get_perf_context().

Copy link
Copy Markdown
Contributor Author

@lightmark lightmark May 30, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What do you think about @igorcanadi 's comment?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i think do it :), applications should be able to write code compatible across rocksdb minor versions

@facebook-github-bot
Copy link
Copy Markdown
Contributor

@lightmark updated the pull request - view changes

@facebook-github-bot
Copy link
Copy Markdown
Contributor

@lightmark updated the pull request - view changes

@facebook-github-bot
Copy link
Copy Markdown
Contributor

@lightmark updated the pull request - view changes

@lightmark
Copy link
Copy Markdown
Contributor Author

@igorcanadi What is the benefit of this MACRO over a version guard?

@facebook-github-bot
Copy link
Copy Markdown
Contributor

@lightmark updated the pull request - view changes

@igorcanadi
Copy link
Copy Markdown
Contributor

@igorcanadi What is the benefit of this MACRO over a version guard?

That works too. I actually think that the best solution would be to hack the build process to generate rocksdb-defines.h file. This is standard practice: https://cmake.org/cmake/help/v3.0/module/GenerateExportHeader.html

@lightmark
Copy link
Copy Markdown
Contributor Author

lightmark commented Jun 2, 2017

@igorcanadi Let me read. I am not a cmake expert :(
I think even we should generate a rocksdb-defines.h file, it'd better to make a new PR.

@facebook-github-bot
Copy link
Copy Markdown
Contributor

@lightmark has imported this pull request. If you are a Facebook employee, you can view this diff on Phabricator.

@lightmark lightmark mentioned this pull request Jun 5, 2017
facebook-github-bot pushed a commit that referenced this pull request Jun 26, 2017
Summary:
#2380 introduces a regression by replacing __thread with ThreadLocalPtr. Revert the thread local implementation back.
Closes #2485

Differential Revision: D5308050

Pulled By: lightmark

fbshipit-source-id: 2676e9c22edf76e8133d3f4c50e2711e11a95480
yiwu-arbug pushed a commit that referenced this pull request Jun 26, 2017
Summary:
#2380 introduces a regression by replacing __thread with ThreadLocalPtr. Revert the thread local implementation back.
Closes #2485

Differential Revision: D5308050

Pulled By: lightmark

fbshipit-source-id: 2676e9c22edf76e8133d3f4c50e2711e11a95480
facebook-github-bot pushed a commit to facebook/mysql-5.6 that referenced this pull request Jul 29, 2017
Summary:
The rocksdb PR
facebook/rocksdb#2485 reverted an implementation
of rocksdb perf and iostat counters to __thread from rocksdb::ThreadLocal. This
change was previously done by PR

facebook/rocksdb#2380

update-submodule: rocksdb

Reviewed By: alxyang

Differential Revision: D5520030

fbshipit-source-id: 2b20883
george-lorch pushed a commit to george-lorch/percona-server that referenced this pull request Sep 4, 2017
Upstream commit ID : fb-mysql-5.6.35/2e0ecaf5ce8cb4a1bb1debbe2269839d88de6f1d

Summary:
The rocksdb PR
facebook/rocksdb#2485 reverted an implementation
of rocksdb perf and iostat counters to __thread from rocksdb::ThreadLocal. This
change was previously done by PR

facebook/rocksdb#2380

update-submodule: rocksdb

Reviewed By: alxyang

Differential Revision: D5520030

fbshipit-source-id: 2b20883
george-lorch pushed a commit to george-lorch/percona-server that referenced this pull request Sep 4, 2017
Upstream commit ID : fb-mysql-5.6.35/2e0ecaf5ce8cb4a1bb1debbe2269839d88de6f1d

Summary:
The rocksdb PR
facebook/rocksdb#2485 reverted an implementation
of rocksdb perf and iostat counters to __thread from rocksdb::ThreadLocal. This
change was previously done by PR

facebook/rocksdb#2380

update-submodule: rocksdb

Reviewed By: alxyang

Differential Revision: D5520030

fbshipit-source-id: 2b20883
samcmuldroch pushed a commit to samcmuldroch/mysql-5.6 that referenced this pull request Sep 6, 2017
Summary:
The rocksdb PR
facebook/rocksdb#2485 reverted an implementation
of rocksdb perf and iostat counters to __thread from rocksdb::ThreadLocal. This
change was previously done by PR

facebook/rocksdb#2380

@update-submodule: rocksdb

Test Plan: sandcastle and make sure sysbench is back

Reviewers: alexyang

Reviewed By: alexyang

Subscribers: webscalesql-eng@fb.com

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

Signature: t1:5520030:1501275061:d8cca48eb4c82a7ed51e4a11f97947b996970ed5
george-lorch pushed a commit to george-lorch/percona-server that referenced this pull request Sep 7, 2017
Upstream commit ID : fb-mysql-5.6.35/2e0ecaf5ce8cb4a1bb1debbe2269839d88de6f1d

Summary:
The rocksdb PR
facebook/rocksdb#2485 reverted an implementation
of rocksdb perf and iostat counters to __thread from rocksdb::ThreadLocal. This
change was previously done by PR

facebook/rocksdb#2380

update-submodule: rocksdb

Reviewed By: alxyang

Differential Revision: D5520030

fbshipit-source-id: 2b20883
george-lorch pushed a commit to george-lorch/percona-server that referenced this pull request Sep 7, 2017
Upstream commit ID : fb-mysql-5.6.35/2e0ecaf5ce8cb4a1bb1debbe2269839d88de6f1d

Summary:
The rocksdb PR
facebook/rocksdb#2485 reverted an implementation
of rocksdb perf and iostat counters to __thread from rocksdb::ThreadLocal. This
change was previously done by PR

facebook/rocksdb#2380

update-submodule: rocksdb

Reviewed By: alxyang

Differential Revision: D5520030

fbshipit-source-id: 2b20883
george-lorch pushed a commit to george-lorch/percona-server that referenced this pull request Sep 7, 2017
Upstream commit ID : fb-mysql-5.6.35/2e0ecaf5ce8cb4a1bb1debbe2269839d88de6f1d

Summary:
The rocksdb PR
facebook/rocksdb#2485 reverted an implementation
of rocksdb perf and iostat counters to __thread from rocksdb::ThreadLocal. This
change was previously done by PR

facebook/rocksdb#2380

update-submodule: rocksdb

Reviewed By: alxyang

Differential Revision: D5520030

fbshipit-source-id: 2b20883
facebook-github-bot pushed a commit to facebook/mysql-5.6 that referenced this pull request Dec 23, 2019
Summary:
The rocksdb PR
facebook/rocksdb#2485 reverted an implementation
of rocksdb perf and iostat counters to __thread from rocksdb::ThreadLocal. This
change was previously done by PR

facebook/rocksdb#2380

update-submodule: rocksdb

Reviewed By: alxyang

Differential Revision: D5520030

fbshipit-source-id: 2d04833
inikep pushed a commit to inikep/mysql-5.6 that referenced this pull request Aug 12, 2020
Summary:
The rocksdb PR
facebook/rocksdb#2485 reverted an implementation
of rocksdb perf and iostat counters to __thread from rocksdb::ThreadLocal. This
change was previously done by PR

facebook/rocksdb#2380

update-submodule: rocksdb

Reviewed By: alxyang

Differential Revision: D5520030

fbshipit-source-id: 2d04833
inikep pushed a commit to inikep/mysql-5.6 that referenced this pull request Sep 9, 2020
Summary:
The rocksdb PR
facebook/rocksdb#2485 reverted an implementation
of rocksdb perf and iostat counters to __thread from rocksdb::ThreadLocal. This
change was previously done by PR

facebook/rocksdb#2380

update-submodule: rocksdb

Reviewed By: alxyang

Differential Revision: D5520030

fbshipit-source-id: 2d04833
inikep pushed a commit to inikep/mysql-5.6 that referenced this pull request Sep 16, 2020
Summary:
The rocksdb PR
facebook/rocksdb#2485 reverted an implementation
of rocksdb perf and iostat counters to __thread from rocksdb::ThreadLocal. This
change was previously done by PR

facebook/rocksdb#2380

update-submodule: rocksdb

Reviewed By: alxyang

Differential Revision: D5520030

fbshipit-source-id: 2d04833
inikep pushed a commit to inikep/mysql-5.6 that referenced this pull request Oct 5, 2020
Summary:
The rocksdb PR
facebook/rocksdb#2485 reverted an implementation
of rocksdb perf and iostat counters to __thread from rocksdb::ThreadLocal. This
change was previously done by PR

facebook/rocksdb#2380

update-submodule: rocksdb

Reviewed By: alxyang

Differential Revision: D5520030

fbshipit-source-id: 2d04833
inikep pushed a commit to inikep/mysql-5.6 that referenced this pull request Nov 11, 2020
Summary:
The rocksdb PR
facebook/rocksdb#2485 reverted an implementation
of rocksdb perf and iostat counters to __thread from rocksdb::ThreadLocal. This
change was previously done by PR

facebook/rocksdb#2380

update-submodule: rocksdb

Reviewed By: alxyang

Differential Revision: D5520030

fbshipit-source-id: 2d04833
facebook-github-bot pushed a commit to facebook/mysql-5.6 that referenced this pull request Mar 8, 2021
Summary:
The rocksdb PR
facebook/rocksdb#2485 reverted an implementation
of rocksdb perf and iostat counters to __thread from rocksdb::ThreadLocal. This
change was previously done by PR

facebook/rocksdb#2380

update-submodule: rocksdb

Differential Revision: D5520030 (a27984c)

fbshipit-source-id: 0da3e86fb08
inikep pushed a commit to inikep/mysql-5.6 that referenced this pull request Aug 16, 2021
Summary:
The rocksdb PR
facebook/rocksdb#2485 reverted an implementation
of rocksdb perf and iostat counters to __thread from rocksdb::ThreadLocal. This
change was previously done by PR

facebook/rocksdb#2380

update-submodule: rocksdb

Differential Revision: D5520030 (facebook@a27984c)

fbshipit-source-id: 0da3e86fb08
inikep pushed a commit to inikep/mysql-5.6 that referenced this pull request Aug 17, 2021
Summary:
The rocksdb PR
facebook/rocksdb#2485 reverted an implementation
of rocksdb perf and iostat counters to __thread from rocksdb::ThreadLocal. This
change was previously done by PR

facebook/rocksdb#2380

update-submodule: rocksdb

Differential Revision: D5520030 (facebook@a27984c)

fbshipit-source-id: 0da3e86fb08
inikep pushed a commit to inikep/mysql-5.6 that referenced this pull request Aug 30, 2021
Summary:
The rocksdb PR
facebook/rocksdb#2485 reverted an implementation
of rocksdb perf and iostat counters to __thread from rocksdb::ThreadLocal. This
change was previously done by PR

facebook/rocksdb#2380

update-submodule: rocksdb

Differential Revision: D5520030 (facebook@a27984c)

fbshipit-source-id: 0da3e86fb08
inikep pushed a commit to inikep/mysql-5.6 that referenced this pull request Aug 30, 2021
Summary:
The rocksdb PR
facebook/rocksdb#2485 reverted an implementation
of rocksdb perf and iostat counters to __thread from rocksdb::ThreadLocal. This
change was previously done by PR

facebook/rocksdb#2380

update-submodule: rocksdb

Differential Revision: D5520030 (facebook@a27984c)

fbshipit-source-id: 0da3e86fb08
inikep pushed a commit to inikep/mysql-5.6 that referenced this pull request Aug 31, 2021
Summary:
The rocksdb PR
facebook/rocksdb#2485 reverted an implementation
of rocksdb perf and iostat counters to __thread from rocksdb::ThreadLocal. This
change was previously done by PR

facebook/rocksdb#2380

update-submodule: rocksdb

Differential Revision: D5520030 (facebook@a27984c)

fbshipit-source-id: 0da3e86fb08
inikep pushed a commit to inikep/mysql-5.6 that referenced this pull request Sep 1, 2021
Summary:
The rocksdb PR
facebook/rocksdb#2485 reverted an implementation
of rocksdb perf and iostat counters to __thread from rocksdb::ThreadLocal. This
change was previously done by PR

facebook/rocksdb#2380

update-submodule: rocksdb

Differential Revision: D5520030 (facebook@a27984c)

fbshipit-source-id: 0da3e86fb08
inikep pushed a commit to inikep/mysql-5.6 that referenced this pull request Sep 2, 2021
Summary:
The rocksdb PR
facebook/rocksdb#2485 reverted an implementation
of rocksdb perf and iostat counters to __thread from rocksdb::ThreadLocal. This
change was previously done by PR

facebook/rocksdb#2380

update-submodule: rocksdb

Differential Revision: D5520030 (facebook@a27984c)

fbshipit-source-id: 0da3e86fb08
hermanlee pushed a commit to facebook/mysql-5.6 that referenced this pull request Jan 10, 2022
Summary:
The rocksdb PR
facebook/rocksdb#2485 reverted an implementation
of rocksdb perf and iostat counters to __thread from rocksdb::ThreadLocal. This
change was previously done by PR

facebook/rocksdb#2380

@update-submodule: rocksdb

Differential Revision: D5520030
inikep pushed a commit to inikep/mysql-5.6 that referenced this pull request Jan 17, 2022
Summary:
The rocksdb PR
facebook/rocksdb#2485 reverted an implementation
of rocksdb perf and iostat counters to __thread from rocksdb::ThreadLocal. This
change was previously done by PR

facebook/rocksdb#2380

@update-submodule: rocksdb

Differential Revision: D5520030
ldonoso pushed a commit to ldonoso/percona-server that referenced this pull request Mar 15, 2022
Summary:
The rocksdb PR
facebook/rocksdb#2485 reverted an implementation
of rocksdb perf and iostat counters to __thread from rocksdb::ThreadLocal. This
change was previously done by PR

facebook/rocksdb#2380

@update-submodule: rocksdb

Differential Revision: D5520030
inikep pushed a commit to inikep/mysql-5.6 that referenced this pull request May 20, 2022
Summary:
The rocksdb PR
facebook/rocksdb#2485 reverted an implementation
of rocksdb perf and iostat counters to __thread from rocksdb::ThreadLocal. This
change was previously done by PR

facebook/rocksdb#2380

@update-submodule: rocksdb

Differential Revision: D5520030
inikep pushed a commit to inikep/mysql-5.6 that referenced this pull request May 23, 2022
Summary:
The rocksdb PR
facebook/rocksdb#2485 reverted an implementation
of rocksdb perf and iostat counters to __thread from rocksdb::ThreadLocal. This
change was previously done by PR

facebook/rocksdb#2380

@update-submodule: rocksdb

Differential Revision: D5520030
laurynas-biveinis pushed a commit to laurynas-biveinis/mysql-5.6 that referenced this pull request Aug 11, 2022
Summary:
The rocksdb PR
facebook/rocksdb#2485 reverted an implementation
of rocksdb perf and iostat counters to __thread from rocksdb::ThreadLocal. This
change was previously done by PR

facebook/rocksdb#2380

@update-submodule: rocksdb

Differential Revision: D5520030
inikep pushed a commit to inikep/mysql-5.6 that referenced this pull request Mar 28, 2023
Summary:
The rocksdb PR
facebook/rocksdb#2485 reverted an implementation
of rocksdb perf and iostat counters to __thread from rocksdb::ThreadLocal. This
change was previously done by PR

facebook/rocksdb#2380

@update-submodule: rocksdb

Differential Revision: D5520030
inikep pushed a commit to inikep/mysql-5.6 that referenced this pull request Jun 1, 2023
Summary:
The rocksdb PR
facebook/rocksdb#2485 reverted an implementation
of rocksdb perf and iostat counters to __thread from rocksdb::ThreadLocal. This
change was previously done by PR

facebook/rocksdb#2380

@update-submodule: rocksdb

Differential Revision: D5520030
inikep pushed a commit to inikep/mysql-5.6 that referenced this pull request Jun 14, 2023
Summary:
The rocksdb PR
facebook/rocksdb#2485 reverted an implementation
of rocksdb perf and iostat counters to __thread from rocksdb::ThreadLocal. This
change was previously done by PR

facebook/rocksdb#2380

@update-submodule: rocksdb

Differential Revision: D5520030
inikep pushed a commit to inikep/percona-server that referenced this pull request Apr 9, 2024
Summary:
The rocksdb PR
facebook/rocksdb#2485 reverted an implementation
of rocksdb perf and iostat counters to __thread from rocksdb::ThreadLocal. This
change was previously done by PR

facebook/rocksdb#2380

@update-submodule: rocksdb

Differential Revision: D5520030
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants