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

os/bluestore: refactor ExtentMap::update to avoid preceeding db updat… #12394

Merged
merged 2 commits into from Dec 22, 2016

Conversation

ifed01
Copy link
Contributor

@ifed01 ifed01 commented Dec 8, 2016

…e if reshard takes place.

update method might add some 'set' ops to the transaction prior to detection that resharding is needed.
No need to apply these ops after reshard takes place - correspoding records to be removed anyway.

Signed-off-by: Igor Fedotov ifed@mirantis.com

Copy link
Member

@liewegas liewegas left a comment

Choose a reason for hiding this comment

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

I think we can simplify this: the only reason we ever call update() twice is when update() itself returns true. That means that update() itself can stage the changes and only put them in t if it is sure it won't return true. Which means this change coudl be local to update() only.. right?

Also, if we can avoid the memory allocations of map<>, that would be nice. Like, put the bufferlist in Shard, and string the dirty ones together in an intrusive_list or something. Or just put single local vector<Shard*> on the local stack or something.

@ifed01
Copy link
Contributor Author

ifed01 commented Dec 14, 2016

@liewegas fixed and rebased


struct dirty_shard_t{
string* key = nullptr;
bufferlist bl;
Copy link
Member

Choose a reason for hiding this comment

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

If we put the bufferlist dirty_bl in Shard, we can avoid this structure entirely, right?

&dirty_shard_t::dirty_list_item> > dirty_shard_list_t;


vector<dirty_shard_t> encoded_shards;
Copy link
Member

Choose a reason for hiding this comment

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

and this

unsigned nn;
bufferlist& bl = encoded_shards[pos].bl;
Copy link
Member

Choose a reason for hiding this comment

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

bufferlist& bl = p->dirty_bl;

//schedule DB update for dirty shards
auto it = dirty_shards.begin();
while( it != dirty_shards.end()) {
t->set(PREFIX_OBJ, *(it->key), it->bl);
Copy link
Member

Choose a reason for hiding this comment

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

and here we'd clear dirty_bl again?

I guess this uses a bit more RAM...

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yeah, more RAM usage for a shard was the root cause why I selected the way above. I believe that we might need to think about Onode in-memory size reduction one day. Since this affects onode caching effectiveness: larger onode - less entries in the cache - worse performance. And even empty bufferlist isn't that small. Hence IMHO that's an overkill to have a bufferlist instance for each onode's shard. Especially taking into the consideration it's local use.
Still thinking we want to have it along with shard?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

And a small bonus of my approach - we don't need to enumerate ALL the shards twice. I'm iterating over dirty blobs only at the final stage.

@liewegas
Copy link
Member

liewegas commented Dec 14, 2016 via email

Igor Fedotov added 2 commits December 14, 2016 16:21
…e if reshard takes place

Signed-off-by: Igor Fedotov <ifedotov@mirantis.com>
Signed-off-by: Igor Fedotov <ifedotov@mirantis.com>
@ifed01
Copy link
Contributor Author

ifed01 commented Dec 14, 2016

@liewegas - cleaned-up

@liewegas liewegas merged commit fcbabdd into ceph:master Dec 22, 2016
@ifed01 ifed01 deleted the wip-bluestore-fix-reshard branch December 22, 2016 15:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants