use tracing::error;
use crate::data::executor::core_loop::CoreLoop;
use super::UndoEntry;
impl CoreLoop {
pub(super) fn apply_undo_stats(
&mut self,
entry_index: usize,
entry: UndoEntry,
) -> Result<(), (usize, String)> {
match entry {
UndoEntry::StatsRestore { key, prior } => {
self.stats_store
.restore(&key, prior.as_deref())
.map_err(|e| {
let detail = format!("stats restore {key}: {e}");
error!(
core = self.core_id,
entry_index,
error = %detail,
"transaction undo: column stats restore failed; shard state unknown"
);
(entry_index, detail)
})
}
_ => unreachable!("apply_undo_stats called with non-stats entry"),
}
}
}