mirror of
https://github.com/matrix-construct/construct
synced 2024-11-19 16:30:52 +01:00
ircd::db: Add separate check(database); Add log notice when checking on open.
This commit is contained in:
parent
02fde9e09f
commit
9d5afc8e87
2 changed files with 17 additions and 4 deletions
|
@ -50,6 +50,7 @@ namespace ircd::db
|
||||||
void setopt(database &, const string_view &key, const string_view &val);
|
void setopt(database &, const string_view &key, const string_view &val);
|
||||||
void fdeletions(database &, const bool &enable, const bool &force = false);
|
void fdeletions(database &, const bool &enable, const bool &force = false);
|
||||||
void checkpoint(database &, const string_view &dir);
|
void checkpoint(database &, const string_view &dir);
|
||||||
|
void check(database &);
|
||||||
void compact(database &);
|
void compact(database &);
|
||||||
void sort(database &, const bool &blocking = true);
|
void sort(database &, const bool &blocking = true);
|
||||||
void flush(database &, const bool &sync = false);
|
void flush(database &, const bool &sync = false);
|
||||||
|
|
20
ircd/db.cc
20
ircd/db.cc
|
@ -174,6 +174,16 @@ ircd::db::compact(database &d)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
ircd::db::check(database &d)
|
||||||
|
{
|
||||||
|
assert(d.d);
|
||||||
|
throw_on_error
|
||||||
|
{
|
||||||
|
d.d->VerifyChecksum()
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
/// Writes a snapshot of this database to the directory specified. The
|
/// Writes a snapshot of this database to the directory specified. The
|
||||||
/// snapshot consists of hardlinks to the bulk data files of this db, but
|
/// snapshot consists of hardlinks to the bulk data files of this db, but
|
||||||
/// copies the other stuff that usually gets corrupted. The directory can
|
/// copies the other stuff that usually gets corrupted. The directory can
|
||||||
|
@ -629,12 +639,14 @@ try
|
||||||
dbs, dbs.emplace(string_view{this->name}, this).first
|
dbs, dbs.emplace(string_view{this->name}, this).first
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
throw_on_error
|
|
||||||
{
|
|
||||||
#ifdef RB_DEBUG
|
#ifdef RB_DEBUG
|
||||||
d->VerifyChecksum() //TODO: worth doing this for real here?
|
log::notice
|
||||||
#endif
|
{
|
||||||
|
log, "'%s': Verifying database integrity. This may take several minutes...",
|
||||||
|
this->name
|
||||||
};
|
};
|
||||||
|
check(*this);
|
||||||
|
#endif
|
||||||
|
|
||||||
log.info("'%s': Opened database @ `%s' with %zu columns at sequence number %lu.",
|
log.info("'%s': Opened database @ `%s' with %zu columns at sequence number %lu.",
|
||||||
this->name,
|
this->name,
|
||||||
|
|
Loading…
Reference in a new issue