Skip to content

Commit 25ae39c

Browse files
committed
chore: append_history_index only use for non-dupsort
1 parent e0bf7ac commit 25ae39c

File tree

1 file changed

+4
-0
lines changed
  • crates/storage/provider/src/providers/database

1 file changed

+4
-0
lines changed

crates/storage/provider/src/providers/database/provider.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -811,6 +811,10 @@ impl<TX: DbTxMut + DbTx + 'static, N: NodeTypes> DatabaseProvider<TX, N> {
811811
P: Copy,
812812
T: Table<Value = BlockNumberList>,
813813
{
814+
// This function cannot be used with DUPSORT tables because `upsert` on DUPSORT tables
815+
// will append duplicate entries instead of updating existing ones, causing data corruption.
816+
assert!(!T::DUPSORT, "append_history_index cannot be used with DUPSORT tables");
817+
814818
let mut cursor = self.tx.cursor_write::<T>()?;
815819

816820
for (partial_key, indices) in index_updates {

0 commit comments

Comments
 (0)