-
Notifications
You must be signed in to change notification settings - Fork 25.6k
Add tier_preference and node.role columns to _cat/shards API #138405
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
base: main
Are you sure you want to change the base?
Conversation
|
💚 CLA has been signed |
d559f89 to
2bf3173
Compare
ℹ️ Important: Docs version tagging👋 Thanks for updating the docs! Just a friendly reminder that our docs are now cumulative. This means all 9.x versions are documented on the same page and published off of the main branch, instead of creating separate pages for each minor version. We use applies_to tags to mark version-specific features and changes. Expand for a quick overviewWhen to use applies_to tags:✅ At the page level to indicate which products/deployments the content applies to (mandatory) What NOT to do:❌ Don't remove or replace information that applies to an older version 🤔 Need help?
|
2bf3173 to
49dcfbe
Compare
|
Pinging @elastic/es-data-management (Team:Data Management) |
49dcfbe to
fc1aa0c
Compare
|
hi @pswaao88, thank you for your interest in elasticsearch! few preliminary things before reviewing:
|
|
Hi @szybia, Thank you very much for running the CI and for the clear feedback. As this is my first contribution to Elasticsearch, I wasn't fully aware of these processes. Thank you for the guidance! Regarding the preliminary items: Git History: Testing: Thank you again for your time! |
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'll run the CI for you again, but you'll still probably get a bunch of failures due to not adjusting the existing tests that assert the body of the response (have a scan through all the different failures in buildkite/CI)
helpful suggestion: ctrl-f for reproduce with once you expand a job that failed, and that will highlight all the tests that have failed within that job, run the gradle command locally, and then you can start figuring it why it failed and how to fix it
| table.addCell(getOrNull(commonStats, CommonStats::getSparseVectorStats, SparseVectorStats::getValueCount)); | ||
|
|
||
| table.addCell( | ||
| Optional.ofNullable(getOrNull( |
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.
without having a deeper look, it surprises me that we need a null check here when the other cells/fields above seem to be fine with null
mind helping me understand why this is needed? 🙏
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.
Hi @szybia,
Thank you for the guidance. As a university student who has recently started studying this field (and is new to contributing to complex systems), I view each CI failure as a valuable learning opportunity.
I've reviewed the failure logs and have made the following attempt to fix the issue:
- Issue Identification: I found that the widespread CI failures were related to a NullPointerException (NPE) occurring during Backward Compatibility (BWC) tests.
- Hypothesis: I suspect the issue is that the newly added String fields receive a raw
nullvalue from older nodes, causing the system to crash later. - Attempted Solution: To fix this, I applied the
Optional.ofNullable().orElse("")pattern to ensure a safe String is returned instead of null.
I would be very grateful if you could confirm my understanding.
Could you please confirm if my diagnosis of the root cause and the need for a null check is fundamentally correct? Also, if my approach is missing the preferred project convention, could you kindly provide a small hint or gentle guidance on the correct direction? I want to ensure I'm adopting the best practices for future contributions. 🙏
Additionally, is it okay for me to manually trigger the tests by commenting 'buildkite test this' if they don't start automatically?
Thank you for your patience and guidance!
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.
Hi @pswaao88 and thanks for your contribution here.
You should be running these tests locally as part of your development process - see these docs. To be fair ./gradlew check takes a while and mostly will be running tests that are not germane to your change, but the ones that you've seen fail in CI are the important ones and you should be re-running them yourself before asking for another CI run and code review. Looking at the recent failures that means you need to make sure that at least the following command completes successfully on your local machine first:
./gradlew :server:test :rest-api-spec:yamlRestTest :qa:smoke-test-multinode:yamlRestTest
Additionally, is it okay for me to manually trigger the tests by commenting 'buildkite test this' if they don't start automatically?
Unfortunately no, for security reasons we can't allow external contributors to trigger their own test runs in CI. We have to check there's at least nothing obviously malicious in the changes we're about to test before running anything.
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 be very grateful if you could confirm my understanding.
This (and more) will come out in the code review, once the tests are all passing and you've added some more tests to support your own change. Please bear in mind that our capacity for reviewing contributions like this is bounded, so please try not to exhaust your share of this capacity on relatively minor questions like this. I'd love it if we could welcome contributions of all levels but unfortunately we do not have the infinite time that this would require.
Please also carefully read this section of the contributing guide noting particularly (emphasis mine):
We sometimes reject contributions due to the low quality of the submission since low-quality submissions tend to take unreasonable effort to review properly. Quality is rather subjective so it is hard to describe exactly how to avoid this, but there are some basic steps you can take to reduce the chances of rejection. Follow the guidelines listed above when preparing your changes. You should add tests that correspond with your changes, and your PR should pass affected test suites too. It makes it much easier to review if your code is formatted correctly and does not include unnecessary extra changes.
|
buildkite test this |
…m/pswaao88/elasticsearch into feature/136895-cat-shards-columns
|
Hi @DaveCTurner and @szybia, Thank you both for the guidance and patience. As a student new to contributing, I really appreciate your help in getting the process right. Following @DaveCTurner's instructions, I have successfully run and passed the local tests ( I have pushed the commits that resolve the BWC NPE (using Optional for safety) and adjusted the existing tests to account for the new columns. I would appreciate it if you could take a look. Thanks! |
Description
This PR adds
tier_preferenceandnode.rolecolumns to the_cat/shardsAPI to facilitate troubleshooting of ILM allocation issues, as requested in #136895.Implementation Details
tier_preference(tp): Retrieves theindex.routing.allocation.include._tier_preferencesetting fromIndexMetadata.Metadata#findIndex(Index)instead of the deprecatedindex(String)orgetProject()methods to safely handle index lookup in the current architecture.node.role(r): Retrieves the node role abbreviation usingDiscoveryNode#getRoleAbbreviationString(), ensuring consistency with the_cat/nodesAPI.getOrNullto preventNullPointerExceptionwhen shards are unassigned or metadata is missing.Related Issues
Closes #136895
Note to Reviewers
This is my first contribution to Elasticsearch! 🚀
As a non-native English speaker and a first-time contributor, I apologize in advance if I missed any conventions or used awkward phrasing. If there is anything I overlooked or need to improve, please let me know, and I will address it immediately. Thank you for the opportunity to contribute.