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

librbd: send FLUSH_SOURCE_INTERNAL when do copy/deep_copy. #43659

Merged
merged 1 commit into from Nov 3, 2021

Conversation

majianpeng
Copy link
Member

@majianpeng majianpeng commented Oct 26, 2021

copy/deep_copy use object_map to judge whether object exist.
If w/ librbdo pwl cache, flush can't flush data to osd which change
objectmap state. So we should send flush w/ FLUSH_SOURCE_INTERNAL to
make data flush to osd.

Fixes:https://tracker.ceph.com/issues/53057
Signed-off-by: Jianpeng Ma jianpeng.ma@intel.com

Checklist

  • References tracker ticket
  • Updates documentation if necessary
  • Includes tests for new functionality or reproducer for bug

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

@github-actions github-actions bot added the rbd label Oct 26, 2021
@majianpeng
Copy link
Member Author

retest this please

@majianpeng
Copy link
Member Author

jenkins test make check

@majianpeng majianpeng changed the title librbd: send LUSH_SOURCE_INTERNAL when do copy/deep_copy. librbd: send FLUSH_SOURCE_INTERNAL when do copy/deep_copy. Oct 26, 2021
@majianpeng
Copy link
Member Author

retest this please

@majianpeng
Copy link
Member Author

retest this please

@tchaikov
Copy link
Contributor

jenkins test make check

@majianpeng
Copy link
Member Author

jenkins test make check

1 similar comment
@majianpeng
Copy link
Member Author

jenkins test make check

Copy link
Contributor

@trociny trociny left a comment

Choose a reason for hiding this comment

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

In general I think it is correct. I have some minor questions about the fix implementation details though.

  1. As it is "persistent cache" specific, wouldn't it better to do this flush only for this case? I don't think it matters much on practice but at least it would be less confusing for an occasional code reader why we have this.

  2. In the deep copy case, wouldn't it better to add this flush to DeepCopyRequest instead?

  3. Wouldn't be more correct not only flush but entirely disable the pwl cache when copying? (Ideally, switch to "write through" mode). Again, I don't think it would make much difference on practice. Just a note to consider.

src/librbd/api/Image.cc Outdated Show resolved Hide resolved
@majianpeng
Copy link
Member Author

majianpeng commented Oct 29, 2021

For "As it is "persistent cache" specific, wouldn't it better to do this flush only for this case? I don't think it matters much on practice but at least it would be less confusing for an occasional code reader why we have this."
i copy flush login from: https://github.com/ceph/ceph/blob/master/src/librbd/api/DiffIterate.cc#L167-L181.

In general I think it is correct. I have some minor questions about the fix implementation details though.

1. As it is "persistent cache" specific, wouldn't it better to do this flush only for this case? I don't think it matters much on practice but at least it would be less confusing for an occasional code reader why we have this.

In fact, flush login copy from https://github.com/ceph/ceph/blob/master/src/librbd/api/DiffIterate.cc#L167-L181. I'm not family with librbd other part.

2. In the deep copy case, wouldn't it better to add this flush to `DeepCopyRequest` instead?

I'll try.

3. Wouldn't be more correct not only flush but entirely disable the pwl cache when copying? (Ideally, switch to "write through" mode). Again, I don't think it would make much difference on practice. Just a note to consider.

Yes, but this need user to know much. In fact cache is inner part. For example, write one image w/ pwl. Host restart and data can't flush to osd. After restart, user do copy. By your method, it should firstly flush data to osd then using write_through or disable pwl cache.
Also, currently, pwl no write-through mode.

@majianpeng majianpeng force-pushed the send-internal-flush-for-rbd-copy branch 2 times, most recently from 1acb2b5 to 2c38f39 Compare October 29, 2021 05:35
@majianpeng
Copy link
Member Author

@trociny for " In the deep copy case, wouldn't it better to add this flush to DeepCopyRequest instead?"
when move code into DeepCopyRequest.cc: compiler met the following errors.
librbd::io::AioCompletion::create_and_star func don't support MockTestImageCtx.

FAILED: src/test/librbd/CMakeFiles/unittest_librbd.dir/test_mock_DeepCopyRequest.cc.o 
/usr/bin/clang++ -DBOOST_ASIO_DISABLE_THREAD_KEYWORD_EXTENSION -DBOOST_ASIO_USE_TS_EXECUTOR_AS_DEFAULT -DHAVE_CONFIG_H -DTEST_LIBRBD_INTERNALS -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 -isystem boost/include -isystem include -isystem ../src/xxHash -isystem ../src/rapidjson/include -isystem ../src/googletest/googlemock/include -isystem ../src/googletest/googlemock -isystem ../src/googletest/googletest/include -isystem ../src/googletest/googletest -isystem src/pmdk/src/include -O2 -g -DNDEBUG -fPIE -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 -fno-builtin-malloc -fno-builtin-calloc -fno-builtin-realloc -fno-builtin-free -std=c++17 -MD -MT src/test/librbd/CMakeFiles/unittest_librbd.dir/test_mock_DeepCopyRequest.cc.o -MF src/test/librbd/CMakeFiles/unittest_librbd.dir/test_mock_DeepCopyRequest.cc.o.d -o src/test/librbd/CMakeFiles/unittest_librbd.dir/test_mock_DeepCopyRequest.cc.o -c ../src/test/librbd/test_mock_DeepCopyRequest.cc
In file included from ../src/test/librbd/test_mock_DeepCopyRequest.cc:134:
../src/librbd/DeepCopyRequest.cc:80:21: error: no matching function for call to 'create_and_start'
    auto aio_comp = librbd::io::AioCompletion::create_and_start(&flush_ctx, m_src_image_ctx,
                    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../src/test/librbd/test_mock_DeepCopyRequest.cc:278:12: note: in instantiation of member function 'librbd::DeepCopyRequest<librbd::(anonymous namespace)::MockTestImageCtx>::send' requested here
  request->send();
           ^
../src/librbd/io/AioCompletion.h:102:25: note: candidate function template not viable: no known conversion from 'librbd::(anonymous namespace)::MockTestImageCtx *' to 'librbd::ImageCtx *' for 2nd argument
  static AioCompletion *create_and_start(T *obj, ImageCtx *image_ctx,
                    ^

@trociny
Copy link
Contributor

trociny commented Oct 29, 2021

when move code into DeepCopyRequest.cc: compiler met the following errors. librbd::io::AioCompletion::create_and_star func don't support MockTestImageCtx.

You need to wrap m_src_image_ctx into get_image_ctx(m_src_image_ctx). See e.g. deep_copy/ObjectCopyRequest.cc for an example.

@trociny
Copy link
Contributor

trociny commented Oct 29, 2021

Ok. Taking we already have a precedence of doing this in api/DiffIterate.cc, I think I am fine with the current implementation. I.e. there is no need to move the code into DeepCopyRequest.cc. Though please add a comment describing the reason, similarly to what we have in api/DiffIterate.cc.

@majianpeng
Copy link
Member Author

jenkins test api

1 similar comment
@ideepika
Copy link
Member

jenkins test api

copy/deep_copy use object_map to judge whether object exist.
If w/ librbdo pwl cache, flush can't flush data to osd which
change objectmap state. So we should send flush w/ FLUSH_SOURCE_INTERNAL
to make data flush to osd.

Fixes:https://tracker.ceph.com/issues/53057
Signed-off-by: Jianpeng Ma <jianpeng.ma@intel.com>
@majianpeng majianpeng force-pushed the send-internal-flush-for-rbd-copy branch from 2c38f39 to a2ae83f Compare November 1, 2021 00:43
@majianpeng
Copy link
Member Author

jenkins test api

@majianpeng
Copy link
Member Author

@ideepika update.

@ideepika
Copy link
Member

ideepika commented Nov 1, 2021

@ideepika update.

@majianpeng is this related to #43127 (comment) as well?

@majianpeng
Copy link
Member Author

@ideepika update.

@majianpeng is this related to #43127 (comment) as well?
No. they are different issues.

@ideepika ideepika changed the title librbd: send FLUSH_SOURCE_INTERNAL when do copy/deep_copy. librbd: flush to OSD using FLUSH_SOURCE_INTERNAL while doing copy/deep_copy Nov 1, 2021
Copy link
Member

@ideepika ideepika left a comment

Choose a reason for hiding this comment

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

@majianpeng can you amend commit title to PR title, lgtm ! thanks!

Copy link
Contributor

@sunnyku sunnyku left a comment

Choose a reason for hiding this comment

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

LGTM

@ideepika
Copy link
Member

ideepika commented Nov 2, 2021

@majianpeng can you amend commit title to PR title, lgtm ! thanks!

@majianpeng intial tests looks good: https://pulpito.ceph.com/ideepika-2021-11-01_18:01:37-rbd-wip-deepika2-testing-2021-11-01-1948-distro-basic-smithi/
can you amend the commit to match the title?

@majianpeng majianpeng changed the title librbd: flush to OSD using FLUSH_SOURCE_INTERNAL while doing copy/deep_copy librbd: send FLUSH_SOURCE_INTERNAL when do copy/deep_copy. Nov 2, 2021
@majianpeng
Copy link
Member Author

@majianpeng can you amend commit title to PR title, lgtm ! thanks!

@majianpeng intial tests looks good: https://pulpito.ceph.com/ideepika-2021-11-01_18:01:37-rbd-wip-deepika2-testing-2021-11-01-1948-distro-basic-smithi/ can you amend the commit to match the title?

Sorry omit your comments. update, please review.

@ideepika
Copy link
Member

ideepika commented Nov 3, 2021

@majianpeng mind taking a look into https://tracker.ceph.com/issues/53108 seems not related but still new failure seen recently

@ideepika ideepika merged commit 41d3c83 into ceph:master Nov 3, 2021
@majianpeng
Copy link
Member Author

majianpeng commented Nov 4, 2021

@majianpeng mind taking a look into https://tracker.ceph.com/issues/53108 seems not related but still new failure seen recently

@ideepika remembered a question about objectmap. When write after discard, objectmap maybe omit discard command:
https://github.com/ceph/ceph/blob/master/src/librbd/io/ObjectRequest.cc#L426.
For example: write(0,64K) and later discard(0,32k). Because currently write still can't create object, so discard will be omitted.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
5 participants