Skip to content
Snippets Groups Projects
Commit 5cb376d4 authored by Cedric CAFFY's avatar Cedric CAFFY
Browse files

Corrected cta-objectstore-initialize program. The agent needed to initialize...

Corrected cta-objectstore-initialize program. The agent needed to initialize the objectstore was not locked so could not be deleted.
If this program fails for whatever reason, it will return EXIT_FAILURE and not EXIT_SUCCESS
parent d0e5ad1f
No related branches found
Tags v0.0-186
No related merge requests found
......@@ -34,10 +34,10 @@
#include <stdexcept>
int main(int argc, char ** argv) {
std::unique_ptr<cta::objectstore::Backend> be;
try {
cta::log::StdoutLogger logger(cta::utils::getShortHostname(), "cta-objectstore-initialize");
cta::log::LogContext lc(logger);
std::unique_ptr<cta::objectstore::Backend> be;
if (1 == argc) {
be.reset(new cta::objectstore::BackendVFS);
} else if (2 == argc) {
......@@ -66,11 +66,17 @@ int main(int argc, char ** argv) {
re.fetch();
re.addOrGetDriveRegisterPointerAndCommit(agr, el);
re.addOrGetSchedulerGlobalLockAndCommit(agr,el);
ag.removeAndUnregisterSelf(lc);
{
cta::objectstore::ScopedExclusiveLock agentLock(ag);
ag.fetch();
ag.removeAndUnregisterSelf(lc);
}
rel.release();
std::cout << "New object store path: " << be->getParams()->toURL() << std::endl;
return EXIT_SUCCESS;
} catch (std::exception & e) {
std::cerr << "Failed to initialise the root entry in a new VFS backend store"
std::cerr << "Failed to initialise the root entry in a new " << be->typeName() << " objectstore"
<< std::endl << e.what() << std::endl;
return EXIT_FAILURE;
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment