Skip to content

osd: add cls_cxx_map_remove_range() - #15183

Merged
liewegas merged 19 commits into
ceph:masterfrom
cbodley:wip-19975
Aug 23, 2019
Merged

liewegas merged 19 commits into
ceph:masterfrom
cbodley:wip-19975

Conversation

@cbodley

@cbodley cbodley commented May 19, 2017 •

Copy link
Copy Markdown
Contributor

this adds a new CEPH_OSD_OP_OMAPRMKEYRANGE for the ObjectStore's OP_OMAP_RMKEYRANGE, and exposes it in the cls api as cls_cxx_map_remove_range() and the librados api as rados_write_op_omap_rm_range() and ObjectWriteOperation::omap_rm_range()

this is used by cls trim operations to avoid sending separate osd ops for each key with cls_cxx_map_remove_key()

Fixes: http://tracker.ceph.com/issues/19975

@cbodley
cbodley force-pushed the wip-19975 branch 2 times, most recently from ebf4bf6 to 0461cc9 Compare May 21, 2017 03:02
@cbodley cbodley changed the title [DNM] osd: add cls_cxx_map_remove_range() osd: add cls_cxx_map_remove_range() May 21, 2017
@cbodley
cbodley requested a review from jdurgin May 22, 2017 14:09
Comment thread src/cls/log/cls_log.cc Outdated

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

@cbodley Extra spaces to be removed.

Comment thread src/test/cls_log/test_cls_log.cc Outdated

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

@cbodley tab indent

@tchaikov

Copy link
Copy Markdown
Contributor

@jdurgin ping?

@cbodley

cbodley commented Oct 28, 2017

Copy link
Copy Markdown
Contributor Author

rebased. ceph_test_cls_rgw is still passing, but ceph_test_cls_log depends on #18610 to pass cls_log.test_log_add_same_time and cls_log.trim_by_marker

@cbodley

cbodley commented Nov 1, 2017

Copy link
Copy Markdown
Contributor Author

rebased after #18610 merged, unit tests passing again

@cbodley

cbodley commented Nov 10, 2017

Copy link
Copy Markdown
Contributor Author

hi @jdurgin, i would love your feedback on this when you have the time. log trimming isn't a bottleneck for rgw, but it's currently way more expensive for the osd than it should be

@mattbenjamin mentioned that there had been some issues with range drops in rocksdb that might be relevant to this. if it's still a concern, could you (or @aclamk / @rzarzynski) expand on that?

@tchaikov
tchaikov requested a review from neha-ojha October 15, 2018 08:14
@tchaikov

Copy link
Copy Markdown
Contributor

@jdurgin @neha-ojha ping?

@neha-ojha

Copy link
Copy Markdown
Member

needs rebase

@cbodley

cbodley commented Oct 17, 2018

Copy link
Copy Markdown
Contributor Author

rebased and updated OMAPRMKEYRANGE to the next available value 43

Comment thread src/cls/log/cls_log.cc Outdated

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

the only thing that worries me about this is the lack of bound on number of entries to be removed in a single transaction. does rocksdb implement this in a way that is constant time, inserting implicit tombstones across the whole range, or is it still linear in the number of keys in the range?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

good question! this was based on the naive assumption that the database would do this more efficiently in bulk than as separate keys/ranges. now that i look more closely at RocksDBStore::RocksDBTransactionImpl::rm_range_keys(), i see that by default (rocksdb_enable_rmrange=false) it will issue a separate rocksdb::WriteBatch::Delete() call for each key. the DeleteRange() path with rocksdb_enable_rmrange=true looks promising, but there appear to be performance issues related to its range tombstones (see meta/rocksdb#3959). i see that @yuyuyu101 was involved in this part of RocksDBStore, maybe you can offer some insight here?

regardless, i'm happy to rework this in a way that's closer to the current strategy, where it lists keys first in order to limit the range we pass to cls_cxx_map_remove_range(), then loops until ENODATA in the client - that would still be a huge improvement over the separate calls to cls_cxx_map_remove_key()

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

apparently rocksdb_enable_rmrange is still experimental, though there may be more work on it coming soon (a couple folks attended a rocksdb meetup yesterday and asked the developers about it). So it sounds like we should keep it off for now.

Reworking this to list and then remove_range() like you suggest sounds good.

Comment thread src/include/rados/librados.h Resolved
@stale

stale Bot commented Jan 30, 2019

Copy link
Copy Markdown

This pull request has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs.
If you are a maintainer or core committer, please follow-up on this issue to identify what steps should be taken by the author to move this proposed change forward.
If you are the author of this pull request, thank you for your proposed contribution. If you believe this change is still appropriate, please ensure that any feedback has been addressed and ask for a code review.

@stale stale Bot added the stale label Jan 30, 2019
@neha-ojha

Copy link
Copy Markdown
Member

@cbodley any update on this?

removes the config options rocksdb_enable_rmrange and
rocksdb_max_items_rmrange that avoid calls to DeleteRange()

Signed-off-by: Casey Bodley <[email protected]>
@cbodley

cbodley commented Aug 7, 2019

Copy link
Copy Markdown
Contributor Author

i updated cls_log_trim() and cls_rgw_bilog_trim() to list the range with max=1 in order to detect the ENODATA case. the test cases are passing again, both against the old and new implementations

i decided not to introduce the new cls_log_trim2() interfaces for now, because we get most of the wins from rmrange itself; the client just has to send one extra osd op to see ENODATA, rather than the 1 + N/1000 requests needed before

i also added a final commit to remove the config options around rmrange - i'm happy to split that into another pr if necessary

@cbodley

cbodley commented Aug 7, 2019

Copy link
Copy Markdown
Contributor Author

@cbodley

cbodley commented Aug 9, 2019

Copy link
Copy Markdown
Contributor Author

results from a very naive benchmark run against a debug-built vstart cluster with a single osd on nvme:

10k created entries in 0.727089
10k trimmed entries in 0.001970
100k created entries in 9.462839
100k trimmed entries in 0.002188
1m created entries in 100.594593
1m trimmed entries in 0.002140
10m created entries in 803.385073
10m trimmed entries in 0.002612

@liewegas liewegas left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

lgtm!

@cbodley

cbodley commented Aug 15, 2019

Copy link
Copy Markdown
Contributor Author

thanks @liewegas and @tchaikov - this passed the rgw suite, does it need to run through rados? packages are available at https://shaman.ceph.com/builds/ceph/wip-19975/ if you're willing to schedule it for me

@tchaikov

Copy link
Copy Markdown
Contributor

@cbodley i think Sage has included this PR in his batch =)

liewegas added a commit that referenced this pull request Aug 23, 2019
* refs/pull/15183/head:
	kv/rocksdb: support rmrange unconditionally
	cls/rgw: rgw_bi_log_trim() uses cls_cxx_map_remove_range()
	cls/log: cls_log_trim() uses cls_cxx_map_remove_range()
	test/cls: add cls_log.trim_by_marker test
	test/cls: test_cls_log doesn't allocate ObjectOperations
	test/cls: test_cls_log uses fixture for temporary pool
	test/cls: add cls_rgw.bi_log_trim test
	cls/rgw: expose cls_rgw_bilog_list/trim() for single shard
	test/cls: test_cls_rgw uses cls_rgw_obj_key
	test/cls: test_cls_rgw doesn't allocate ObjectOperations
	test/cls: test_cls_rgw uses fixture for temporary pool
	objclass: add cls_cxx_map_remove_range()
	librados: add rados_write_op_omap_rm_range2()
	osdc: add Objecter omap_rm_range()
	osd: add CEPH_OSD_OP_OMAPRMKEYRANGE to do_osd_ops()
	osd: add omap_rmkeyrange() to PGTransaction
	os: add bufferlist overload for omap_rmkeyrange()
	tracing: add do_osd_op_pre_omaprmkeyrange
	rados: add CEPH_OSD_OP_OMAPRMKEYRANGE

Reviewed-by: Sage Weil <[email protected]>
@liewegas
liewegas merged commit 49672ad into ceph:master Aug 23, 2019
@cbodley

cbodley commented Aug 23, 2019

Copy link
Copy Markdown
Contributor Author

thanks for the help with review and testing!

@vumrao

vumrao commented Oct 16, 2019

Copy link
Copy Markdown
Contributor

nautilus backport #30949.

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.

8 participants