Skip to content

index.mapper.TsidExtractingIdFieldMapperTests.testParsedDescriptionWithIndexDimension Failing #144678

@JVerwolf

Description

@JVerwolf

CI Link

https://gradle-enterprise.elastic.co/s/nrovif34tzyse/tests/task/:server:test/details/org.elasticsearch.index.mapper.TsidExtractingIdFieldMapperTests/testParsedDescriptionWithIndexDimensions%20%7Bp0%3DL1%3D1%20p1%3Dfalse%7D?top-execution=1

Repro line

./gradlew ":server:test" --tests "org.elasticsearch.index.mapper.TsidExtractingIdFieldMapperTests.testParsedDescriptionWithIndexDimensions {p0=L1=1 p1=false}" -Dtests.seed=18ECDFDC94B74127 -Dtests.locale=hu -Dtests.timezone=Pacific/Fiji -Druntime.java=25 -Dtests.fips.enabled=true

Does it reproduce?

Yes

Applicable branches

main

Failure history

No response

Failure excerpt

TsidExtractingIdFieldMapperTests > testParsedDescriptionWithIndexDimensions > testParsedDescriptionWithIndexDimensions {p0=L1=1 p1=false} FAILED
    java.lang.AssertionError:
    Expected: "[BwAAALQa3_B5oSRHAAABfhMmioA][C8t2xhEnokpbS-rpcaL9_JYgRQ@2022-01-01T01:00:00.000Z]"
         but: was "[BwAAANPogkA5acqrAAABfhMmioA][CxEnokpbS-rpcaL9_JYgRQ@2022-01-01T01:00:00.000Z]"
        at __randomizedtesting.SeedInfo.seed([18ECDFDC94B74127:28C992704FF7183C]:0)
        at org.hamcrest.MatcherAssert.assertThat(MatcherAssert.java:20)
        at org.hamcrest.MatcherAssert.assertThat(MatcherAssert.java:6)
        at org.elasticsearch.test.ESTestCase.assertThat(ESTestCase.java:2981)
        at org.elasticsearch.index.mapper.TsidExtractingIdFieldMapperTests.testParsedDescriptionWithIndexDimensions(TsidExtractingIdFieldMapperTests.java:1146)

After doing some investigation with AI tools, this appears to be the cause:

The test fails due to a new TSID layout introduced in commit 9846b8e (merged March 19, 2026) —
two weeks after the test's parameterization was written (commit 4434c14, March 5, 2026).

The chain of causation

  1. Feature flag auto-enabled in snapshot builds

TsidBuilder.java:37:

  public static final boolean SINGLE_PREFIX_BYTE_ENABLED = new
  FeatureFlag("tsid_layout_single_prefix_byte").isEnabled();

Per FeatureFlag.java:72-74, this flag is automatically enabled in all snapshot builds (i.e., all
development/CI builds).

  1. Two different TSID layout branches
  TsidBuilder.buildTsid(IndexVersion):
  public final BytesRef buildTsid(IndexVersion indexVersion) {
      if (useSingleBytePrefixLayout(indexVersion)) {
          return buildSingleBytePrefixTsid();   // 16 bytes
      } else {
          return buildMultiBytePrefixTsid();    // 1 + 2 + 16 = 19 bytes (for 2 dims)
      }
  }

  public static boolean useSingleBytePrefixLayout(IndexVersion indexVersion) {
      return SINGLE_PREFIX_BYTE_ENABLED &&
  indexVersion.onOrAfter(TSID_SINGLE_PREFIX_BYTE_FEATURE_FLAG);
  }
  • TSID_CREATED_DURING_ROUTING = 9_037_0_00 (test's minimum version)
  • TSID_SINGLE_PREFIX_BYTE_FEATURE_FLAG = 9_080_00_0 (the new threshold)
  1. Random version crosses the threshold
    IndexVersion version = IndexVersionUtils.randomVersionOnOrAfter(IndexVersions.TSID_CREATED_DURING_ROUTING);
    With seed 18ECDFDC94B74127, this picks a version ≥ 9_080_00_0. Since the flag is enabled in snapshots, buildSingleBytePrefixTsid() is used, producing a 16-byte TSID (≈22 base64 chars).

  2. Mismatch with hardcoded expected values

The hardcoded expected values for s1=1:

  • expectedTsidWithIndexDimensions = "E3bLGR5i_E-AjHaQj6NSgLqXqQ" — 26 chars = 19 bytes (multi-byte
    prefix format)
  • expectedIdWithIndexDimensions = "BwAAAFXFZfzCD9-tAAABfhMmioA" — computed from the MurmurHash3 of
    that 19-byte TSID

But with the new single-byte prefix, the TSID is 16 bytes and different bytes → different hash →
different _id. Both values in the actual documentDescription(...) output differ from what the test
expects.

Why locale/timezone/FIPS/Java 25 are not the cause

Those parameters are irrelevant to this failure. The TSID is computed via MurmurHash3, which is not
locale-sensitive, timezone-sensitive, FIPS-constrained, or Java-version-dependent. The timestamp
formatting also explicitly uses Locale.ENGLISH and UTC.

Summary

The test was written assuming buildMultiBytePrefixTsid() would always be used. Commit 9846b8e
then introduced the tsid_layout_single_prefix_byte feature flag, which (being enabled in all
snapshot builds) activates a different TSID algorithm for index versions ≥ 9_080_00_0. The
randomVersionOnOrAfter(TSID_CREATED_DURING_ROUTING) call can select such a version, and with this
seed it does, causing the TSID and _id to differ from the hardcoded expected strings.

Metadata

Metadata

Labels

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions