influxdata/influxdb · warning

non-identical consecutive keys

Error message

non-identical consecutive keys

What it means

A test expect message used with Result::expect while collecting results from partition_keys in a test where consecutive keys must be either all identical or the operation errors cleanly. The panic means partition_keys returned an Err in a context where the test did not permit it.

Solutions

  1. Inspect the underlying PartitionKeyError (unwrap the Result fully) to see which part failed
  2. Fix the template so all parts resolve against the batch's schema and time column
  3. Adjust the test if the failure is actually the expected outcome (the test allows success or clean failure, not Err here)

Example fix

// before
let ret = partition_keys(&batch, template.parts())
    .map(|v| v.expect("non-identical consecutive keys"))
    .collect::<Result<Vec<_>, _>>();
// after
let ret = partition_keys(&batch, template.parts())
    .collect::<Result<Vec<_>, _>>()
    .map_err(|e| anyhow!("partition_keys failed: {e}"));
Defensive patterns

Strategy: validation

Validate before calling

for part in template.parts() {
    if let TemplatePart::TagColumn(name) = part {
        assert!(batch.schema().column_with_name(name).is_some(), "template tag column '{name}' not in batch");
    }
}

Try / catch

// surface the real error instead of expect()
let ret = partition_keys(&batch, template.parts())
    .collect::<Result<Vec<_>, _>>()
    .map_err(|e| e2e!(source: e, "partition_keys failed"));

Prevention

When it happens

Trigger: Calling partition_keys on a batch/template combination where a template part fails to render (returns PartitionKeyError) — e.g. invalid strftime spec or missing tag column — inside the test path that writes tags 'bananas' and computes keys.

Common situations: Template parts referencing tag columns absent from the batch; strftime specs the formatter cannot render; running modified template code against the fixed fixture.

Understand the failure class

Background: "This is a bug, please report it": internal invariant violations, unreachable panics, and SNH errors explained — this error's family across 47 libraries.

Related errors


AI-assisted analysis of influxdata/influxdb@06200ef96b (2026-09-19). Data as JSON: /api/errors/4f186637d8ca9d9b. Report an issue: GitHub.

Appendix: source

Thrown at core/partition/src/lib.rs:1706

            // Generate a single time-based partitioning template with a
            // randomised format string.
            let template = vec![
                TemplatePart::TimeFormat(&fmt),
            ];
            let template = test_table_partition_override(template);

            // Timestamp: 2023-05-29T13:03:16Z
            writer
                .write_time("time", vec![1685365396931384064].into_iter())
                .unwrap();

            writer
                .write_tag("bananas", Some(&[0b00000001]), vec!["great"].into_iter())
                .unwrap();

            writer.commit();
            let ret = partition_keys(&batch, template.parts())
                .map(|v| v.expect("non-identical consecutive keys"))
                .collect::<Result<Vec<_>, _>>();

            // The is allowed to succeed or fail under this test (but not
            // panic), and the returned error/value must match certain
            // properties:
            match ret {
                Ok(v) => { assert_eq!(v.len(), 1); },
                Err(e) => { assert_matches!(e, PartitionKeyError::InvalidStrftime); },
            }
        }

        // Drives the strftime formatter through the "front door", using the
        // same interface as a user would call to partition data. This validates
        // the integration between the various formatters, range encoders,
        // dedupe, etc.
        #[test]
        fn prop_strftime_integration(
            times in arbitrary_timestamps(),

View on GitHub (pinned to 06200ef96b)