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

[filebeat][httpjson] - Added bug-fix for duplicate data issue #33213 #33664

Merged
merged 7 commits into from
Nov 17, 2022

Conversation

ShourieG
Copy link
Contributor

@ShourieG ShourieG commented Nov 14, 2022

Type of change

  • Bug Fix

What does this PR do?

This PR adds a bug-fix for the issue #33213 by getting rid of the if condition which was the culprit, and also putting in
safeguards so the operation remains similar as before and does not break any tests.

Issue: The cursor data was not being updated consistently when chaining with pagination at the root level was present.
This has now been fixed & tests have been added to support the same.

response.split, response.transforms would not work for the initial root response when pagination & chaining were present together. This also has been fixed with this change.

Why is it important?

Fixes a duplicate data bug as reported in the issue #33213

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.

Author's Checklist

  • Code quality & syntax

Related issues

@ShourieG ShourieG requested a review from a team as a code owner November 14, 2022 07:58
@botelastic botelastic bot added the needs_team Indicates that the issue/PR needs a Team:* label label Nov 14, 2022
@elasticmachine
Copy link
Collaborator

Pinging @elastic/security-external-integrations (Team:Security-External Integrations)

@botelastic botelastic bot removed the needs_team Indicates that the issue/PR needs a Team:* label label Nov 14, 2022
@ShourieG ShourieG self-assigned this Nov 14, 2022
@mergify
Copy link
Contributor

mergify bot commented Nov 14, 2022

This pull request does not have a backport label.
If this is a bug or security fix, could you label this PR @ShourieG? 🙏.
For such, you'll need to label your PR with:

  • The upcoming major version of the Elastic Stack
  • The upcoming minor version of the Elastic Stack (if you're not pushing a breaking change)

To fixup this pull request, you need to add the backport labels for the needed
branches, such as:

  • backport-v8./d.0 is the label to automatically backport to the 8./d branch. /d is the digit

x-pack/filebeat/input/httpjson/request.go Outdated Show resolved Hide resolved
x-pack/filebeat/input/httpjson/transform.go Outdated Show resolved Hide resolved
x-pack/filebeat/input/httpjson/response.go Outdated Show resolved Hide resolved
@ShourieG
Copy link
Contributor Author

@efd6 updated pr with the requested changes.

@elasticmachine
Copy link
Collaborator

elasticmachine commented Nov 14, 2022

💚 Build Succeeded

the below badges are clickable and redirect to their specific view in the CI or DOCS
Pipeline View Test View Changes Artifacts preview preview

Expand to view the summary

Build stats

  • Start Time: 2022-11-16T07:54:20.907+0000

  • Duration: 71 min 25 sec

Test stats 🧪

Test Results
Failed 0
Passed 2467
Skipped 167
Total 2634

💚 Flaky test report

Tests succeeded.

🤖 GitHub comments

Expand to view the GitHub comments

To re-run your PR in the CI, just comment with:

  • /test : Re-trigger the build.

  • /package : Generate the packages and run the E2E tests.

  • /beats-tester : Run the installation tests with beats-tester.

  • run elasticsearch-ci/docs : Re-trigger the docs validation. (use unformatted text in the comment!)

@efd6
Copy link
Contributor

efd6 commented Nov 14, 2022

Can you construct a test that will fail without this change based on the original issue?

@ShourieG
Copy link
Contributor Author

ShourieG commented Nov 16, 2022

@efd6 I re-evaluated the fix and saw that we need not mess with the clearInterval() logic. The cursor data was not being updated consistently when chaining with pagination was present and have made changes to fix that, this also fixes any issues we had with the clear interval call. Pagination is avoided for the 1st root level request in the 1st iteration when chaining is present and this is done in a way such that the last_response, last_event & first_event are all properly updated along with any response.transforms or response.split operations. This was not happening initially and it has now been fixed. Added tests to support the same.

@ShourieG ShourieG requested a review from a team November 16, 2022 08:11
@ShourieG ShourieG merged commit afb2beb into elastic:main Nov 17, 2022
@ShourieG ShourieG deleted the httpjson/bugfix-33213 branch November 17, 2022 06:13
@ShourieG ShourieG restored the httpjson/bugfix-33213 branch November 22, 2022 18:42
@ShourieG ShourieG added the backport-v8.6.0 Automated backport with mergify label Nov 22, 2022
mergify bot pushed a commit that referenced this pull request Nov 22, 2022
…33664)

* added bugfix for duplicate data issue #33213

* updated with PR suggetions

* updated comments

* re-engineered bugfix to update cursors properly

* spelling fix

(cherry picked from commit afb2beb)
ShourieG added a commit that referenced this pull request Nov 23, 2022
…33664) (#33767)

* added bugfix for duplicate data issue #33213

* updated with PR suggetions

* updated comments

* re-engineered bugfix to update cursors properly

* spelling fix

(cherry picked from commit afb2beb)

Co-authored-by: ShourieG <[email protected]>
chrisberkhout pushed a commit that referenced this pull request Jun 1, 2023
…33664)

* added bugfix for duplicate data issue #33213

* updated with PR suggetions

* updated comments

* re-engineered bugfix to update cursors properly

* spelling fix
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
8.6 candidate backport-v8.6.0 Automated backport with mergify bugfix
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Filebeat][httpjson] Value of cursor is not being set in the first call in the chained calls
3 participants