mirror of
https://github.com/matrix-construct/construct
synced 2024-11-17 15:30:52 +01:00
ircd::db: Fix various error handling around db::init.
This commit is contained in:
parent
e8a9a52973
commit
2b95a65709
1 changed files with 43 additions and 3 deletions
46
ircd/db.cc
46
ircd/db.cc
|
@ -138,6 +138,7 @@ ircd::db::abi_version_str
|
||||||
//
|
//
|
||||||
|
|
||||||
ircd::db::init::init()
|
ircd::db::init::init()
|
||||||
|
try
|
||||||
{
|
{
|
||||||
init_compressions();
|
init_compressions();
|
||||||
init_directory();
|
init_directory();
|
||||||
|
@ -145,6 +146,16 @@ ircd::db::init::init()
|
||||||
init_test_hw_crc32();
|
init_test_hw_crc32();
|
||||||
request.add(request_pool_size);
|
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()
|
ircd::db::init::~init()
|
||||||
noexcept
|
noexcept
|
||||||
|
@ -203,9 +214,9 @@ try
|
||||||
}
|
}
|
||||||
catch(const fs::error &e)
|
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;
|
throw;
|
||||||
|
@ -263,6 +274,7 @@ namespace rocksdb::crc32c
|
||||||
|
|
||||||
void
|
void
|
||||||
ircd::db::init_test_hw_crc32()
|
ircd::db::init_test_hw_crc32()
|
||||||
|
try
|
||||||
{
|
{
|
||||||
const auto supported_str
|
const auto supported_str
|
||||||
{
|
{
|
||||||
|
@ -282,19 +294,28 @@ ircd::db::init_test_hw_crc32()
|
||||||
log, "crc32c hardware acceleration is not available on this platform."
|
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)
|
decltype(ircd::db::compressions)
|
||||||
ircd::db::compressions;
|
ircd::db::compressions;
|
||||||
|
|
||||||
void
|
void
|
||||||
ircd::db::init_compressions()
|
ircd::db::init_compressions()
|
||||||
|
try
|
||||||
{
|
{
|
||||||
auto supported
|
auto supported
|
||||||
{
|
{
|
||||||
rocksdb::GetSupportedCompressions()
|
rocksdb::GetSupportedCompressions()
|
||||||
};
|
};
|
||||||
|
|
||||||
for(const rocksdb::CompressionType &type : supported)
|
for(const rocksdb::CompressionType &type : supported) try
|
||||||
{
|
{
|
||||||
auto &string(compressions.at(uint(type)));
|
auto &string(compressions.at(uint(type)));
|
||||||
throw_on_error
|
throw_on_error
|
||||||
|
@ -302,6 +323,15 @@ ircd::db::init_compressions()
|
||||||
rocksdb::GetStringFromCompressionType(&string, type)
|
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())
|
if(supported.empty())
|
||||||
log::warning
|
log::warning
|
||||||
|
@ -310,6 +340,16 @@ ircd::db::init_compressions()
|
||||||
" This is probably not what you want."
|
" This is probably not what you want."
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
catch(const std::exception &e)
|
||||||
|
{
|
||||||
|
log::error
|
||||||
|
{
|
||||||
|
log, "Failed to initialize database compressions :%s",
|
||||||
|
e.what()
|
||||||
|
};
|
||||||
|
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
//
|
//
|
||||||
|
|
Loading…
Reference in a new issue