tikv/tikv · error
it's a titan option
Error message
it's a titan option
What it means
RocksDbOptions::into_rocks (engine_tirocks/src/db_options.rs) panics when the wrapped Options enum holds Titan DB options instead of Rocks DB options. It is called from new_sanitized when sanitizing DB options for a RocksDB engine instance.
Source
Thrown at components/engine_tirocks/src/db_options.rs:39
impl RocksDbOptions {
#[inline]
pub fn env(&self) -> Option<&Arc<Env>> {
match &self.0 {
Options::Rocks(opt) => opt.env(),
Options::Titan(opt) => opt.env(),
}
}
#[inline]
pub fn is_titan(&self) -> bool {
matches!(self.0, Options::Titan(_))
}
#[inline]
pub(crate) fn into_rocks(self) -> DbOptions {
match self.0 {
Options::Rocks(opt) => opt,
_ => panic!("it's a titan option"),
}
}
#[inline]
pub(crate) fn into_titan(self) -> TitanDbOptions {
match self.0 {
Options::Titan(opt) => opt,
_ => panic!("it's not a titan option"),
}
}
}
impl Default for RocksDbOptions {
#[inline]
fn default() -> Self {
RocksDbOptions(Options::Rocks(Default::default()))
}
}View on GitHub (pinned to 78aedc1c81)
Solutions
- Create DbOptions with Options::Rocks (DbOptions::new) for RocksDB engines.
- Use into_titan when constructing a Titan engine.
- Branch on the Options variant at the construction site (e.g. in new_sanitized callers) before unwrapping.
Example fix
// before let db_opts = RocksDbOptions::new_titan(...).into_rocks(); // panic // after let db_opts = RocksDbOptions::new_rocks().into_rocks();
Defensive patterns
Strategy: type-guard
Validate before calling
fn expects_rocks_db(opts: &RocksDbOptions) -> bool {
matches!(opts.as_ref(), Options::Rocks(_))
}
// guard before new_sanitized/into_rocks
if !expects_rocks_db(&db_opts) { /* rebuild as Options::Rocks or use titan engine */ } Type guard
fn as_rocks_db(opts: &RocksDbOptions) -> Option<&rocksdb::DbOptions> {
match &opts.0 { Options::Rocks(o) => Some(o), _ => None }
} Prevention
- Construct DB options with the Rocks constructor when the engine is not Titan.
- Add a unit test covering new_sanitized for both engine variants.
- Keep titan/rocks option selection driven by a single config knob to avoid mixed variants.
When it happens
Trigger: Passing Titan-built DbOptions into new_sanitized / any path expecting Rocks DB options — typically when the titan feature is enabled and shared option construction produces the wrong variant.
Common situations: Mixing titan and rocks DB-option builders in engine setup; configuration-driven engine selection reusing one options constructor for both backends.
Related errors
- it's a titan cf option
- it's not a titan cf option
- expect: ConfigValue::String, got: {:?}
- it's not a titan option
- expect: ConfigValue::String, got: {:?}
AI-assisted analysis of tikv/tikv@78aedc1c81 (2026-09-03).
Data as JSON: /api/errors/c48eaf9a106d8258.
Report an issue: GitHub.