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

ircd::db: Allow null column transactions to be ignored rather than erroneous.

This commit is contained in:
Jason Volk 2019-01-16 13:46:15 -08:00
parent 918bc95d1a
commit 0652dfbc59

View file

@ -8619,7 +8619,11 @@ ircd::db::txn::append::append(txn &t,
database &d,
const delta &delta)
{
db::column c{d[std::get<1>(delta)]};
db::column c
{
d[std::get<1>(delta)]
};
db::append(*t.wb, c, db::column::delta
{
std::get<op>(delta),
@ -10609,7 +10613,11 @@ void
ircd::db::append(rocksdb::WriteBatch &batch,
const cell::delta &delta)
{
auto &column(std::get<cell *>(delta)->c);
auto &column
{
std::get<cell *>(delta)->c
};
append(batch, column, column::delta
{
std::get<op>(delta),
@ -10623,8 +10631,21 @@ ircd::db::append(rocksdb::WriteBatch &batch,
column &column,
const column::delta &delta)
{
database::column &c(column);
if(unlikely(!column))
{
// Note: Unknown at this time whether allowing attempts at writing
// to a null column should be erroneous or silently ignored. It's
// highly likely this log message will be removed soon to allow
// toggling database columns for optimization without touching calls.
log::critical
{
log, "Attempting to transact a delta for a null column"
};
return;
}
database::column &c(column);
const auto k(slice(std::get<1>(delta)));
const auto v(slice(std::get<2>(delta)));
switch(std::get<0>(delta))