Skip to content

[BUG] Always select node from a small subset of all nodes for any random session_id #574

@zghong

Description

@zghong

Describe the bug

For any random session_id, chproxy always selects node from a small subset of all nodes.

To Reproduce

Run chproxy on 127.0.0.1:8090 with the following config.xml:

clusters:
  - name: test_cluster
    replicas:
      - name: "replica1"
        nodes:
          - 127.0.1.1:8123
          - 127.0.1.2:8123
      - name: "replica2"
        nodes:
          - 127.0.2.1:8123
          - 127.0.2.2:8123
#! /bin/bash

for session_id in $(seq 0 1000); do
    echo "select hostname();" | curl "http://default:xxx@127.0.0.1:8090?session_id=$session_id" -d @-
done

the above script will always select node from 127.0.1.1 and 127.0.2.2, and the other nodes will never be selected.

Expected behavior

chproxy should select node from all nodes for any random session_id.

Screenshots

No.

Environment information

  • chproxy version: 1.30.0.

Additional context

No.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions