Skip to content

crimson/os: rewrite ordering using std::strong_ordering - #47423

Merged
tchaikov merged 2 commits into
ceph:mainfrom
tchaikov:wip-crimson-cmp
Aug 8, 2022
Merged

tchaikov merged 2 commits into
ceph:mainfrom
tchaikov:wip-crimson-cmp

Conversation

@tchaikov

@tchaikov tchaikov commented Aug 3, 2022 •

Copy link
Copy Markdown
Contributor

crimson/os: rewrite ordering using std::strong_ordering

the goals are

  1. to use std::strong_ordering mechinary for better readability
    and maintainbility
  2. to remove unnecessary abstraction
  3. use concept for better error message and readability.

changes:

  • replace MatchKindCMP with std::strong_ordering
  • replace compare_to() with operator<=>
  • introduce a concept IsFullKey so we can use it when developing
    generic facilities to operate on both materialized key or view.
  • use IsFullKey in place of KeyT.
  • use type instead of KeyT when appropriate.
  • use the constrained key type instead of full_key_t<KT>
    full_key_t`

Contribution Guidelines

Checklist

  • Tracker (select at least one)
    • References tracker ticket
    • Very recent bug; references commit where it was introduced
    • New feature (ticket optional)
    • Doc update (no ticket needed)
    • Code cleanup (no ticket needed)
  • Component impact
    • Affects Dashboard, opened tracker ticket
    • Affects Orchestrator, opened tracker ticket
    • No impact that needs to be tracked
  • Documentation (select at least one)
    • Updates relevant documentation
    • No doc update is appropriate
  • Tests (select at least one)
Show available Jenkins commands
  • jenkins retest this please
  • jenkins test classic perf
  • jenkins test crimson perf
  • jenkins test signed
  • jenkins test make check
  • jenkins test make check arm64
  • jenkins test submodules
  • jenkins test dashboard
  • jenkins test dashboard cephadm
  • jenkins test api
  • jenkins test docs
  • jenkins render docs
  • jenkins test ceph-volume all
  • jenkins test ceph-volume tox
  • jenkins test windows

@tchaikov
tchaikov requested a review from a team as a code owner August 3, 2022 01:12
@tchaikov
tchaikov requested a review from cyx1231st August 3, 2022 01:12
@tchaikov tchaikov mentioned this pull request Aug 3, 2022
2 of 14 tasks
@tchaikov
tchaikov marked this pull request as draft August 3, 2022 04:59
@tchaikov

tchaikov commented Aug 3, 2022

Copy link
Copy Markdown
Contributor Author

i will

  • address the comments
  • cleanup the commits
  • fix the FTBFS of tests

after the first round of reviews.

@tchaikov tchaikov mentioned this pull request Aug 3, 2022
4 of 14 tasks
@tchaikov
tchaikov marked this pull request as ready for review August 3, 2022 05:52
@tchaikov

tchaikov commented Aug 3, 2022

Copy link
Copy Markdown
Contributor Author

jenkins test make check

1 similar comment
@tchaikov

tchaikov commented Aug 3, 2022

Copy link
Copy Markdown
Contributor Author

jenkins test make check

@tchaikov

tchaikov commented Aug 3, 2022

Copy link
Copy Markdown
Contributor Author
0.	Program arguments: /usr/bin/clang++-14 -g -fPIC -fno-builtin-malloc -fno-builtin-calloc -fno-builtin-realloc -fno-builtin-free -Wall -fno-strict-aliasing -fsigned-char -Wtype-limits -Wignored-qualifiers -Wpointer-arith -Werror=format-security -Winit-self -Wno-unknown-pragmas -Wnon-virtual-dtor -Wno-ignored-qualifiers -ftemplate-depth-1024 -Wpessimizing-move -Wredundant-move -Wno-inconsistent-missing-override -Wno-mismatched-tags -Wno-unused-private-field -Wno-address-of-packed-member -Wno-unused-function -Wno-unused-local-typedef -Wno-varargs -Wno-gnu-designator -Wno-missing-braces -Wno-parentheses -Wno-deprecated-register -fdiagnostics-color=auto -ftemplate-backtrace-limit=0 -Wno-non-virtual-dtor -std=gnu++17 -Wno-error=unused-result -Wno-error=#warnings -fstack-clash-protection -fsanitize=address -fsanitize=undefined -fno-sanitize=vptr -std=c++2a -Werror -DBOOST_ASIO_DISABLE_CONCEPTS -DBOOST_ASIO_DISABLE_THREAD_KEYWORD_EXTENSION -DBOOST_ASIO_USE_TS_EXECUTOR_AS_DEFAULT -DHAVE_CONFIG_H -DSEASTAR_API_LEVEL=6 -DSEASTAR_DEBUG -DSEASTAR_DEBUG_SHARED_PTR -DSEASTAR_DEFAULT_ALLOCATOR -DSEASTAR_SCHEDULING_GROUPS_COUNT=16 -DSEASTAR_SHUFFLE_TASK_QUEUE -DSEASTAR_TYPE_ERASE_MORE -DWITH_SEASTAR=1 -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE -D_REENTRANT -D_THREAD_SAFE -D__CEPH__ -D__STDC_FORMAT_MACROS -D__linux__ -Isrc/include -I../src -I../src/seastar/include -Isrc/seastar/gen/include -isystem boost/include -isystem include -isystem ../src/xxHash -isystem ../src/rapidjson/include -isystem ../src/fmt/include -isystem ../src/jaegertracing/opentelemetry-cpp/api/include -isystem ../src/jaegertracing/opentelemetry-cpp/exporters/jaeger/include -isystem ../src/jaegertracing/opentelemetry-cpp/ext/include -isystem ../src/jaegertracing/opentelemetry-cpp/sdk/include -DCEPH_DEBUG_MUTEX -D_GLIBCXX_ASSERTIONS -U_FORTIFY_SOURCE -DSEASTAR_SSTRING -c -o src/crimson/os/seastore/CMakeFiles/crimson-seastore.dir/onode_manager/staged-fltree/stages/node_stage.cc.o ../src/crimson/os/seastore/onode_manager/staged-fltree/stages/node_stage.cc
1.	../src/crimson/os/seastore/onode_manager/staged-fltree/stages/node_stage.cc:403:68: current parser token ';'
2.	../src/crimson/os/seastore/onode_manager/staged-fltree/stages/node_stage.cc:9:1: parsing namespace 'crimson'
3.	../src/crimson/os/seastore/onode_manager/staged-fltree/stages/node_stage.h:202:3: instantiating function definition 'crimson::os::seastore::onode::node_extent_t<crimson::os::seastore::onode::_node_fields_013_t<crimson::os::seastore::onode::_slot_t<crimson::os::seastore::onode::shard_pool_crush_t, crimson::os::seastore::onode::field_type_t::N0>>, crimson::os::seastore::onode::node_type_t::INTERNAL>::Appender<crimson::os::seastore::onode::key_view_t>::Appender'
Stack dump without symbol names (ensure you have llvm-symbolizer in your PATH or set the environment var `LLVM_SYMBOLIZER_PATH` to point to it):
/usr/lib/x86_64-linux-gnu/libLLVM-14.so.1(_ZN4llvm3sys15PrintStackTraceERNS_11raw_ostreamEi+0x31)[0x7f1676b65311]
/usr/lib/x86_64-linux-gnu/libLLVM-14.so.1(_ZN4llvm3sys17RunSignalHandlersEv+0xee)[0x7f1676b6305e]
/usr/lib/x86_64-linux-gnu/libLLVM-14.so.1(_ZN4llvm3sys15CleanupOnSignalEm+0x100)[0x7f1676b646d0]
/usr/lib/x86_64-linux-gnu/libLLVM-14.so.1(+0xd77a6f)[0x7f1676a91a6f]
/lib/x86_64-linux-gnu/libpthread.so.0(+0x153c0)[0x7f167fdd73c0]
/usr/lib/x86_64-linux-gnu/libclang-cpp.so.14(+0xd167c1)[0x7f167d2f07c1]
/usr/lib/x86_64-linux-gnu/libclang-cpp.so.14(+0xd125e8)[0x7f167d2ec5e8]
/usr/lib/x86_64-linux-gnu/libclang-cpp.so.14(+0xceb6ed)[0x7f167d2c56ed]
/usr/lib/x86_64-linux-gnu/libclang-cpp.so.14(+0xce75f4)[0x7f167d2c15f4]

@tchaikov
tchaikov marked this pull request as draft August 3, 2022 07:57
@github-actions

github-actions Bot commented Aug 3, 2022

Copy link
Copy Markdown

This pull request can no longer be automatically merged: a rebase is needed and changes have to be manually resolved

@tchaikov
tchaikov force-pushed the wip-crimson-cmp branch 3 times, most recently from ca074c2 to 8306c47 Compare August 6, 2022 10:35
@tchaikov
tchaikov marked this pull request as ready for review August 6, 2022 10:36
the goals are

1. to use std::strong_ordering mechinary for better readability
   and maintainbility
2. to remove unnecessary abstraction
3. use concept for better error message and readability.

changes:

* replace MatchKindCMP with std::strong_ordering
* replace compare_to() with operator<=>
* introduce a concept `IsFullKey` so we can use it when developing
  generic facilities to operate on both materialized key or view.
* use `IsFullKey` in place of `KeyT` when appropriate

Signed-off-by: Kefu Chai <[email protected]>
to silence warnings like:

../src/test/crimson/seastore/onode_tree/test_staged_fltree.cc:371:10: warning: 'random_shuffle<__gnu_cxx::__normal_iterator<std::pair<ghobject_t, crimson::os::seastore::onode::test_item_t> *, std::vector<std::pair<ghobject_t, crimson::os::seastore::onode::test_item_t>>>>' is deprecated: use 'std::shuffle' instead [-Wdeprecated-declarations]
    std::random_shuffle(kvs.begin(), kvs.end());
         ^

Signed-off-by: Kefu Chai <[email protected]>
@tchaikov
tchaikov merged commit f41213f into ceph:main Aug 8, 2022
@tchaikov
tchaikov deleted the wip-crimson-cmp branch August 8, 2022 05:15
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.

2 participants