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

Apply RetryOnConflict on Bulk documents #2184

Merged
merged 3 commits into from
Jan 18, 2024

Conversation

csabavirag
Copy link
Contributor

This PR is created to solve the issue on the missing RetryOnConflict (retry_on_conflict) metadata attribute when adding documents in bulk (detailed at #2182)

Copy link
Owner

@ruflin ruflin left a comment

Choose a reason for hiding this comment

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

Thanks for the PR. Change LGTM. Could you add an entry to the changelog? And can you check in the test suite if there is an easy way to add a test for this?

Normally we make changes to 8.x first and then backport to 7.x. But currently there is quite a large PR ongoing against 8.x to make it 8 compatible: #2181 What I propose is to get this in but in parallel follow up with a PR against the 8.x branch to ensure we don't forget about it. Otherwise I worry we will miss this feature in 8.x.

@ruflin
Copy link
Owner

ruflin commented Jan 17, 2024

@csabavirag I did just trigger the test suite and it seems to break one of the tests. It seems that in some cases the object is null so you need to add a check for this.

@csabavirag
Copy link
Contributor Author

I pushed a new commit with does not set RetryOnConflict if it has already been set on the document/script. I know retry_on_conflict is stripped from the final message(s) if its value is 0, but thought to exclude this case in order to a smaller memory footprint.
This allowed me to run BulkTest.php successfully. Only 1 error was reported, but I believe this is not related to these changes

Output of make docker-run-phpunit PHPUNIT_OPTIONS="tests/BulkTest.php":

There was 1 failure:

1) Elastica\Test\BulkTest::testMemoryUsage
Failed asserting that 2.3990734932979025 is less than 1.31.

I also updated the BulkTest suite to check the parameter is set on the document/script properly when only the client has retry_on_conflict set ("global option").

Copy link
Owner

@ruflin ruflin left a comment

Choose a reason for hiding this comment

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

Change LGTM, waiting on CI to run through.

@@ -8,6 +8,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

### Backward Compatibility Breaks
### Added
* If not expicitly set, use `retry_on_conflict` from Client configuration in Bulk updates [#2184](https://github.com/ruflin/Elastica/pull/2184)
Copy link
Owner

Choose a reason for hiding this comment

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

Should we put this under "fixed"? sounds more like a bug fix but also happy to keep it under Added.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

First I added to that section. Then I moved to Added. TBH, I would leave it up to you.

Copy link
Owner

Choose a reason for hiding this comment

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

Lets keep it, I can always clean it up later.

@ruflin ruflin merged commit d1b973f into ruflin:7.x Jan 18, 2024
10 checks passed
@ruflin
Copy link
Owner

ruflin commented Jan 18, 2024

@csabavirag Thank you for the contribution!

Could you follow up with a PR against 8.x. The big 8.x change made it in and we should make sure this change also makes it into 8.x

ruflin pushed a commit that referenced this pull request Jan 22, 2024
This is a follow up PR to #2184 and replicates changes on 8.x branch.
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.

2 participants