Skip to content

crush: encode can override weights with weight set#15002

Merged
liewegas merged 2 commits intomasterfrom
unknown repository
May 17, 2017
Merged

crush: encode can override weights with weight set#15002
liewegas merged 2 commits intomasterfrom
unknown repository

Conversation

@ghost
Copy link

@ghost ghost commented May 8, 2017

Encode a "legacy" crushmap if (1) we're using weight sets, (2) the
client is lacking features for the weight set, but (3) the weight set
has a single position and no id remapping. Since these maps are only
used by clients (not humans), then there is no need to preserve the
original crush weights. We can just swap them for the real weights and
the legacy clients will behave as expected.

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

Signed-off-by: Loic Dachary loic@dachary.org

@ghost
Copy link
Author

ghost commented May 8, 2017

@liewegas it's slightly different from what you suggested in #14959. If that's ok with you I'll add tests.


void CrushWrapper::get_incompat_choose_args(std::map<__u32, crush_choose_arg*> &i2choose_arg)
{
if (HAVE_FEATURE(CRUSH_CHOOSEARGS))
Copy link
Member

Choose a reason for hiding this comment

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

this is missing a feature arg.. needs to be passed through from encode()?

arg->ids_size == 0)
continue;
id2choose_arg[i] = arg;
}
Copy link
Member

Choose a reason for hiding this comment

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

it seems like this second part is just repackaging an existing vector/array as a map. the important part is the compatibility check that happens above. maybe recast this function to return bool (can_encode_compat_choose_args), do a check vs features (and assert out if it's not compat but the feature is missing). then in the straw2 encode if a bool should_encode_compat_choose_args is true look up the bucket weights directly in the arg_map[bucketno] array?

@ghost
Copy link
Author

ghost commented May 8, 2017

The map was indeed entirely redundant... fixed and repushed.

@ghost ghost changed the title crush: encode can override weights with weight set WIP: crush: encode can override weights with weight set May 8, 2017
@ghost ghost changed the title WIP: crush: encode can override weights with weight set DNM: crush: encode can override weights with weight set May 8, 2017
@ghost
Copy link
Author

ghost commented May 8, 2017

needs rebase once #14959 is merged


bool CrushWrapper::can_encode_compat_choose_args() const
{
if (choose_args.size() != 1)
Copy link
Member

Choose a reason for hiding this comment

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

1? an empty choose_args is 'compat'...


bool encode_compat_choose_args = false;
crush_choose_arg_map arg_map;
if (choose_args.size() > 0 &&
Copy link
Member

Choose a reason for hiding this comment

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

ah, nm.

@liewegas
Copy link
Member

liewegas commented May 8, 2017

yay!

@ghost
Copy link
Author

ghost commented May 8, 2017

I'm not sure I get the sequence right.

  • a pre-luminous client connects a does not have the choose_arg feature
  • the cluster has a non compatible crushmap with choose args that can't be converted
  • the assert happens and crashes the monitor :-)

That must not be how it happens

@liewegas
Copy link
Member

liewegas commented May 8, 2017

Actually this is possible... we should change that assert to a strong warning.

We don't have a way currently to track the features supported by currently-connected clients; we only control the connection of new clients.

@ghost
Copy link
Author

ghost commented May 8, 2017

Does it mean existing client may get an incorrect crushmap as a result ?

@liewegas
Copy link
Member

liewegas commented May 8, 2017 via email

@ghost
Copy link
Author

ghost commented May 8, 2017

So, the other part of this pull request is to set require_min_compat_client to luminous whenever a crushmap with choose_args is uploaded and it cannot be encoded in a backward compatible way. Right ?

@liewegas
Copy link
Member

liewegas commented May 9, 2017

That option is meant to work teh other way around: it would prevent you from uploading a crush map that uses choose_args (or doing any other command that would change the features that clients have to support) until teh admin makes a policy decision and changes the required_min_compat_client option.

I think teh main missing piece here is the get_features() call in OSDMap; I think you should rebase this on top of wip-crush-compat and then make sure it is using the has_incompat_chooseargs() instead of has_chooseargs() helper. That way get_featuers() will not indicate that the new luminous features are required if the choose_args are sufficiently simple...

@liewegas
Copy link
Member

liewegas commented May 9, 2017

#14959 is merged; this can be rebased now!

@ghost
Copy link
Author

ghost commented May 9, 2017

\o/

@ghost ghost changed the title DNM: crush: encode can override weights with weight set crush: encode can override weights with weight set May 9, 2017
@ghost ghost changed the title crush: encode can override weights with weight set DNM: crush: encode can override weights with weight set May 9, 2017
@ghost
Copy link
Author

ghost commented May 9, 2017

@liewegas is there a way to set the features of the client ? Something like ceph --feature luminous ? I found how to set the mon features :-)

@ghost
Copy link
Author

ghost commented May 9, 2017

if there is no way for a client to pretend to be kraken, 59c104e is another possible implementation for the test. The downside is that it takes an hour at least to run which makes debugging longer.

@liewegas
Copy link
Member

liewegas commented May 10, 2017 via email

@ghost
Copy link
Author

ghost commented May 10, 2017

I'll write a test function in test/crush/CrushWrapper.cc

@ghost ghost changed the title DNM: crush: encode can override weights with weight set crush: encode can override weights with weight set May 11, 2017
@ghost
Copy link
Author

ghost commented May 11, 2017

@liewegas repushed with tests & caught a bug, useful :-)

@ghost
Copy link
Author

ghost commented May 11, 2017

148 - osd-scrub-repair.sh (Failed)

jenkins test this please

ldachary added 2 commits May 12, 2017 17:17
Signed-off-by: Loic Dachary <loic@dachary.org>
Encode a "legacy" crushmap if (1) we're using weight sets, (2) the
client is lacking features for the weight set, but (3) the weight set
has a single position and no id remapping. Since these maps are only
used by clients (not humans), then there is no need to preserve the
original crush weights. We can just swap them for the real weights and
the legacy clients will behave as expected.

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

Signed-off-by: Loic Dachary <loic@dachary.org>
@ghost
Copy link
Author

ghost commented May 12, 2017

rebased & repushed

@ghost ghost added the needs-qa label May 12, 2017
@ghost
Copy link
Author

ghost commented May 12, 2017

(for the record make check succeeded before I rebased & repushed but there was a conflict)

@liewegas liewegas merged commit 81bd302 into ceph:master May 17, 2017
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.

2 participants