Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RM_Call - only enforce OOM on scripts if 'M' flag is sent #11425

Merged
merged 4 commits into from Oct 27, 2022

Conversation

sjpotter
Copy link
Contributor

@sjpotter sjpotter commented Oct 24, 2022

RM_Call is designed to let modules call redis commands disregarding the OOM state (the module is responsible to declare its command flags to redis, or perform the necessary checks).
The other (new) alternative is to pass the "M" flag to RM_Call so that redis can OOM reject commands implicitly.

However, Currently, RM_Call enforces OOM on scripts (excluding scripts that declared allow-oom) in all cases, regardless of the RM_Call "M" flag being present.

This PR fixes scripts to be consistent with other commands being executed by RM_Call.
It modifies the flow in effect treats scripts as if they if they have the ALLOW_OOM script flag, if the "M" flag is not passed (i.e. no OOM checking is being performed by RM_Call, so no OOM checking should be done on script).

This replaced #11161 instead of requiring a new flag, it redefines how RM_call treats the M flag (or the lack of M flag).

@sjpotter sjpotter changed the title RM_Call - only enforce OOM on scripts if 'M' flag is sent RM_Call - only enforce OOM on scripts if 'M' flag is sent Oct 24, 2022
Currently, RM_Call enforces OOM on scripts (if script is not flagged with ALLOW_OOM) in all cases, if the "M" flag is sent for OOM checking or if its not.

This PR modifies the flow to treat apply ALLOW_OOM flag to the client if the "M" flag is not passed (i.e. no OOM checking is being performed by RM_Call)
@oranagra oranagra added state:major-decision Requires core team consensus release-notes indication that this issue needs to be mentioned in the release notes breaking-change This change can potentially break existing application labels Oct 24, 2022
src/module.c Outdated Show resolved Hide resolved
tests/unit/moduleapi/misc.tcl Outdated Show resolved Hide resolved
tests/unit/moduleapi/misc.tcl Outdated Show resolved Hide resolved
sjpotter and others added 2 commits October 26, 2022 21:49
* re-order first set of tests so they are more in-line with the tests
  before the PR (smaller diff)
* make two disctinct groups, one with and one without M flag
* remove excessive tests that checks that no-writes doesn't allow writes
  but does allow reads
* improve comments
Copy link
Member

@oranagra oranagra left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

concept already approved by core-team at #11161

@oranagra oranagra merged commit 38028da into redis:unstable Oct 27, 2022
Mixficsol pushed a commit to Mixficsol/redis that referenced this pull request Apr 12, 2023
RM_Call is designed to let modules call redis commands disregarding the
OOM state (the module is responsible to declare its command flags to redis,
or perform the necessary checks).
The other (new) alternative is to pass the "M" flag to RM_Call so that redis can
OOM reject commands implicitly.

However, Currently, RM_Call enforces OOM on scripts (excluding scripts that
declared `allow-oom`) in all cases, regardless of the RM_Call "M" flag being present.

This PR fixes scripts to be consistent with other commands being executed by RM_Call.
It modifies the flow in effect treats scripts as if they if they have the ALLOW_OOM script
flag, if the "M" flag is not passed (i.e. no OOM checking is being performed by RM_Call,
so no OOM checking should be done on script).

Co-authored-by: Oran Agra <oran@redislabs.com>
madolson pushed a commit to madolson/redis that referenced this pull request Apr 19, 2023
RM_Call is designed to let modules call redis commands disregarding the
OOM state (the module is responsible to declare its command flags to redis,
or perform the necessary checks).
The other (new) alternative is to pass the "M" flag to RM_Call so that redis can
OOM reject commands implicitly.

However, Currently, RM_Call enforces OOM on scripts (excluding scripts that
declared `allow-oom`) in all cases, regardless of the RM_Call "M" flag being present.

This PR fixes scripts to be consistent with other commands being executed by RM_Call.
It modifies the flow in effect treats scripts as if they if they have the ALLOW_OOM script
flag, if the "M" flag is not passed (i.e. no OOM checking is being performed by RM_Call,
so no OOM checking should be done on script).

Co-authored-by: Oran Agra <oran@redislabs.com>
enjoy-binbin pushed a commit to enjoy-binbin/redis that referenced this pull request Jul 31, 2023
RM_Call is designed to let modules call redis commands disregarding the
OOM state (the module is responsible to declare its command flags to redis,
or perform the necessary checks).
The other (new) alternative is to pass the "M" flag to RM_Call so that redis can
OOM reject commands implicitly.

However, Currently, RM_Call enforces OOM on scripts (excluding scripts that
declared `allow-oom`) in all cases, regardless of the RM_Call "M" flag being present.

This PR fixes scripts to be consistent with other commands being executed by RM_Call.
It modifies the flow in effect treats scripts as if they if they have the ALLOW_OOM script
flag, if the "M" flag is not passed (i.e. no OOM checking is being performed by RM_Call,
so no OOM checking should be done on script).

Co-authored-by: Oran Agra <oran@redislabs.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
breaking-change This change can potentially break existing application release-notes indication that this issue needs to be mentioned in the release notes state:major-decision Requires core team consensus
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

None yet

2 participants