Replaces dropping cf with deleting range of all items to avoid a panic when trying to open the db with that column family.

This commit is contained in:
Arya 2024-10-24 22:07:50 -04:00
parent e6a8654c44
commit f57c784f57
2 changed files with 12 additions and 14 deletions

View File

@ -866,18 +866,6 @@ impl DiskDb {
DB::open_cf_descriptors(&db_options, &path, column_families)
};
#[cfg(not(feature = "indexer"))]
let db_result = match db_result {
Ok(mut db) if db_kind == STATE_DATABASE_KIND => {
if let Err(err) = db.drop_cf(super::zebra_db::transparent::TX_LOC_BY_SPENT_OUT_LOC)
{
warn!(?err, "failed to drop unused column family");
}
Ok(db)
}
other => other,
};
match db_result {
Ok(db) => {
info!("Opened Zebra state cache at {}", path.display());

View File

@ -23,8 +23,18 @@ pub fn run(
return Err(CancelFormatChange);
}
// The `TX_LOC_BY_SPENT_OUT_LOC` column family should be dropped
// when opening the database without the `indexer` feature.
let _ = zebra_db
.tx_loc_by_spent_output_loc_cf()
.new_batch_for_writing()
.zs_delete_range(
&crate::OutputLocation::from_output_index(crate::TransactionLocation::MIN, 0),
&crate::OutputLocation::from_output_index(crate::TransactionLocation::MAX, u32::MAX),
)
.write_batch();
if !matches!(cancel_receiver.try_recv(), Err(TryRecvError::Empty)) {
return Err(CancelFormatChange);
}
(0..=initial_tip_height.0)
.into_par_iter()