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
mon: fixes related to mondbstore->get() changes #6564
Conversation
a6ce0b1
to
378ec6b
Compare
378ec6b
to
5250e8d
Compare
int r = db->get(prefix, key, &outbl); | ||
if (!r) { | ||
bl.append(outbl); | ||
} |
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.
I think this can be further simplified to just pass &bl to db->get()?
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.
Only if we can assert that db->get won't totally overwrite bl (i. e. clear() + append()) and/or every case of MontitorDBStore->get() doesn't care about existing contents (if any) of passed bl. I wasn't sure about that and decided to leave this like that.
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.
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.
I actually had different idea. Instead of that, it would be possible to add something like value_as_ptr() to KeyValueDB iterators, which return bufferptr instead of entire bufferlist. That way, db->get would be appending returned bufferptr to specified bufferlist, removing the need for two interim bufferlists (one in KeyValueDBIter->value() and another one in MonitorDBStore). Not sure if this should go with this PR though...
@branch-predictor the bot failure is due to a temporary network failure, could you please rebase and repush to get a fresh run ? Sorry for the inconvenience. |
2f5b908
to
631b2ab
Compare
Went through some testing: http://149.202.170.61:8081/ubuntu-2015-12-05_13:32:24-rados:monthrash-bp-fix-mon-kv-store---basic-openstack/ |
Since store->get() returns -ENOENT when key doesn't exists, there's no longer needed to explicitly check for its existence. Signed-off-by: Piotr Dałek <piotr.dalek@ts.fujitsu.com>
When MonDBStore returns ENOENT when trying to get mkfs keyring, monitor crashes with assert. On the other hand, if it returned 0 and empty bufferlist, all was fine - so make it decode the bufferlist only when MonDBStore returned 0, don't fail on ENOENT (and don't try to decode empty bufferlist in that case), and fail hard otherwise. Signed-off-by: Piotr Dałek <piotr.dalek@ts.fujitsu.com>
Make MonitorDBStore use single-key ::get() method for some performance increase in heavy K/V workloads. Signed-off-by: Piotr Dałek <piotr.dalek@ts.fujitsu.com>
When Monitor::read_features_off_disk doesn't find features on disk, it tries to write them back to disk. featuresbl is known to be empty, so just reuse it instead of constructing second one. Signed-off-by: Piotr Dałek <piotr.dalek@ts.fujitsu.com>
Assume failure when either MonDBStore returns error or returns empty bufferlist. Signed-off-by: Piotr Dałek <piotr.dalek@ts.fujitsu.com>
…ound. Monitor::preinit wrongly assumes that keyring always exists. This worked so far because the logic that followed made this error invisible. Change the logic so no attempt is taken to decode empty bufferlist, and in turn - to extract_save_mon_key from empty keyring. Signed-off-by: Piotr Dałek <piotr.dalek@ts.fujitsu.com>
sync_obtain_latest_monmap will fail with assertion failure if store->get() returns error, but there's an extra assert for ENOENT error which causes mon to crash without putting any extra info into derr. Remove this extra assert. When call to load_metadata will fail in get_mon_metadata, no human-readable error is emitted. Add cpp_strerror to output. check_fsid() has checked for cluster_uuid twice, once in store->exists, then in store->get(), which is unnecessary because store->get returns correct error codes. Added two comments regrding code that doesn't handle (at all) errors from store->get(). Signed-off-by: Piotr Dałek <piotr.dalek@ts.fujitsu.com>
631b2ab
to
1d84219
Compare
mon: fixes related to mondbstore->get() changes Reviewed-by: Sage Weil <sage@redhat.com>
Mon, in general, was assuming that db store doesn't return errors when key
is not found, and when 66b7b92 was
introduced, an assert was being triggered in AuthMonitor which turned out
to be wrong. This changeset fixes that and the following issues stemming
from that change:
Monitor::check_fsid
doesn't find the key
is already empty
This changeset also reverts d548b5f which
is a revert of 66b7b92.
Signed-off-by: Piotr Dałek piotr.dalek@ts.fujitsu.com