0
0
Fork 0
mirror of https://github.com/matrix-construct/construct synced 2024-12-27 07:54:05 +01:00

ircd::db: Lock writes after memtable sealed until flush to prevent rocksdb pthread use.

This commit is contained in:
Jason Volk 2019-04-22 16:10:01 -07:00
parent a61d04a9c2
commit c370cdc123

View file

@ -2630,26 +2630,20 @@ noexcept
//
void
ircd::db::database::events::OnFlushCompleted(rocksdb::DB *const db,
const rocksdb::FlushJobInfo &info)
ircd::db::database::events::OnMemTableSealed(const rocksdb::MemTableInfo &info)
noexcept
{
log::info
log::debug
{
log, "'%s': job:%d ctx:%lu flush ended writes[slow:%d stop:%d] seq[%zu -> %zu] %s '%s' `%s'",
log, "'%s': memory table sealed '%s' entries:%lu deletes:%lu",
d->name,
info.job_id,
info.thread_id,
info.triggered_writes_slowdown,
info.triggered_writes_stop,
info.smallest_seqno,
info.largest_seqno,
reflect(info.flush_reason),
info.cf_name,
info.file_path,
info.num_entries,
info.num_deletes
};
assert(info.thread_id == ctx::id(*ctx::current));
const ctx::uninterruptible::nothrow ui;
write_mutex.lock();
}
void
@ -2657,6 +2651,8 @@ ircd::db::database::events::OnFlushBegin(rocksdb::DB *const db,
const rocksdb::FlushJobInfo &info)
noexcept
{
assert(info.thread_id == ctx::id(*ctx::current));
log::info
{
log, "'%s': job:%d ctx:%lu flush start writes[slow:%d stop:%d] seq[%zu -> %zu] %s '%s'",
@ -2671,7 +2667,30 @@ noexcept
info.cf_name,
};
const ctx::uninterruptible::nothrow ui;
write_mutex.unlock();
}
void
ircd::db::database::events::OnFlushCompleted(rocksdb::DB *const db,
const rocksdb::FlushJobInfo &info)
noexcept
{
assert(info.thread_id == ctx::id(*ctx::current));
log::info
{
log, "'%s': job:%d ctx:%lu flush ended writes[slow:%d stop:%d] seq[%zu -> %zu] %s '%s' `%s'",
d->name,
info.job_id,
info.thread_id,
info.triggered_writes_slowdown,
info.triggered_writes_stop,
info.smallest_seqno,
info.largest_seqno,
reflect(info.flush_reason),
info.cf_name,
info.file_path,
};
}
void
@ -2818,20 +2837,6 @@ noexcept
};
}
void
ircd::db::database::events::OnMemTableSealed(const rocksdb::MemTableInfo &info)
noexcept
{
log::debug
{
log, "'%s': memory table sealed '%s' entries:%lu deletes:%lu",
d->name,
info.cf_name,
info.num_entries,
info.num_deletes
};
}
void
ircd::db::database::events::OnColumnFamilyHandleDeletionStarted(rocksdb::ColumnFamilyHandle *const h)
noexcept