Skip to content

[Core] ResourceRequest::operator== ignores label_selector and object-store-memory flag #64837

Description

@LuciferYang

What happened + What you expected to happen

ResourceRequest::operator== / operator!= (src/ray/common/scheduling/cluster_resource_data.h) compare only resources_, ignoring the other two fields of the class:

bool operator==(const ResourceRequest &other) const {
  return this->resources_ == other.resources_;
}

ResourceRequest also holds requires_object_store_memory_ and label_selector_. Two requests with identical resource quantities but a different object-store-memory flag or a different label selector compare equal, so any dedup, change-detection, or map-key use of ResourceRequest silently conflates requests that are not interchangeable.

Expected: == / != account for all fields that distinguish a request. (operator<= / operator>= legitimately compare quantities only — that is their resource-containment semantics and should not change.)

Versions / Dependencies

master (ray-project/ray), all platforms. C++ core (src/ray/common/scheduling).

Reproduction script

No standalone script — found by code review. A unit test constructing two requests with equal quantities but a different label selector / object-store flag and asserting inequality demonstrates it; see the linked PR.

Issue Severity

Medium: latent correctness bug in equality; impact depends on which callers rely on ResourceRequest equality.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    Status
    In progress

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions