-
Notifications
You must be signed in to change notification settings - Fork 24.7k
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
Rollover max docs should only count primaries #24977
Conversation
Since this is a community submitted pull request, a Jenkins build has not been kicked off automatically. Can an Elastic organization member please verify the contents of this patch and then kick off a build manually? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for the PR. The change looks good but I would love to move the test to be a unit test. I left a suggestion on how to do it.
- do: | ||
indices.create: | ||
index: logs-1 | ||
wait_for_active_shards: all |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would much prefer it if you add a unit test in TransportRolloverActionTests instead. The REST yaml tests are there to make sure we pass requests and read responses correctly but it has a big overhead to test simple inner behavior with it. To do so you can add an overload of evaluateConditions that takes IndicesStatsResponse and translates it to a call to an evaluateConditions which gets the number of docs (it seems that's the only stats we use in here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for suggestion. I'll create unit test. Should I keep yaml test?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yeah please keep it
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@bleskes I added 2 more tests to TransportRolloverActionTests
@karmi I have used incorrect email in commit. Should I create new PR? |
3282edd
to
e1a4870
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you @fred84! I think we are moving in the right direction. I would like to suggest another simplifications. We already have a fairly extended test to test the condition logic (testEvaluateConditions
). We don't really need to duplicate the testing logic in it. I think we need to test here is only the conversion between IndicesStatsResponse
and the DocStats
used for the conditions. We can do so, using the new method you added, by adding a single test call testDocStatsSelection
(or something like) that has a single custom condition when asserts that the numbers you got are what you expect. You can then randomize the stats in a IndicesStatsResponse
and use the custom condition to assert that the right ones (i.e., the primaries) have been passed into it.
Thanks for suggestions, @bleskes. I updated the PR. The only thing I disagree that we need randomize stats in test. "testDocStatsSelectionFromPrimariesOnly" checks only that right value passed from IndicesStatResponse to Condition. There is no manipulation with this value inside "evaluateConditions". |
@elasticmachine ok to test |
I see this in the build logs:
|
The rest test are run (sometimes) against a 1 node cluster. This means that replicas won't always be assigned. This |
we run test with one node and with multiple nodes I think your test will be fine it should just use defaults and remove the |
I agree it will be great if we can pin down the test to always fail without your fix. Sadly this is not possible today. Doing it like we suggested means it will fail sometimes (if the replicas were fast enough to allocate). That's better than nothing.
I'm not sure I follow this one. can you clarify? |
Test had checks for docs count in both "total" and "primaries": - match: { _all.primaries.docs.count: 1 }
- match: { _all.total.docs.count: 2 } It was done to explicitly demonstrate that condition will be applied only after primaries reach max_docs. So test was expected to fail with replica count other then 1.
|
":distribution:integ-test-zip:integTest" now works fine, but ":qa:mixed-cluster:integTest" fails most of the times locally. I will try to figure it out. |
@bleskes I currently added "skip before 5.6.1 version" in yml to pass mixed cluster test, but I'm not sure that it is proper version. |
@fred84 that makes sense for now, I'll fix it later based on how we decide to backport this. Thanks for all the itertations |
max_doc condition for index rollover should use document count only from primary shards Fixes #24217
max_doc condition for index rollover should use document count only from primary shards Fixes #24217
max_doc condition for index rollover should use document count only from primary shards Fixes #24217
* master: (27 commits) Refactor TransportShardBulkAction.executeUpdateRequest and add tests Make sure range queries are correctly profiled. (elastic#25108) Test: allow setting socket timeout for rest client (elastic#25221) Migration docs for elastic#25080 (elastic#25218) Remove `discovery.type` BWC layer from the EC2/Azure/GCE plugins elastic#25080 When stopping via systemd only kill the JVM, not its control group (elastic#25195) Remove PrefixAnalyzer, because it is no longer used. Internal: Remove Strings.cleanPath (elastic#25209) Docs: Add note about which secure settings are valid (elastic#25212) Indices.rollover/10_basic should refresh to make the doc visible in lucene stats Port support for commercial GeoIP2 databases from Logstash. (elastic#24889) [DOCS] Add ML node to node.asciidoc (elastic#24495) expose simple pattern tokenizers (elastic#25159) Test: add setting to change request timeout for rest client (elastic#25201) Fix secure repository-hdfs tests on JDK 9 Add target_field parameter to gsub, join, lowercase, sort, split, trim, uppercase (elastic#24133) Add Cross Cluster Search support for scroll searches (elastic#25094) Adapt skip version in rest-api-spec/test/indices.rollover/20_max_doc_condition.yml Rollover max docs should only count primaries (elastic#24977) Add remote cluster infrastructure to fetch discovery nodes. (elastic#25123) ...
max_doc condition for index rollover should use document count only from primary shards
Fixes #24217