tarantool / tt

Command-line utility to manage Tarantool applications
Other
101 stars 12 forks source link

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

Open mandesero opened 6 hours ago

mandesero commented 6 hours ago

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