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

Store the global list of buckets under the "buckets:" key #2072

Merged
merged 1 commit into from
Aug 11, 2020

Conversation

fatpat
Copy link
Member

@fatpat fatpat commented Aug 7, 2020

SUMMARY

For statistics about buckets, oio-exporter needs to have access to the entire list of buckets. Currently, we have two options:

  • scan with a match on buckets:* but this is not an option as performances are terrible
  • hscan over accounts: and then for each account, zscan over buckets:$account but it's too complicated and does not fit well into oio-exporter code as we wish to separate fetching accounts and buckets metrics.
ISSUE TYPE
  • Feature Pull Request
COMPONENT NAME

Account

SDS VERSION
7.x
ADDITIONAL INFORMATION

Feel free to to use the following script for creating buckets: key from buckets:* key on existing cluster: https://github.com/open-io/oio-toolkit/blob/master/scripts/updates-buckets:.lua

local keys = redis.call("keys", "buckets:*")
for i, key in ipairs(keys) do
	if key ~= "buckets:" then
		local zrange = redis.call("ZRANGE", key, 0, -1)
		for j, bucket in ipairs(zrange) do
			redis.call("ZADD", "buckets:", "NX", 0, bucket)
		end
	end
end

@murlock murlock requested a review from fvennetier August 7, 2020 07:35
@fvennetier fvennetier changed the title create buckets: in redis to store the global list of buckets Store the global list of buckets under the "buckets:" key Aug 10, 2020
Copy link
Member

@fvennetier fvennetier left a comment

Choose a reason for hiding this comment

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

Looks good.

I had plans to merge the bucket DB with the account database, but it's not easy.

@codecov-commenter
Copy link

codecov-commenter commented Aug 10, 2020

Codecov Report

Merging #2072 into 7.x will increase coverage by 0.87%.
The diff coverage is n/a.

Impacted file tree graph

@@            Coverage Diff             @@
##              7.x    #2072      +/-   ##
==========================================
+ Coverage   77.62%   78.48%   +0.87%     
==========================================
  Files         376      378       +2     
  Lines       73020    73447     +427     
  Branches     6567     6563       -4     
==========================================
+ Hits        56673    57637     +964     
+ Misses      16131    15603     -528     
+ Partials      216      207       -9     
Impacted Files Coverage Δ
oio/account/backend.py 70.89% <ø> (ø)
events/oio_events_queue_beanstalkd.c 74.28% <0.00%> (-9.00%) ⬇️
tests/functional/content/test_service_id.py 78.83% <0.00%> (-5.29%) ⬇️
oio/common/utils.py 67.69% <0.00%> (-3.04%) ⬇️
oio/directory/meta0.py 84.07% <0.00%> (-0.92%) ⬇️
meta2v2/meta2_filters_extract.c 82.68% <0.00%> (-0.78%) ⬇️
meta2v2/meta2_filters_action_content.c 83.13% <0.00%> (-0.48%) ⬇️
proxy/transport_http.c 85.36% <0.00%> (-0.28%) ⬇️
server/transport_gridd.c 74.66% <0.00%> (-0.19%) ⬇️
proxy/m2_actions.c 88.32% <0.00%> (-0.13%) ⬇️
... and 65 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 7151cf7...fd5e584. Read the comment docs.

@fatpat fatpat force-pushed the global_buckets_list_in_redis branch 3 times, most recently from 7023763 to fdfb134 Compare August 10, 2020 16:22
@fatpat fatpat requested a review from fvennetier August 10, 2020 16:22
On existing cluster, please feel free to use the following lua migration
script: https://github.com/open-io/oio-toolkit/blob/master/scripts/updates-buckets:.lua
```
local keys = redis.call("keys", "buckets:*")
for i, key in ipairs(keys) do
	if key ~= "buckets:" then
		local zrange = redis.call("ZRANGE", key, 0, -1)
		for j, bucket in ipairs(zrange) do
			redis.call("ZADD", "buckets:", "NX", 0, bucket)
		end
	end
end
```
@fvennetier fvennetier merged commit c58faaf into open-io:7.x Aug 11, 2020
@fatpat fatpat deleted the global_buckets_list_in_redis branch August 11, 2020 09:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants