Skip to content
This repository was archived by the owner on Nov 24, 2025. It is now read-only.
This repository was archived by the owner on Nov 24, 2025. It is now read-only.

The default initial position for synthesizing zero hashes should be changed #1812

@jifyang

Description

@jifyang

In delivery service steering, the response isn't correct if config two or more targets whose types are STEERING_ORDER and values are negative.

Root cause analysis:

In function synthesizeZeroHashes(), if hashableMap is empty, the initial position for putting the zero hashable with negative order value will be 0 (the variable minHash).

In the following process, 0 will be selected as the hash value for the first zero hashable, then the negative values -1, -2, ... in type long will be tried to generate the hash value in type double for the other zero hashables. There are three issues:

  1. The NaN will be generated as the hash value next to the hash value 0. This will cause wrong result.

  2. There are a large number of negative values -1, -2, ... in type long will be mapped to NaN in type double. This will consume much computation and cause slow response.

  3. The negative values in type long and type double aren't correct in this scenario. For the negative values, the value in double type is ascending when the value in type long is descending (ref the function getSafeHash).

Metadata

Metadata

Assignees

No one assigned

    Labels

    Traffic Opsrelated to Traffic OpsTraffic Routerrelated to Traffic Routerneeds more infomore information or a better description is needed to proceedtech debtrework due to choosing easy/limited solution

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions