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

Cursor input old state collection #19528

Merged
merged 3 commits into from
Jul 1, 2020
Merged

Conversation

urso
Copy link

@urso urso commented Jun 30, 2020

  • Enhancement

What does this PR do?

The change provides the collection and deletion support for old states.
All entries added to the store have a TTL configured. A key-value pair
will be removed from the store once the most recent update timestamp + TTL < now.
Pairs with pending updates will not be deleted yet.

The collector currently only implements the logic for the clean_inactive setting.

In comparison to the old registar, is the TTL not reset on startup. Old
entries are still subject to collection, even if they've not been
claimed. The TTL will be updated by the InputManager if an input with a
different TTL is started for an already seen source.

The full list of changes will include:

Why is it important?

Implement old state cleanup support for statefull inputs.

Checklist

  • My code follows the style guidelines of this project
  • I have commented my code, particularly in hard-to-understand areas
    - [ ] I have made corresponding changes to the documentation
    - [ ] I have made corresponding change to the default configuration files
  • I have added tests that prove my fix is effective or that my feature works
    - [ ] I have added an entry in CHANGELOG.next.asciidoc or CHANGELOG-developer.next.asciidoc.

How to test this PR locally

run unit tests via $ go test

Related issues

@urso urso added review Filebeat Filebeat needs_backport PR is waiting to be backported to other branches. Project:Filebeat-Input-v2 v7.9.0 labels Jun 30, 2020
@botelastic botelastic bot added the needs_team Indicates that the issue/PR needs a Team:* label label Jun 30, 2020
@urso urso added the Team:Services (Deprecated) Label for the former Integrations-Services team label Jun 30, 2020
@elasticmachine
Copy link
Collaborator

Pinging @elastic/integrations-services (Team:Services)

@botelastic botelastic bot removed the needs_team Indicates that the issue/PR needs a Team:* label label Jun 30, 2020
@urso urso added the blocked label Jun 30, 2020
@elasticmachine
Copy link
Collaborator

elasticmachine commented Jun 30, 2020

💚 Build Succeeded

Pipeline View Test View Changes Artifacts preview

Expand to view the summary

Build stats

  • Build Cause: [Pull request #19528 updated]

  • Start Time: 2020-07-01T15:35:46.045+0000

  • Duration: 59 min 36 sec

Test stats 🧪

Test Results
Failed 0
Passed 547
Skipped 128
Total 675


keys := gcFind(states.table, started, time.Now())
if len(keys) == 0 {
log.Debug("No entries to remove found")
Copy link
Contributor

Choose a reason for hiding this comment

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

Nit: "were found"

Copy link
Contributor

@kvch kvch left a comment

Choose a reason for hiding this comment

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

LGTM, minor comment.

Copy link
Contributor

@kvch kvch left a comment

Choose a reason for hiding this comment

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

Once the CI is happy, I am happy.

@urso urso force-pushed the input-v2-cursor-gcstates branch from 1d2ac73 to 239451e Compare July 1, 2020 13:45
@urso urso removed the blocked label Jul 1, 2020
urso added 3 commits July 1, 2020 17:20
The change provides the collection and deletion support for old states.
All entries added to the store have a TTL configured. A key-value pair
will be removed from the store once the most recent update timestamp + TTL < now.
Pairs with pending updates will not be deleted yet.

The collector currently only implements the logic for the clean_inactive setting.

In comparison to the old registar, is the TTL not reset on startup. Old
entries are still subject to collection, even if they've not been
claimed. The TTL will be updated by the InputManager if an input with a
different TTL is started for an already seen source.

The full list of changes will include:
- Introduce v2 API interfaces
- Introduce [compatibility layer](https://github.com/urso/beats/tree/fb-input-v2-combined/filebeat/input/v2/compat) to integrate API with existing functionality
- Introduce helpers for writing [stateless](https://github.com/urso/beats/blob/fb-input-v2-combined/filebeat/input/v2/input-stateless/stateless.go) inputs.
- Introduce helpers for writing [inputs that store a state](https://github.com/urso/beats/tree/fb-input-v2-combined/filebeat/input/v2/input-cursor) between restarts.
- Integrate new API with [existing inputs and modules](https://github.com/urso/beats/blob/fb-input-v2-combined/filebeat/beater/filebeat.go#L301) in filebeat.
@urso urso force-pushed the input-v2-cursor-gcstates branch from 239451e to 7d3cf5e Compare July 1, 2020 15:28
@urso urso merged commit 3405876 into elastic:master Jul 1, 2020
@urso urso deleted the input-v2-cursor-gcstates branch July 1, 2020 21:27
urso pushed a commit to urso/beats that referenced this pull request Jul 8, 2020
The change provides the collection and deletion support for old states.
All entries added to the store have a TTL configured. A key-value pair
will be removed from the store once the most recent update timestamp + TTL < now.
Pairs with pending updates will not be deleted yet.

The collector currently only implements the logic for the clean_inactive setting.

In comparison to the old registar, is the TTL not reset on startup. Old
entries are still subject to collection, even if they've not been
claimed. The TTL will be updated by the InputManager if an input with a
different TTL is started for an already seen source.
@urso urso removed the needs_backport PR is waiting to be backported to other branches. label Jul 8, 2020
urso pushed a commit that referenced this pull request Jul 8, 2020
…plement storage handling for cursor inputs (#19732)
melchiormoulin pushed a commit to melchiormoulin/beats that referenced this pull request Oct 14, 2020
The change provides the collection and deletion support for old states.
All entries added to the store have a TTL configured. A key-value pair
will be removed from the store once the most recent update timestamp + TTL < now.
Pairs with pending updates will not be deleted yet.

The collector currently only implements the logic for the clean_inactive setting.

In comparison to the old registar, is the TTL not reset on startup. Old
entries are still subject to collection, even if they've not been
claimed. The TTL will be updated by the InputManager if an input with a
different TTL is started for an already seen source.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Filebeat Filebeat Project:Filebeat-Input-v2 review skip-test-plan Team:Services (Deprecated) Label for the former Integrations-Services team v7.9.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants