0
0
Fork 0
mirror of https://github.com/matrix-construct/construct synced 2024-09-30 04:38:52 +02:00

ircd::db: Improve error propagation and reporting on _seek().

This commit is contained in:
Jason Volk 2020-02-27 14:49:26 -08:00
parent 79786f7076
commit 9b5e4f8d48

View file

@ -7472,7 +7472,7 @@ ircd::db::throw_on_error::throw_on_error(const rocksdb::Status &status)
throw not_found{}; throw not_found{};
#ifdef RB_DEBUG #ifdef RB_DEBUG
case Status::kCorruption: //case Status::kCorruption:
case Status::kNotSupported: case Status::kNotSupported:
case Status::kInvalidArgument: case Status::kInvalidArgument:
debugtrap(); debugtrap();
@ -7730,6 +7730,7 @@ ircd::db::_seek(database::column &c,
const string_view &p, const string_view &p,
const rocksdb::ReadOptions &opts, const rocksdb::ReadOptions &opts,
rocksdb::Iterator &it) rocksdb::Iterator &it)
try
{ {
const ctx::uninterruptible ui; const ctx::uninterruptible ui;
@ -7756,12 +7757,28 @@ ircd::db::_seek(database::column &c,
return valid(it); return valid(it);
} }
catch(const error &e)
{
const database &d(*c.d);
log::critical
{
log, "[%s][%s] %lu:%lu SEEK key :%s",
name(d),
name(c),
sequence(d),
sequence(opts.snapshot),
e.what(),
};
throw;
}
bool bool
ircd::db::_seek(database::column &c, ircd::db::_seek(database::column &c,
const pos &p, const pos &p,
const rocksdb::ReadOptions &opts, const rocksdb::ReadOptions &opts,
rocksdb::Iterator &it) rocksdb::Iterator &it)
try
{ {
const ctx::stack_usage_assertion sua; const ctx::stack_usage_assertion sua;
@ -7793,6 +7810,22 @@ ircd::db::_seek(database::column &c,
return valid(it); return valid(it);
} }
catch(const error &e)
{
const database &d(*c.d);
log::critical
{
log, "[%s][%s] %lu:%lu SEEK %s :%s",
name(d),
name(c),
sequence(d),
sequence(opts.snapshot),
reflect(p),
e.what(),
};
throw;
}
/// Seek to entry NOT GREATER THAN key. That is, equal to or less than key /// Seek to entry NOT GREATER THAN key. That is, equal to or less than key
rocksdb::Iterator & rocksdb::Iterator &
@ -7924,22 +7957,7 @@ ircd::db::valid(const rocksdb::Iterator &it)
case Status::kOk: case Status::kOk:
case Status::kNotFound: case Status::kNotFound:
case Status::kIncomplete: case Status::kIncomplete:
break; return it.Valid();
case Status::kCorruption:
{
const db::error error
{
it.status()
};
log::critical
{
log, "%s", error.what()
};
[[fallthrough]];
}
default: default:
throw_on_error throw_on_error
@ -7949,8 +7967,6 @@ ircd::db::valid(const rocksdb::Iterator &it)
__builtin_unreachable(); __builtin_unreachable();
} }
return it.Valid();
} }
// //