Skip to content

Fix node local term/version log truncation with long host provider addresses#20432

Merged
andrross merged 9 commits intoopensearch-project:mainfrom
srikanthpadakanti:bugfix/19249-term-version-log-truncation-oss
Jan 28, 2026
Merged

Fix node local term/version log truncation with long host provider addresses#20432
andrross merged 9 commits intoopensearch-project:mainfrom
srikanthpadakanti:bugfix/19249-term-version-log-truncation-oss

Conversation

@srikanthpadakanti
Copy link
Copy Markdown
Contributor

@srikanthpadakanti srikanthpadakanti commented Jan 18, 2026

Description

This change fixes an issue where a node’s local term and version information could be truncated in cluster formation failure logs when host providers return very long IP addresses or host strings.

The truncation made critical coordination diagnostics difficult, especially in environments with custom or dynamic host providers that emit unusually large address values. This update ensures that the full local term and version information is preserved and logged correctly, improving observability and debuggability during cluster formation failures.

The fix includes:

  • Safer handling of long host provider address strings during log construction.
  • Adjustments to avoid truncation of local term and version fields.
  • Expanded test coverage to validate behavior with large host/IP inputs.

Related Issues

Resolves #19249

Check List

  • [ X] Functionality includes testing.
  • API changes companion pull request created, if applicable.
  • Public documentation issue/PR created, if applicable.

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.

@srikanthpadakanti srikanthpadakanti requested a review from a team as a code owner January 18, 2026 03:28
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Jan 18, 2026

Important

Review skipped

Auto incremental reviews are disabled on this repository.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

  • 🔍 Trigger a full review
📝 Walkthrough

Walkthrough

This pull request adds a configurable limit for truncating cluster formation warning addresses in logs. A new setting DISCOVERY_CLUSTER_FORMATION_WARNING_ADDRESS_LIMIT_SETTING controls the maximum number of addresses displayed, with a utility method formatListForLog() implementing the truncation logic to prevent excessively long log messages from host providers.

Changes

Cohort / File(s) Summary
Configuration & Settings
CHANGELOG.md, server/src/main/java/org/opensearch/cluster/coordination/ClusterFormationFailureHelper.java, server/src/main/java/org/opensearch/common/settings/ClusterSettings.java
Adds DISCOVERY_CLUSTER_FORMATION_WARNING_ADDRESS_LIMIT_SETTING (default: 200) to configure address truncation behavior, registers it in built-in cluster settings, and documents the change in changelog
Core Implementation
server/src/main/java/org/opensearch/cluster/coordination/ClusterFormationFailureHelper.java
Introduces formatListForLog(List<?> items, int limit) utility method for truncating lists in log output; applies this method to format resolved addresses in cluster formation warnings using the new setting
Test Coverage
server/src/test/java/org/opensearch/cluster/coordination/ClusterFormationFailureHelperTests.java
Updates test expectations to reflect new log message structure; adds three new test methods: testFormatListForLogTruncates(), testDescriptionWithLongHostsProviderAddressesListTruncates(), and testDescriptionWithLongHostsProviderAddressesList() to validate truncation and formatting behavior

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

