RocksDB: Adds prefix bloom filters

pull/171/head
Tpt 3 years ago
parent 821cac9c4c
commit 0ee25d7579
  1. 2
      lib/src/storage/fallback_backend.rs
  2. 11
      lib/src/storage/mod.rs
  3. 8
      lib/src/storage/rocksdb_backend.rs

@ -11,6 +11,8 @@ pub struct ColumnFamilyDefinition {
pub name: &'static str,
pub merge_operator: Option<MergeOperator>,
pub compaction_filter: Option<CompactionFilter>,
pub use_iter: bool,
pub min_prefix_size: usize,
}
#[derive(Clone)]

@ -78,66 +78,77 @@ impl Storage {
merge_operator: Some(Self::str2id_merge()),
compaction_filter: Some(Self::str2id_filter()),
use_iter: false,
min_prefix_size: 0,
},
ColumnFamilyDefinition {
name: SPOG_CF,
merge_operator: None,
compaction_filter: None,
use_iter: true,
min_prefix_size: 17, // named or blank node start
},
ColumnFamilyDefinition {
name: POSG_CF,
merge_operator: None,
compaction_filter: None,
use_iter: true,
min_prefix_size: 17, // named node start
},
ColumnFamilyDefinition {
name: OSPG_CF,
merge_operator: None,
compaction_filter: None,
use_iter: true,
min_prefix_size: 0, // There are small literals...
},
ColumnFamilyDefinition {
name: GSPO_CF,
merge_operator: None,
compaction_filter: None,
use_iter: true,
min_prefix_size: 17, // named or blank node start
},
ColumnFamilyDefinition {
name: GPOS_CF,
merge_operator: None,
compaction_filter: None,
use_iter: true,
min_prefix_size: 17, // named or blank node start
},
ColumnFamilyDefinition {
name: GOSP_CF,
merge_operator: None,
compaction_filter: None,
use_iter: true,
min_prefix_size: 17, // named or blank node start
},
ColumnFamilyDefinition {
name: DSPO_CF,
merge_operator: None,
compaction_filter: None,
use_iter: true,
min_prefix_size: 17, // named or blank node start
},
ColumnFamilyDefinition {
name: DPOS_CF,
merge_operator: None,
compaction_filter: None,
use_iter: true,
min_prefix_size: 17, // named or blank node start
},
ColumnFamilyDefinition {
name: DOSP_CF,
merge_operator: None,
compaction_filter: None,
use_iter: true,
min_prefix_size: 0, // There are small literals...
},
ColumnFamilyDefinition {
name: GRAPHS_CF,
merge_operator: None,
compaction_filter: None,
use_iter: true,
min_prefix_size: 17, // named or blank node start
},
]
}

@ -45,6 +45,7 @@ pub struct ColumnFamilyDefinition {
pub merge_operator: Option<MergeOperator>,
pub compaction_filter: Option<CompactionFilter>,
pub use_iter: bool,
pub min_prefix_size: usize,
}
#[derive(Clone)]
@ -169,6 +170,7 @@ impl Db {
merge_operator: None,
compaction_filter: None,
use_iter: true,
min_prefix_size: 0,
})
}
let column_family_names = column_families.iter().map(|c| c.name).collect::<Vec<_>>();
@ -185,6 +187,12 @@ impl Db {
if !cf.use_iter {
rocksdb_options_optimize_for_point_lookup(options, 128);
}
if cf.min_prefix_size > 0 {
rocksdb_options_set_prefix_extractor(
options,
rocksdb_slicetransform_create_fixed_prefix(cf.min_prefix_size),
);
}
if let Some(merge) = cf.merge_operator {
// mergeoperator delete is done automatically
let merge = rocksdb_mergeoperator_create(

Loading…
Cancel
Save