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: fix writes that span existing shard boundaries #11451
Conversation
Signed-off-by: Sage Weil <sage@redhat.com>
@@ -1675,6 +1676,7 @@ void BlueStore::ExtentMap::reshard(Onode *o, uint64_t min_alloc_size) | |||
} | |||
} | |||
} | |||
needs_reshard = false; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Put that at function entrance to cover returns from the mid of the func?
if (shards.empty()) { | ||
return false; | ||
} | ||
size_t s = seek_shard(offset); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
seek_shard returns int
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
handling for not found shard? Or assert(s>=0) if this is unexpected.
@@ -2088,6 +2090,9 @@ BlueStore::Extent *BlueStore::ExtentMap::set_lextent( | |||
b->ref_map.get(offset, length); | |||
Extent *le = new Extent(logical_offset, offset, length, blob_depth, b); | |||
extent_map.insert(*le); | |||
if (spans_shard(offset, length)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
replace with if( !needs_reshard && spans_shard....)?
LGTM except mentioned nits |
A new write may create a new lextent that spans an existing shard boundary. If that happens, set a flag so that we force a reshard when the onode is written. Signed-off-by: Sage Weil <sage@redhat.com>
3e42dfa
to
c908cae
Compare
For now I take the simple strategy and force a reshard if we happen to write across a boundary. I susepct the optimal solution is a bit more nuanced. For example, big writes could be split, but small writes probably shouldn't be. Or, better yet, this sort of write could just move the shard boundary over, or otherwise trigger a partial reshard. I'm happy leaving that for future work, though!