🚥 Pre-merge checks | ✅ 2 | ❌ 1
❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 18.18% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and specifically describes the main fix: addressing log truncation of node local term/version information when encountering long host provider addresses.
Description check ✅ Passed The pull request description includes all required sections: a clear description of changes, related issue reference (#19249), and a completed checklist with testing confirmed.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.


Comment @coderabbitai help to get the list of available commands and usage tips.

@github-actions
Copy link
Copy Markdown
Contributor

✅ Gradle check result for 95dfa41: SUCCESS

@codecov
Copy link
Copy Markdown

codecov bot commented Jan 18, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 73.35%. Comparing base (672039d) to head (b08c8e3).
⚠️ Report is 12 commits behind head on main.

Additional details and impacted files
@@             Coverage Diff              @@
##               main   #20432      +/-   ##
============================================
+ Coverage     73.25%   73.35%   +0.10%     
- Complexity    71979    72039      +60     
============================================
  Files          5796     5796              
  Lines        329287   329350      +63     
  Branches      47419    47432      +13     
============================================
+ Hits         241203   241607     +404     
+ Misses        68759    68348     -411     
- Partials      19325    19395      +70     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@github-actions github-actions bot added bug Something isn't working Cluster Manager labels Jan 22, 2026
@srikanthpadakanti srikanthpadakanti force-pushed the bugfix/19249-term-version-log-truncation-oss branch from 0619656 to 3a95016 Compare January 22, 2026 18:57
@github-actions
Copy link
Copy Markdown
Contributor

✅ Gradle check result for 3a95016: SUCCESS

@github-actions
Copy link
Copy Markdown
Contributor

✅ Gradle check result for 1f5ceba: SUCCESS

@github-actions
Copy link
Copy Markdown
Contributor

❌ Gradle check result for 41cec11: 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?

@srikanthpadakanti
Copy link
Copy Markdown
Contributor Author

srikanthpadakanti commented Jan 26, 2026

Hello @andrross

The failure is in :distribution:docker:buildArm64DockerImage
Root cause: AlmaLinux mirror 404 during dnf install.

Re-ran the CI pipeline but issue still persists. Any inputs on, how to address this?

@github-actions
Copy link
Copy Markdown
Contributor

❌ Gradle check result for 043d82d: 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?

Srikanth Padakanti added 8 commits January 27, 2026 18:59
…ddress provided by host providers is huge

Signed-off-by: Srikanth Padakanti <srikanth_padakanti@apple.com>
…ddress provided by host providers is huge

Signed-off-by: Srikanth Padakanti <srikanth_padakanti@apple.com>
…ddress provided by host providers is huge

Signed-off-by: Srikanth Padakanti <srikanth_padakanti@apple.com>
Signed-off-by: Srikanth Padakanti <srikanth_padakanti@apple.com>
Signed-off-by: Srikanth Padakanti <srikanth_padakanti@apple.com>
Signed-off-by: Srikanth Padakanti <srikanth_padakanti@apple.com>
Signed-off-by: Srikanth Padakanti <srikanth_padakanti@apple.com>
Signed-off-by: Srikanth Padakanti <srikanth_padakanti@apple.com>
@andrross andrross force-pushed the bugfix/19249-term-version-log-truncation-oss branch from 043d82d to 976ac45 Compare January 27, 2026 18:59
Removed duplicate entries for node local term and version truncation in logs.

Signed-off-by: Srikanth Padakanti <srikanth29.9@gmail.com>
@github-actions
Copy link
Copy Markdown
Contributor

❌ Gradle check result for b08c8e3: 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?

@github-actions
Copy link
Copy Markdown
Contributor

❌ Gradle check result for b08c8e3: 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?

@github-actions
Copy link
Copy Markdown
Contributor

❌ Gradle check result for b08c8e3: 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?

@github-actions
Copy link
Copy Markdown
Contributor

❌ Gradle check result for b08c8e3: null

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?

@github-actions
Copy link
Copy Markdown
Contributor

✅ Gradle check result for b08c8e3: SUCCESS

@andrross andrross merged commit 52fd5b3 into opensearch-project:main Jan 28, 2026
38 of 46 checks passed
@github-project-automation github-project-automation bot moved this from 👀 In review to ✅ Done in Cluster Manager Project Board Jan 28, 2026
tanyabti pushed a commit to tanyabti/OpenSearch that referenced this pull request Feb 24, 2026
…dresses (opensearch-project#20432)

Signed-off-by: Srikanth Padakanti <srikanth_padakanti@apple.com>
Signed-off-by: Srikanth Padakanti <srikanth29.9@gmail.com>
Co-authored-by: Srikanth Padakanti <srikanth_padakanti@apple.com>
tanyabti pushed a commit to tanyabti/OpenSearch that referenced this pull request Feb 24, 2026
…dresses (opensearch-project#20432)

Signed-off-by: Srikanth Padakanti <srikanth_padakanti@apple.com>
Signed-off-by: Srikanth Padakanti <srikanth29.9@gmail.com>
Co-authored-by: Srikanth Padakanti <srikanth_padakanti@apple.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working Cluster Manager

Projects

Status: ✅ Done

Development

Successfully merging this pull request may close these issues.

[BUG] Node's local term and version truncated when IP address provided by host providers is huge

2 participants