Assign stable unique IDs to all WiredTiger log messages

    • Type: Task
    • Resolution: Unresolved
    • Priority: Major - P3
    • None
    • Affects Version/s: None
    • Component/s: Logging
    • Storage Engines - Foundations
    • 19.96
    • None
    • None

      Background

      WT-14339 proposed adding source file, function, or line information to WiredTiger log messages to make their origin easier to locate. Stable message IDs provide a better primary identity for a log statement:

      • IDs remain stable when code is reordered or moved, while source locations change.
      • Monitoring, Atlas ingestion rules, tests, support tooling, and documentation can match an exact event without parsing message text.
      • An ID is compact and consistent across builds and release branches.
      • Source location information requires the exact matching source revision and is less suitable as a durable machine-readable contract.

      Source locations may still be useful supplementary diagnostics, but they should not be the primary identity of a message.

      Existing support

      WT-14932 introduced the log_id JSON field, ID-aware verbose logging APIs, and the default ID 1000000. It assigned explicit IDs 1493200 and 1493201 to the shutdown and recovery completion messages. WT-14590 contains the earlier framework discussion.

      WT-15380 extended the mechanism to error logging and assigned 1538000 and 1538001 to two hardware-corruption messages.

      Most WiredTiger verbose and error events still use WT_DEFAULT_LOG_ID. Some message paths bypass the ID-aware event formatting entirely. WiredTiger also has no CI check enforcing uniqueness or allocation rules.

      Proposed approach

      Define one stable ID for every WiredTiger diagnostic log statement and require logging APIs to carry that ID through standalone WiredTiger and MongoDB integrations.

      Introduce and document a numeric convention with a dedicated WiredTiger namespace that cannot overlap MongoDB LOGV2 IDs. Preserve ticket-based allocation: a ticket such as WT-12345 owns only its assigned block within the WT namespace. The exact base and block size must be agreed and must provide enough capacity for this migration and future work.

      Add allocation and lint tooling comparable to MongoDB's buildscripts/errorcodes.py. CI must reject duplicate IDs, IDs outside the WT namespace, IDs outside the owning ticket's block, placeholder/default IDs, and supported logging calls without an ID.

      Migrate every existing WiredTiger diagnostic logging call site to the convention, including verbose, error, panic, extension, general message, and progress paths where applicable. Emit the ID consistently in supported output formats and preserve it through MongoDB's WiredTiger event-handler integration.

      The four IDs introduced by WT-14932 and WT-15380 are already consumed downstream. Their migration must be coordinated with Atlas rules and other known consumers rather than silently changing them.

      Acceptance criteria

      • A dedicated, documented WT ID namespace and ticket-allocation convention cannot overlap MongoDB LOGV2 IDs.
      • Allocation tooling constrains a ticket such as WT-12345 to its dedicated block.
      • A CI check enforces uniqueness, namespace and ticket-block validity, and requires IDs at all supported diagnostic logging sites.
      • All current WiredTiger diagnostic logging call sites use IDs from the new convention; the shared default ID is removed or no longer emitted by normal paths.
      • All relevant output formats and the MongoDB integration preserve the WT ID.
      • Existing consumers of 1493200, 1493201, 1538000, and 1538001 are identified and migrated safely.
      • Tests cover formatting, propagation, duplicate detection, invalid ranges, missing IDs, and ticket-block enforcement.

      Related tickets

      • WT-14339: original source file and line-number proposal, superseded by this work.
      • WT-14590: initial unique message-ID framework design.
      • WT-14932: introduced unique IDs for verbose messages.
      • WT-15380: introduced unique IDs for hardware-corruption error messages.

            Assignee:
            [DO NOT USE] Backlog - Storage Engines Team
            Reporter:
            Ivan Kochin
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated: