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

rbd: When Ceph cluster becomes full, should allow user to remove rbd … #12627

Merged
merged 3 commits into from Mar 3, 2017
Merged

rbd: When Ceph cluster becomes full, should allow user to remove rbd … #12627

merged 3 commits into from Mar 3, 2017

Conversation

liupan1111
Copy link
Contributor

…and snapshot in order to release storage space.

Signed-off-by: Pan Liu pan.liu@istuary.com

@liupan1111
Copy link
Contributor Author

At this moment, the behavior is "hang the client".

@@ -1153,6 +1153,7 @@ namespace librados
int get_object_pg_hash_position2(const std::string& oid, uint32_t *pg_hash_position);

config_t cct();
IoCtxImpl *get_impl() {return io_ctx_impl;}
Copy link
Contributor

Choose a reason for hiding this comment

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

I don't think it's a good idea to expose implementation to user. Maybe adding an interface for what you want is better.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

agree, will modify later, thanks.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done, thanks.

@liupan1111
Copy link
Contributor Author

@liewegas, @tchaikov, please help take a look, thanks!

@@ -110,7 +110,7 @@ int get_formatter(const boost::program_options::variables_map &vm,
void init_context();

int init(const std::string &pool_name, librados::Rados *rados,
librados::IoCtx *io_ctx);
librados::IoCtx *io_ctx, bool force = false);
Copy link

Choose a reason for hiding this comment

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

The parameter name of force doesn't really align (name-wise) with what it is actually doing behind the scenes which is to force-apply a special flag to the OSDs. Also, assuming there are no issues w/ the librados changes by others, I don't think this is the correct place to do this. Seems like you should be able to set this flag after opening the image for the remove actions so you don't need to put it in this common location.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@dillaman, Thank you for The review! I agree this change should better not be placed in Such a common place like init. I will modify it.

@dillaman dillaman added the core label Jan 10, 2017
@liupan1111
Copy link
Contributor Author

@dillaman, I've commit a new one, please help take a look.

@dillaman
Copy link

The rbd changes look good to me -- a member of the core team needs to evaluate the changes to librados and the OSDs.

@@ -1848,7 +1848,8 @@ void PrimaryLogPG::do_op(OpRequestRef& op)
<< *m << dendl;
return;
}
if (!(m->get_source().is_mds()) && osd->check_failsafe_full() && write_ordered) {
if (!(m->get_source().is_mds()) && osd->check_failsafe_full() &&
!m->has_flag(CEPH_OSD_FLAG_FULL_FORCE) && write_ordered) {
Copy link
Member

Choose a reason for hiding this comment

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

I don't think we want to touch the failsafe condition!

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The ops of deleting an image will be discarded here if don’t touch the failsafe condition

@@ -1154,6 +1154,9 @@ namespace librados

config_t cct();

void set_honor_osdmap_full();
void unset_honor_osdmap_full();

Copy link
Member

Choose a reason for hiding this comment

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

Instead of exposing this, you can use the existing librados op flag:

src/include/rados/librados.hpp:    OPERATION_FULL_TRY           = LIBRADOS_OPERATION_FULL_TRY,

FULL_TRY makes the OSD assemble the transaction and proceed only if it does not result in a net increase in utilization. This should be true for deleting objects.

There's also a FORCE variant, but I don't think you should need it...

Copy link
Contributor Author

Choose a reason for hiding this comment

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

In “Objecter::_prepare_osd_op”, “CEPH_OSD_FLAG_FULL_FORCE” is set before sent op to an OSD, if “honor_osdmap_full” is false. When removing an image, several ops, like open, delete, watch, will be sent to the OSD, it’s difficult to set FULL_TRY flag for these ops one by one.

Copy link
Member

Choose a reason for hiding this comment

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

Hmm, in that case, the FULL_TRY flag can be set in the same place as the FULL_FORCE flag: Objecter::_prepare_osd_op(). So you can add {set,unset}_osdmap_full_try(), and set the flag in one place, and then use that.

I really think we should use FULL_TRY unless we find there is some reason that can't work... if that's the case we have a bigger problem!

Copy link
Member

Choose a reason for hiding this comment

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

It would still be far preferably to use the existing librados flags, though! Please try that appraoch first.. hopefully there is a central place wehre that can be done, or add an ImageCtx 'rados_flags' variable that is |'d in to every request.

@liewegas
Copy link
Member

liewegas commented Jan 17, 2017 via email

@liewegas
Copy link
Member

liewegas commented Jan 17, 2017 via email

@liupan1111
Copy link
Contributor Author

In that case, let's do one patch that rneames honor_osdmap_full to
set_full_force() (with opposite argument... false by default, true for
enable), and then another patch that adds a new set_full_try().

@liewegas, do you mean I need rename honor_osdmap_full or set_honor_osdmap_full()?

@liupan1111
Copy link
Contributor Author

@liewegas, this failsafe is not triggered by my modification... it will be called even without my changes...

@liupan1111
Copy link
Contributor Author

@liewegas Ping

@liupan1111
Copy link
Contributor Author

@liewegas, Could you help take a look? thanks.

@dillaman
Copy link

@liupan1111 I don't see any changes. I thought Sage was suggesting that you re-use the existing librados flag for allowing ops to proceed on full(?). Assuming that is the case, I think you would want to modify librbd to set the flag where needed when opening the image and set the flag on the individual ops issued on the remove / snap remove paths.

@@ -730,7 +730,7 @@ void init_context() {
}

int init(const std::string &pool_name, librados::Rados *rados,
librados::IoCtx *io_ctx) {
librados::IoCtx *io_ctx, bool force) {
Copy link
Member

Choose a reason for hiding this comment

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

Like @dillaman said, this should also be a more descriptive name... bool force_full_try probably

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yes, I will modify it.

Pan Liu added 3 commits February 26, 2017 08:20
Signed-off-by: Pan Liu <liupan1111@gmail.com>
Signed-off-by: Pan Liu <liupan1111@gmail.com>
…full.

Signed-off-by: Pan Liu <liupan1111@gmail.com>
@liupan1111
Copy link
Contributor Author

@dillaman @liewegas , I've modified as your comment, please help take a look. Thanks!

Copy link

@dillaman dillaman left a comment

Choose a reason for hiding this comment

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

rbd changes lgtm

@yuriw yuriw merged commit c4c7bce into ceph:master Mar 3, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
5 participants