Esempio n. 1
0
    /// <summary>
    /// Finds the RPC port of the given tablet's leader tserver.
    /// </summary>
    /// <param name="tablet">The remote tablet.</param>
    public async ValueTask <HostAndPort> FindLeaderTabletServerAsync(RemoteTablet tablet)
    {
        var leader = tablet.GetLeaderServerInfo();

        while (leader == null)
        {
            await Task.Delay(100);

            var tablets = await _client.GetTableLocationsAsync(
                tablet.TableId, tablet.Partition.PartitionKeyStart, 1);

            var foundTablet = Assert.Single(tablets);
            leader = foundTablet.GetLeaderServerInfo();
        }

        return(leader.HostPort);
    }