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

Log empty or nil select calls #277

Merged
merged 2 commits into from
Jun 15, 2022

Conversation

oleg-jukovec
Copy link
Contributor

@oleg-jukovec oleg-jukovec commented Apr 29, 2022

Empty or nil select calls on user spaces tend to be dangerous.

A critical log entry containing the current stack traceback is created
upon empty or nil select calls — a user can explicitly request a full
scan though by passing fullscan = true to select's options table
argument in which a case a log entry will not be created.

Tarantool has a similar implementation[1].

  1. Log empty or nil select calls tarantool#7064

Closes #276

@oleg-jukovec oleg-jukovec force-pushed the oleg-jukovec/gh-276-log-select-nil branch 5 times, most recently from a70c0c4 to 7445256 Compare April 29, 2022 13:38
@oleg-jukovec oleg-jukovec marked this pull request as ready for review April 29, 2022 14:02
crud/ratelimit.lua Outdated Show resolved Hide resolved
@oleg-jukovec oleg-jukovec force-pushed the oleg-jukovec/gh-276-log-select-nil branch from 7445256 to c2553b3 Compare May 4, 2022 17:25
@oleg-jukovec oleg-jukovec force-pushed the oleg-jukovec/gh-276-log-select-nil branch 8 times, most recently from 282a529 to 1e55d88 Compare May 5, 2022 09:43
README.md Outdated Show resolved Hide resolved
README.md Outdated Show resolved Hide resolved
@oleg-jukovec oleg-jukovec force-pushed the oleg-jukovec/gh-276-log-select-nil branch from 1e55d88 to cdb2689 Compare May 5, 2022 15:17
README.md Outdated Show resolved Hide resolved
README.md Show resolved Hide resolved
@oleg-jukovec oleg-jukovec force-pushed the oleg-jukovec/gh-276-log-select-nil branch from 3475906 to ebae0f3 Compare May 24, 2022 20:10
README.md Outdated Show resolved Hide resolved
@oleg-jukovec
Copy link
Contributor Author

oleg-jukovec commented May 27, 2022

I will delete a doc entry:

**Note:**

Pagination with parameter ``after`` leads to a full scan even with the condition '=' or '==' on the index fields.
...

from doc/select.md after #295 (or I'll do it there, it depends on the merging order).

Copy link
Member

@DifferentialOrange DifferentialOrange left a comment

Choose a reason for hiding this comment

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

I think we should merge #295 first and then deal with this PR.

Are there any plans to add more critical log conditions or we decided to stop for now?

@oleg-jukovec
Copy link
Contributor Author

oleg-jukovec commented May 30, 2022

Are there any plans to add more critical log conditions or we decided to stop for now?

Thank you for the review! I think that we decided to stop with current conditions.

doc/select.md Outdated Show resolved Hide resolved
test/helper.lua Outdated Show resolved Hide resolved
@oleg-jukovec oleg-jukovec force-pushed the oleg-jukovec/gh-276-log-select-nil branch from aed33cc to b4434d9 Compare June 1, 2022 14:45
@oleg-jukovec oleg-jukovec force-pushed the oleg-jukovec/gh-276-log-select-nil branch from b4434d9 to 8f63d19 Compare June 9, 2022 06:08
oleg-jukovec added a commit that referenced this pull request Jun 10, 2022
Before the patch we copy an original EQ/REQ condition to post-filter
and change the original to GE/LE. The problem is that EQ/REQ can't be
a stop condition. As a result EQ/REQ + after unexpectedly became a
full scan.

The patch removes this behavior, the query becomes more expected and
in base executes as regular EQ/REQ.

We had an idea to replace EQ with GE+LE. This would help to skip less
tuples in the executor inside scroll_to_after_tuple. But unfortunately,
due to a bug[1], this will break the current behavior. So we need to
fix the bug first.

In additional, the 'potentially long select'[2] warning is confused by
the GE/LE in the query plan.

This patch only changes the internal behavior and does not affect a
client code.

1. #301
2. #277
@oleg-jukovec oleg-jukovec force-pushed the oleg-jukovec/gh-276-log-select-nil branch from 8f63d19 to 637a7f8 Compare June 14, 2022 06:01
@oleg-jukovec
Copy link
Contributor Author

oleg-jukovec commented Jun 14, 2022

A note after leads to a full scan has been removed from doc/select.md. The pull request should be merged after #295 .

@oleg-jukovec

This comment was marked as outdated.

DifferentialOrange pushed a commit that referenced this pull request Jun 15, 2022
Before the patch we copy an original EQ/REQ condition to post-filter
and change the original to GE/LE. The problem is that EQ/REQ can't be
a stop condition. As a result EQ/REQ + after unexpectedly became a
full scan.

The patch removes this behavior, the query becomes more expected and
in base executes as regular EQ/REQ.

We had an idea to replace EQ with GE+LE. This would help to skip less
tuples in the executor inside scroll_to_after_tuple. But unfortunately,
due to a bug[1], this will break the current behavior. So we need to
fix the bug first.

In additional, the 'potentially long select'[2] warning is confused by
the GE/LE in the query plan.

This patch only changes the internal behavior and does not affect a
client code.

1. #301
2. #277
Potentially long select calls on user spaces tend to be dangerous.

A critical log entry containing the current stack traceback is created
upon potentially long select calls — a user can explicitly request a
full scan though by passing fullscan = true to select's options table
argument in which a case a log entry will not be created.

Tarantool has a similar implementation[1][2].

1. tarantool/tarantool#7064
2. tarantool/tarantool#7131

Part of #276
Potentially long count calls on user spaces tend to be dangerous.

A critical log entry containing the current stack traceback is created
upon potentially long count calls — a user can explicitly request a
full scan though by passing fullscan = true to count's options table
argument in which a case a log entry will not be created.

Closes #276
@oleg-jukovec oleg-jukovec force-pushed the oleg-jukovec/gh-276-log-select-nil branch from 637a7f8 to 2df8d76 Compare June 15, 2022 06:45
@DifferentialOrange DifferentialOrange merged commit 8dfcbe4 into master Jun 15, 2022
@DifferentialOrange DifferentialOrange deleted the oleg-jukovec/gh-276-log-select-nil branch June 15, 2022 07:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Write in log when see select(nil)
4 participants