Skip to content

Commit

Permalink
os/bluestore: avoid resharding if the last shard size fall below shar…
Browse files Browse the repository at this point in the history
…d min size

Signed-off-by: Igor Fedotov <ifedotov@mirantis.com>
  • Loading branch information
Igor Fedotov committed Dec 12, 2016
1 parent 51342e8 commit c8a567b
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions src/os/bluestore/BlueStore.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1608,23 +1608,28 @@ bool BlueStore::ExtentMap::update(Onode *o, KeyValueDB::Transaction t,
endoff = n->offset;
}
bufferlist bl;
unsigned n;
if (encode_some(p->offset, endoff - p->offset, bl, &n)) {
unsigned nn;
if (encode_some(p->offset, endoff - p->offset, bl, &nn)) {
return true;
}
size_t len = bl.length();
dout(20) << __func__ << " shard 0x" << std::hex
<< p->offset << std::dec << " is " << len
<< " bytes (was " << p->shard_info->bytes << ") from " << n
<< " bytes (was " << p->shard_info->bytes << ") from " << nn
<< " extents" << dendl;

//indicate need for reshard if force mode selected, len > shard_max size OR
//non-last shard size is below the min threshold. The last check is to avoid potential
//unneeded reshardings since this might trigger permanent resharding .
if (!force &&
(len > g_conf->bluestore_extent_map_shard_max_size ||
len < g_conf->bluestore_extent_map_shard_min_size)) {
( n != shards.end() && len < g_conf->bluestore_extent_map_shard_min_size)
)) {
return true;
}
assert(p->shard_info->offset == p->offset);
p->shard_info->bytes = len;
p->shard_info->extents = n;
p->shard_info->extents = nn;
t->set(PREFIX_OBJ, p->key, bl);
p->dirty = false;
}
Expand Down

0 comments on commit c8a567b

Please sign in to comment.