All Products
Search
Document Center

Tablestore:Query information about a tunnel

Last Updated:Jul 05, 2024

After you create a tunnel, you can call the DescribeTunnel operation to query information about the tunnel, such as information about channels in the tunnel.

Prerequisites

  • A TunnelClient instance is initialized.

  • A tunnel is created for the data table. For more information, see Create a tunnel.

Parameters

Request parameters

Parameter

Description

TableName

The name of the data table whose tunnel information you want to query.

TunnelName

The name of the tunnel.

Response parameters

Parameter

Description

TunnelRPO

The most recent time when the tunnel is used to consume incremental data. The time is the point in time when the slowest channel in the tunnel is used to consume data. Default value: January 1, 1970 (UTC).

List<TunnelInfo>

The information about the tunnel. The following information is included in the response:

  • TunnelId: the ID of the tunnel.

  • TunnelName: the name of the tunnel.

  • TunnelType: the type of the tunnel. Valid values: BaseData, Stream, and BaseAndStream. The BaseData type indicates that the tunnel is used to consume full data of the data table. The Stream type indicates that the tunnel is used to consume incremental data of the data table. The BaseAndStream type indicates that the tunnel is used to consume differential data of the data table.

  • TableName: the name of the data table for which the tunnel is created.

  • InstanceName: the name of the instance in which the tunnel is located.

  • Stage: the stage of the tunnel. Valid values: InitBaseDataAndStreamShard, ProcessBaseData, and ProcessStream. The InitBaseDataAndStreamShard stage indicates that the tunnel is being initialized. The ProcessBaseData stage indicates that the tunnel is being used to consume full data. The ProcessStream stage indicates that the tunnel is being used to consume incremental data.

  • Expired: indicates whether the data is expired.

    If true is returned, contact Tablestore technical support by using DingTalk at the earliest opportunity.

List<ChannelInfo>

The information about the channels in the tunnel. The following information is included in the response:

  • ChannelId: the ID of the channel.

  • ChannelType: the type of the channel. Valid values: Base and Stream.

  • ChannelStatus: the status of the channel. Valid values: WAIT, OPEN, CLOSING, CLOSE, and TERMINATED.

  • ClientId: the ID of the tunnel client. By default, the client ID concatenates the hostname of the client and a random string. The client hostname can be specified by using TunnelWorkerConfig.

  • ChannelRPO: the most recent time when the channel is used to consume incremental data. Default value: January 1, 1970 (UTC). This parameter does not take effect for channels of the Base type.

ResponseInfo

Other fields returned in the request, including the RequestId field in the request. RequestId uniquely identifies the request.

Examples

The following sample code provides an example on how to query information about a tunnel, including the most recent time when the tunnel is used to consume incremental data and the information about the channels in the tunnel:

req := &tunnel.DescribeTunnelRequest{
   TableName:  "<TABLE_NAME>",
   TunnelName: "TUNNEL_NAME",
}
resp, err := tunnelClient.DescribeTunnel(req)
if err != nil {
   log.Fatal("describe tunnel failed", err)
}
log.Println("tunnel id is", resp.Tunnel.TunnelId)

References