Fix get field mapping API returns 404 error in mixed cluster with multiple versions
Description
Fix the bug of get field mapping API returns 404 error intermittently in a mix cluster with multiple versions(1.x and 2.x), the bug is cause by the deserialization method of GetFieldMappingsResponse in 2.x that doesn't handle the stream from 1.x node correctly, if the requested field doesn't exist in the index, then this line in 1.x node writes 0 to the out stream, but in 2.x branch and main branch, we don't take 0 into account, so an exception Expected single type but received [0] is thrown, finally the get field mapping api request returns 404 error.
After this PR is backported to 2.x branch, this flaky test will be resolved.
Related Issues
https://github.com/opensearch-project/OpenSearch/issues/13622 https://github.com/opensearch-project/OpenSearch/issues/2440
Check List
- [x] New functionality includes testing.
- [x] All tests pass
- [x] New functionality has been documented.
- [x] New functionality has javadoc added
- [x] Failing checks are inspected and point to the corresponding known issue(s) (See: Troubleshooting Failing Builds)
- [x] Commits are signed per the DCO using --signoff
- [x] Commit changes are listed out in CHANGELOG.md file (See: Changelog)
- [x] Public documentation issue/PR created
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license. For more information on following Developer Certificate of Origin and signing off your commits, please check here.
:white_check_mark: Gradle check result for 404d1c1f9e651f6f57f2a747932012ff5e450466: SUCCESS
Codecov Report
Attention: Patch coverage is 0% with 3 lines in your changes are missing coverage. Please review.
Project coverage is 71.64%. Comparing base (
b15cb0c) to head (2464237). Report is 273 commits behind head on main.
| Files | Patch % | Lines |
|---|---|---|
| .../indices/mapping/get/GetFieldMappingsResponse.java | 0.00% | 3 Missing :warning: |
Additional details and impacted files
@@ Coverage Diff @@
## main #13624 +/- ##
============================================
+ Coverage 71.42% 71.64% +0.22%
- Complexity 59978 61117 +1139
============================================
Files 4985 5052 +67
Lines 282275 287146 +4871
Branches 40946 41608 +662
============================================
+ Hits 201603 205730 +4127
- Misses 63999 64382 +383
- Partials 16673 17034 +361
:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.
:x: Gradle check result for e3351c5abd9f66ca5b37fa5b3b8ca923be170aa0: FAILURE
Please examine the workflow log, locate, and copy-paste the failure(s) below, then iterate to green. Is the failure a flaky test unrelated to your change?
Thanks a lot @gaobinlong !
:x: Gradle check result for 246423728c3e6b3211511f85925efdf11e89b8b5: FAILURE
Please examine the workflow log, locate, and copy-paste the failure(s) below, then iterate to green. Is the failure a flaky test unrelated to your change?
https://github.com/opensearch-project/OpenSearch/issues/12197 https://github.com/opensearch-project/OpenSearch/issues/13600
:x: Gradle check result for 246423728c3e6b3211511f85925efdf11e89b8b5: FAILURE
Please examine the workflow log, locate, and copy-paste the failure(s) below, then iterate to green. Is the failure a flaky test unrelated to your change?
https://github.com/opensearch-project/OpenSearch/issues/13476
:x: Gradle check result for 246423728c3e6b3211511f85925efdf11e89b8b5: FAILURE
Please examine the workflow log, locate, and copy-paste the failure(s) below, then iterate to green. Is the failure a flaky test unrelated to your change?
java.lang.Exception: Suite timeout exceeded (>= 1200000 msec).
at __randomizedtesting.SeedInfo.seed([4E67A13E835E2CB8]:0)
:white_check_mark: Gradle check result for 246423728c3e6b3211511f85925efdf11e89b8b5: SUCCESS