Skip to content

Bug Report: GetTablets misreports stale primaries with --tablet-alias #19898

@mhamza15

Description

@mhamza15

Overview of the Issue

GetTablets can misreport tablet type when filtering by --tablet-alias if the topology contains stale former primaries.

In the reproduced state, shard scoped GetTablets correctly reports the old tablets as unknown, but querying the same stale tablet by alias alone reports it as primary. Querying two stale tablet aliases from different shards together also makes the result depend on which stale record has the later primary_term_start_time, even though both should remain unknown relative to their own shards.

Reproduction Steps

mhamza15@c4c308a

Binary Version

main

Operating System and Environment details

All

Log Fragments

# Shard scoped truth for customer/-80
$ vtctldclient --server localhost:15999 GetTablets --keyspace customer --shard -80
zone1-0000000300 customer -80 unknown :0 :17000 [] 2026-04-16T13:31:18Z
zone1-0000000301 customer -80 primary vttablet301:15000 vttablet301:17000 [] 2026-04-16T13:32:02Z
zone1-0000000302 customer -80 rdonly vttablet302:15000 vttablet302:17000 [] <null>

# Shard scoped truth for customer/80-
$ vtctldclient --server localhost:15999 GetTablets --keyspace customer --shard 80-
zone1-0000000400 customer 80- unknown :0 :17000 [] 2026-04-16T13:31:19Z
zone1-0000000401 customer 80- primary vttablet401:15000 vttablet401:17000 [] 2026-04-16T13:33:02Z
zone1-0000000402 customer 80- rdonly vttablet402:15000 vttablet402:17000 [] <null>

# Single stale alias is misreported as primary
$ vtctldclient --server localhost:15999 GetTablets --tablet-alias zone1-0000000300
zone1-0000000300 customer -80 primary :0 :17000 [] 2026-04-16T13:31:18Z

# Two stale aliases from different shards interact across the request set
$ vtctldclient --server localhost:15999 GetTablets --tablet-alias zone1-0000000300 --tablet-alias zone1-0000000400
zone1-0000000300 customer -80 unknown :0 :17000 [] 2026-04-16T13:31:18Z
zone1-0000000400 customer 80- primary :0 :17000 [] 2026-04-16T13:31:19Z

Metadata

Metadata

Assignees

No one assigned

    Type

    No fields configured for Bug.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions