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/ObjectStore: properly clear object map when replaying OP_REMOVE #11388
Conversation
fdcache.clear(o); | ||
return 0; | ||
} else if (hardlink == 1) { | ||
if (hardlink == 0 || hardlink == 1) { |
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.
we always clear omap first, and then unlink the object file. so, if the hardlink
is 1 here, we should have cleared the omap already, am i right?
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.
why? we get object file's hardlink count before clearing omap and unlinking object file. hardlink == 1 is the most common case
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.
So to clarify the situation is
- clear omap
- unlink
- unlink persists to disk, but omap does not
- crash
- replay sees hardlink 0 and doesn't clear omap
?
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.
yes
To remove an object, filestore needs to unlink corresponding object file from filesystem and removes corresponding object keys from DBObjectMap. When replaying OP_REMOVE operation, it's possible the operation has completed partially, object file has been deleted, but object keys in DBObjectMap hasn't. The fix is force clear object keys if object file does not exists Fixes: http://tracker.ceph.com/issues/17177 Signed-off-by: Yan, Zheng <zyan@redhat.com>
…_RENAME FileStore::_close_replay_guard does not sync the object map. If OSD crashes while executing FileStore::_collection_move_rename, it's possible that the replay guard is set, but the object map map update gets lost. When recovering, OSD checks the replay guard and does nothing. The fix is sync the object map in FileStore::_close_replay_guard() Signed-off-by: Yan, Zheng <zyan@redhat.com>
ping @athanatos @liewegas @tchaikov |
lgtm! |
lgtm! (Whoa, good catch!) |
lgtm also. |
Thanks @ukernel Hopefully we can get this merged soon. |
To remove an object, filestore needs to unlink corresponding object
file from filesystem and removes corresponding object keys from
DBObjectMap. When replaying OP_REMOVE operation, it's possible the
operation has completed partially, object file has been deleted, but
object keys in DBObjectMap hasn't.
The fix is force clear object keys if object file does not exists
Fixes: http://tracker.ceph.com/issues/17177
Signed-off-by: Yan, Zheng zyan@redhat.com