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

  1. Create DbOptions with Options::Rocks (DbOptions::new) for RocksDB engines.
  2. Use into_titan when constructing a Titan engine.
  3. 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

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


AI-assisted analysis of tikv/tikv@78aedc1c81 (2026-09-03). Data as JSON: /api/errors/c48eaf9a106d8258. Report an issue: GitHub.