Help Center/ GaussDB(DWS)/ Troubleshooting/ Database Parameter Modification/ Error "Cannot get stream index, maybe comm_max_stream is not enough" Is Reported
Updated on 2024-01-25 GMT+08:00

Error "Cannot get stream index, maybe comm_max_stream is not enough" Is Reported

Symptom

When a user executes a task, the following error message is displayed: "ERROR: Failed to connect dn_6001_6002, detail:1021 Cannot get stream index, maybe comm_max_stream is not enough."

Possible Causes

The comm_max_datanode parameter of the user's database is set to the default value 1024. During batch processing, the number of streams between DNs is 600 to 700. If temporary queries are performed at the same time, the total streams may exceed the specified upper limit, incurring the said error.

Cause Analysis

  1. The GUC parameter comm_max_stream indicates the maximum number of streams between any two DNs.
    On the CN, run the following command to query the stream status between any two DNs on the CN:
    1
    SELECT node_name,remote_name,count(*) FROM pgxc_comm_send_stream group by 1,2 order by 3 desc limit 100;
    
    On a DN, run the following command to query the stream status between the DN and other DNs:
    1
    SELECT node_name,remote_name,count(*) FROM pg_comm_send_stream group by 1,2 order by 3 desc limit 100;
    
  2. The value of comm_max_stream must be greater than: Number of concurrent data streams x Number of operators in each stream x Square of SMP.

    Default value: calculated by the following formula: min (query_dop_limit x query_dop_limit x 2 x 20, max_process_memory (bytes) x 0.025/(Maximum number of CNs + Number of current DNs)/260. If the value is less than 1024, 1024 is used. query_dop_limit = Number of CPU cores of a single server/Number of DNs of a single server.

    • You are not advised to set this parameter to a large value because this will cause high memory usage (256 bytes x comm_max_stream x comm_max_datanode). If the number of concurrent data streams is large, the query is complex and the smp is large, resulting in insufficient memory.
    • If the value of comm_max_datanode is small, the process memory is sufficient. In this case, you can increase the value of comm_max_stream.

Handling Procedure

According to the evaluation result, the memory is sufficient. Change the value of comm_max_stream to 2048. (The value 2048 is only an example. Set the parameter as needed.)

  1. Log in to the GaussDB(DWS) management console.
  2. In the navigation pane on the left, choose Clusters.
  3. In the cluster list, find the target cluster and click its name. The cluster information page is displayed.
  4. Choose Parameters tab and modify the value of parameter comm_max_stream. Click Save.
  5. In the Modification Preview dialog box, confirm the modification and click Save.
  6. If No is displayed in the Restart Cluster column of the comm_max_stream parameter, the parameter modification takes effect immediately without restart.