tarantool / tarantool/tt

Discovery doesn't determine mode (RW/RO) of all instances in replica set using URI

Open
#1,034 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

2sp bug teamE
Dominant language
Go
Stars
113
Forks
18
Avg merge
4d 11h
Merged PRs (30d)
23

Description

Description

The Discovery mechanism doesn't determine the mode of all instances in a replica set when using the URI. This results in some instances being marked with an unknown state, despite the correct address for connection is known.

Example:
  1. Start tarantool application (vshard cluster in my case).

  2. Run the tt replicaset status command with a URI:

    $ tt replicaset status tcp://client:secret@127.0.0.1:3301
    
  3. The output shows an incorrect state for one of the instances:

    Orchestrator:      centralized config
    Replicasets state: bootstrapped
    
    • storage-001
      Failover: manual
        • storage-001-a localhost:3301 rw
        • storage-001-b localhost:3302 unknown
    
  4. Run the same command using a cluster name:

    $ tt replicaset status new-app
    
  5. The output is correct:

    Orchestrator:      centralized config
    Replicasets state: bootstrapped
    
    • storage-001
      Failover: manual
      Master:   single
        • storage-001-a localhost:3301 rw
        • storage-001-b localhost:3302 read
    

My attempts

For example for centralized config applications, the instance operating mode is assigned here

https://github.com/tarantool/tt/blob/1ea57bf4073a5dc1830333f5e1dc63341c028b02/cli/replicaset/cconfig.go#L266-L274

If URI is provided in tt command, topology.InstanceUUID is the URI of the instance with the provided URI, so the check is performed only for the single instance, the rest remain in the ModeUnknown state.

I tried hardcoding a solution by passing connOpts, iterating over the instances, and collecting their modes. However, it seems that this issue requires a more thorough investigation, as the mechanism is used in multiple places.

$ tt replicaset status tcp://client:secret@localhost:3302
Orchestrator:      centralized config
Replicasets state: bootstrapped

• storage-001
  Failover: manual
  Master:   single
    • storage-001-a localhost:3301 rw
    • storage-001-b localhost:3302 read

Patch: https://github.com/mandesero/tt/tree/mandesero/discovery-hot-fix


Discussion: https://github.com/tarantool/tt/pull/1030#issuecomment-2488762044

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in cli/replicaset/cconfig.go around lines 266-274, then trace how Discovery uses topology.InstanceUUID when the command receives a URI. Compare the URI and cluster-name outputs and inspect the related discovery paths mentioned in the issue. Done means tt replicaset status determines the RW/RO mode for every instance instead of leaving known instances as unknown.

Written by the indexing model from the issue text.

Assessment

Tech stack
go
Domain
cli
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.