Skip to content

EQL: Fix early trimming of in-flight data#66493

Merged
costin merged 1 commit intoelastic:masterfrom
costin:eql/fix-early-trimming
Dec 17, 2020
Merged

EQL: Fix early trimming of in-flight data#66493
costin merged 1 commit intoelastic:masterfrom
costin:eql/fix-early-trimming

Conversation

@costin
Copy link
Copy Markdown
Member

@costin costin commented Dec 17, 2020

Rework trimToLast to take into account an ordinal for last trimming so
instead of keeping the last entry in a stage, it keeps the last entry
before the given ordinal.
This takes care of the case where a dense stage that requires several
passes does not discard valid data from a previous sparse stage that go
beyond the current stage point.

Rework trimToLast to take into account an ordinal for last trimming so
instead of keeping the last entry in a stage, it keeps the last entry
before the given ordinal.
This takes care of the case where a dense stage that requires several
passes does not discard valid data from a previous sparse stage that go
beyond the current stage point.
@costin costin force-pushed the eql/fix-early-trimming branch from 2e0d465 to 5a63383 Compare December 17, 2020 11:53
@costin costin added the Team:QL (Deprecated) Meta label for query languages team label Dec 17, 2020
@elasticmachine
Copy link
Copy Markdown
Collaborator

Pinging @elastic/es-ql (Team:QL)

Copy link
Copy Markdown
Contributor

@bpintea bpintea left a comment

Choose a reason for hiding this comment

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

LGTM

// and remember the last item from the first
// initialized stage to be used with until
// remember the last item found (will be ascending)
// to trim unneeded until that occur before it
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Suggested change
// to trim unneeded until that occur before it
// to trim the ones before it


/**
* Returns the latest element from the group that has its timestamp
* less than the given argument alongside its position in the list.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Suggested change
* less than the given argument alongside its position in the list.
* less than the given argument's timestamp, alongside its position in the list.

/**
* Returns the latest element from the group that has its timestamp
* less than the given argument alongside its position in the list.
* Everything before the element it is removed. The element is kept.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Suggested change
* Everything before the element it is removed. The element is kept.
* Everything before this element is removed. The element is kept.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Will pick them up in a separate PR to avoid another build.

* and adjust insertion positions.
*/
void trim(boolean everything) {
void trim(Ordinal ordinal) {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Wondering if @Nullable would be welcome here, as an indicator of null as a branching value?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

I'm not a fan of @Nullable since it doesn't enforce anything nor it is used consistently through-out the code.

Copy link
Copy Markdown
Contributor

@matriv matriv left a comment

Choose a reason for hiding this comment

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

LGTM, Is there any integration test that can be used to validate this fix?

Copy link
Copy Markdown
Contributor

@astefan astefan left a comment

Choose a reason for hiding this comment

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

LGTM

@costin
Copy link
Copy Markdown
Member Author

costin commented Dec 17, 2020

LGTM, Is there any integration test that can be used to validate this fix?

Yes, the correctness test with tail by default. Our smaller tests seems to trigger it but I haven't had time to double check if this is indeed the case.

@costin costin merged commit 4f55749 into elastic:master Dec 17, 2020
@costin costin deleted the eql/fix-early-trimming branch December 17, 2020 15:19
costin added a commit that referenced this pull request Dec 17, 2020
Rework trimToLast to take into account an ordinal for last trimming so
instead of keeping the last entry in a stage, it keeps the last entry
before the given ordinal.
This takes care of the case where a dense stage that requires several
passes does not discard valid data from a previous sparse stage that go
beyond the current stage point.

(cherry picked from commit 4f55749)
costin added a commit that referenced this pull request Dec 17, 2020
Rework trimToLast to take into account an ordinal for last trimming so
instead of keeping the last entry in a stage, it keeps the last entry
before the given ordinal.
This takes care of the case where a dense stage that requires several
passes does not discard valid data from a previous sparse stage that go
beyond the current stage point.

(cherry picked from commit 4f55749)
(cherry picked from commit 6b61dfe)
costin added a commit that referenced this pull request Dec 17, 2020
Rework trimToLast to take into account an ordinal for last trimming so
instead of keeping the last entry in a stage, it keeps the last entry
before the given ordinal.
This takes care of the case where a dense stage that requires several
passes does not discard valid data from a previous sparse stage that go
beyond the current stage point.

(cherry picked from commit 4f55749)
(cherry picked from commit 6b61dfe)
(cherry picked from commit cece81b)
@costin costin added the v7.10.2 label Dec 17, 2020
@costin
Copy link
Copy Markdown
Member Author

costin commented Dec 17, 2020

Backported to 7.x, 7.11 and 7.10

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants