0
0
Fork 0
mirror of https://github.com/matrix-construct/construct synced 2024-11-26 00:32:35 +01:00

ircd::db: Fix various error handling around db::init.

This commit is contained in:
Jason Volk 2019-05-23 22:43:41 -07:00
parent e8a9a52973
commit 2b95a65709

View file

@ -138,6 +138,7 @@ ircd::db::abi_version_str
//
ircd::db::init::init()
try
{
init_compressions();
init_directory();
@ -145,6 +146,16 @@ ircd::db::init::init()
init_test_hw_crc32();
request.add(request_pool_size);
}
catch(const std::exception &e)
{
log::critical
{
log, "Cannot start database system :%s",
e.what()
};
throw;
}
ircd::db::init::~init()
noexcept
@ -203,9 +214,9 @@ try
}
catch(const fs::error &e)
{
log::critical
log::error
{
log, "Cannot start database system: %s", e.what()
log, "Database directory error: %s", e.what()
};
throw;
@ -263,6 +274,7 @@ namespace rocksdb::crc32c
void
ircd::db::init_test_hw_crc32()
try
{
const auto supported_str
{
@ -282,19 +294,28 @@ ircd::db::init_test_hw_crc32()
log, "crc32c hardware acceleration is not available on this platform."
};
}
catch(const std::exception &e)
{
log::error
{
log, "Failed to test crc32c hardware acceleration support :%s",
e.what()
};
}
decltype(ircd::db::compressions)
ircd::db::compressions;
void
ircd::db::init_compressions()
try
{
auto supported
{
rocksdb::GetSupportedCompressions()
};
for(const rocksdb::CompressionType &type : supported)
for(const rocksdb::CompressionType &type : supported) try
{
auto &string(compressions.at(uint(type)));
throw_on_error
@ -302,6 +323,15 @@ ircd::db::init_compressions()
rocksdb::GetStringFromCompressionType(&string, type)
};
}
catch(const std::exception &e)
{
log::error
{
log, "Failed to identify compression type:%u :%s",
uint(type),
e.what()
};
}
if(supported.empty())
log::warning
@ -310,6 +340,16 @@ ircd::db::init_compressions()
" This is probably not what you want."
};
}
catch(const std::exception &e)
{
log::error
{
log, "Failed to initialize database compressions :%s",
e.what()
};
throw;
}
///////////////////////////////////////////////////////////////////////////////
//