Skip to content
Snippets Groups Projects
Commit 7b866d15 authored by Eric Cano's avatar Eric Cano
Browse files

Added name of object in rados failure exception messages

Name of object was already present in some errors but not all.
parent 04417b4f
Branches
Tags
No related merge requests found
......@@ -60,7 +60,7 @@ void BackendRados::create(std::string name, std::string content) {
bl.append(content.c_str(), content.size());
wop.write_full(bl);
cta::exception::Errnum::throwOnReturnedErrno(-m_radosCtx.operate(name, &wop),
std::string("In ObjectStoreRados::create, failed to create exclusively or write ")
std::string("In ObjectStoreRados::create, failed to create exclusively or write: ")
+ name);
}
......@@ -71,7 +71,7 @@ void BackendRados::atomicOverwrite(std::string name, std::string content) {
bl.append(content.c_str(), content.size());
wop.write_full(bl);
cta::exception::Errnum::throwOnReturnedErrno(-m_radosCtx.operate(name, &wop),
std::string("In ObjectStoreRados::atomicOverwrite, failed to assert existence or write ")
std::string("In ObjectStoreRados::atomicOverwrite, failed to assert existence or write: ")
+ name);
}
......@@ -80,11 +80,11 @@ std::string BackendRados::read(std::string name) {
uint64_t size;
time_t time;
cta::exception::Errnum::throwOnReturnedErrno(-m_radosCtx.stat(name, &size, &time),
std::string("In ObjectStoreRados::read, failed to stat ")
std::string("In ObjectStoreRados::read, failed to stat: ")
+ name);
librados::bufferlist bl;
cta::exception::Errnum::throwOnNegative(m_radosCtx.read(name, bl, size, 0),
std::string("In ObjectStoreRados::read, failed to read ")
std::string("In ObjectStoreRados::read, failed to read: ")
+ name);
bl.copy(0, size, ret);
return ret;
......@@ -124,7 +124,7 @@ void BackendRados::ScopedLock::release() {
break;
default:
cta::exception::Errnum::throwOnReturnedErrno(-rc,
std::string("In cta::objectstore::ScopedLock::release, failed unlock ") +
std::string("In cta::objectstore::ScopedLock::release, failed unlock: ") +
m_oid);
break;
}
......@@ -181,7 +181,7 @@ BackendRados::ScopedLock* BackendRados::lockExclusive(std::string name) {
cta::exception::Errnum::throwOnReturnedErrno (-m_radosCtx.remove(name),
std::string("In ObjectStoreRados::lockExclusive, failed to librados::IoCtx::remove: ") +
name + "//");
throw cta::exception::Errnum(ENOENT, "In BackendRados::lockExclusive(): trying to lock a non-existing object");
throw cta::exception::Errnum(ENOENT, std::string("In BackendRados::lockExclusive(): trying to lock a non-existing object: ") + name);
}
ret->set(name, client);
return ret.release();
......@@ -216,7 +216,7 @@ BackendRados::ScopedLock* BackendRados::lockShared(std::string name) {
cta::exception::Errnum::throwOnReturnedErrno (-m_radosCtx.remove(name),
std::string("In ObjectStoreRados::lockShared, failed to librados::IoCtx::remove: ") +
name + "//");
throw cta::exception::Errnum(ENOENT, "In BackendRados::lockShared(): trying to lock a non-existing object");
throw cta::exception::Errnum(ENOENT, std::string ("In BackendRados::lockShared(): trying to lock a non-existing object") + name);
}
ret->set(name, client);
return ret.release();
......@@ -235,7 +235,7 @@ BackendRados::AsyncUpdater::AsyncUpdater(BackendRados& be, const std::string& na
auto rc=m_backend.m_radosCtx.aio_stat(name, aioc, &m_size, &date);
aioc->release();
if (rc) {
cta::exception::Errnum errnum (-rc, "In BackendRados::AsyncUpdater::AsyncUpdater(): failed to launch aio_stat()");
cta::exception::Errnum errnum (-rc, std::string("In BackendRados::AsyncUpdater::AsyncUpdater(): failed to launch aio_stat(): ")+name);
throw Backend::NoSuchObject(errnum.getMessageValue());
}
} catch (...) {
......@@ -250,7 +250,7 @@ void BackendRados::AsyncUpdater::statCallback(librados::completion_t completion,
// Check that the object exists.
if (rados_aio_get_return_value(completion)) {
cta::exception::Errnum errnum(-rados_aio_get_return_value(completion),
"In BackendRados::AsyncUpdater::statCallback(): could not stat object: ");
std::string("In BackendRados::AsyncUpdater::statCallback(): could not stat object: ") + au.m_name);
throw Backend::NoSuchObject(errnum.getMessageValue());
}
// It does! Let's lock it. Rados does not have aio_lock, so we do it in an async.
......@@ -283,7 +283,7 @@ void BackendRados::AsyncUpdater::statCallback(librados::completion_t completion,
rc=au.m_backend.m_radosCtx.aio_read(au.m_name, aioc, &au.m_radosBufferList, au.m_size, 0);
aioc->release();
if (rc) {
cta::exception::Errnum errnum (-rc, "In BackendRados::AsyncUpdater::AsyncUpdater(): failed to launch aio_stat()");
cta::exception::Errnum errnum (-rc, std::string("In BackendRados::AsyncUpdater::AsyncUpdater(): failed to launch aio_stat(): ") + au.m_name);
throw Backend::CouldNotFetch(errnum.getMessageValue());
}
} catch (...) {
......@@ -304,7 +304,7 @@ void BackendRados::AsyncUpdater::fetchCallback(librados::completion_t completion
// Check that the object could be read.
if (rados_aio_get_return_value(completion)<0) {
cta::exception::Errnum errnum(-rados_aio_get_return_value(completion),
"In BackendRados::AsyncUpdater::statCallback(): could not read object: ");
std::string("In BackendRados::AsyncUpdater::statCallback(): could not read object: ") + au.m_name);
throw Backend::CouldNotFetch(errnum.getMessageValue());
}
// We can now launch the update operation
......@@ -318,8 +318,8 @@ void BackendRados::AsyncUpdater::fetchCallback(librados::completion_t completion
au.m_radosBufferList.copy(0, au.m_size, value);
} catch (std::exception & ex) {
throw CouldNotUpdateValue(
std::string("In In BackendRados::AsyncUpdater::fetchCallback::update_lambda(): failed to read buffer: ")
+ ex.what());
std::string("In In BackendRados::AsyncUpdater::fetchCallback::update_lambda(): failed to read buffer: ") +
au.m_name + ": "+ ex.what());
}
// Execute the user's callback. Let exceptions fly through. User knows his own exceptions.
value=au.m_update(value);
......@@ -329,8 +329,8 @@ void BackendRados::AsyncUpdater::fetchCallback(librados::completion_t completion
au.m_radosBufferList.append(value);
} catch (std::exception & ex) {
throw CouldNotUpdateValue(
std::string("In In BackendRados::AsyncUpdater::fetchCallback::update_lambda(): failed to prepare write buffer(): ")
+ ex.what());
std::string("In In BackendRados::AsyncUpdater::fetchCallback::update_lambda(): failed to prepare write buffer(): ") +
au.m_name + ": " + ex.what());
}
// Launch the write
librados::AioCompletion * aioc = librados::Rados::aio_create_completion(pThis, commitCallback, nullptr);
......@@ -338,7 +338,7 @@ void BackendRados::AsyncUpdater::fetchCallback(librados::completion_t completion
aioc->release();
if (rc) {
cta::exception::Errnum errnum (-rc,
"In BackendRados::AsyncUpdater::fetchCallback::update_lambda(): failed to launch aio_write_full()");
std::string("In BackendRados::AsyncUpdater::fetchCallback::update_lambda(): failed to launch aio_write_full(): ") + au.m_name);
throw Backend::CouldNotCommit(errnum.getMessageValue());
}
} catch (...) {
......@@ -359,7 +359,7 @@ void BackendRados::AsyncUpdater::commitCallback(librados::completion_t completio
// Check that the object could be written.
if (rados_aio_get_return_value(completion)) {
cta::exception::Errnum errnum(-rados_aio_get_return_value(completion),
"In BackendRados::AsyncUpdater::commitCallback(): could not write object: ");
std::string("In BackendRados::AsyncUpdater::commitCallback(): could not write object: ")+au.m_name);
throw Backend::CouldNotCommit(errnum.getMessageValue());
}
// Launch the async unlock.
......@@ -367,7 +367,7 @@ void BackendRados::AsyncUpdater::commitCallback(librados::completion_t completio
auto rc=au.m_backend.m_radosCtx.aio_unlock(au.m_name, "lock", au.m_lockClient, aioc);
aioc->release();
if (rc) {
cta::exception::Errnum errnum (-rc, "In BackendRados::AsyncUpdater::commitCallback(): failed to launch aio_unlock()");
cta::exception::Errnum errnum (-rc, std::string("In BackendRados::AsyncUpdater::commitCallback(): failed to launch aio_unlock()")+au.m_name);
throw Backend::CouldNotUnlock(errnum.getMessageValue());
}
} catch (...) {
......@@ -382,7 +382,7 @@ void BackendRados::AsyncUpdater::unlockCallback(librados::completion_t completio
// Check that the object could be unlocked.
if (rados_aio_get_return_value(completion)) {
cta::exception::Errnum errnum(-rados_aio_get_return_value(completion),
"In BackendRados::AsyncUpdater::unlockCallback(): could not unlock object: ");
std::string("In BackendRados::AsyncUpdater::unlockCallback(): could not unlock object: ")+au.m_name);
throw Backend::CouldNotUnlock(errnum.getMessageValue());
}
// Done!
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment