Skip to content

[BUG] Reject explicitly set empty index.store.type (GH#22550) - #22592

Open
waterWang wants to merge 1 commit into
opensearch-project:mainfrom
waterWang:fix/empty-store-type-22550
Open

[BUG] Reject explicitly set empty index.store.type (GH#22550)#22592
waterWang wants to merge 1 commit into
opensearch-project:mainfrom
waterWang:fix/empty-store-type-22550

Conversation

@waterWang

Copy link
Copy Markdown

Description

Fixes #22550 — Creating an index with index.store.type explicitly set to an empty string is accepted, but the primary shard subsequently fails to initialize and the index remains red.

Root Cause

The INDEX_STORE_TYPE_SETTING definition in IndexModule.java has no validation for the store type value, and the validateStoreTypeSettings method in MetadataCreateIndexService.java only checks for deprecated simplefs type.

Fix

Add validation in validateStoreTypeSettings to reject an explicitly set empty store type before the index metadata is committed. The empty string default is preserved for backward compatibility (when the setting is not specified, the default store type is used).

Related Issues

@waterWang
waterWang requested a review from a team as a code owner July 28, 2026 22:25
@github-actions github-actions Bot added bug Something isn't working Other labels Jul 28, 2026
@github-actions

Copy link
Copy Markdown
Contributor

PR Reviewer Guide 🔍

Here are some key observations to aid the review process:

🧪 No relevant tests
🔒 No security concerns identified
✅ No TODO sections
🔀 No multiple PR themes
⚡ No major issues detected

Comment on lines +1406 to +1412
if (IndexModule.INDEX_STORE_TYPE_SETTING.exists(settings)) {
String storeType = IndexModule.INDEX_STORE_TYPE_SETTING.get(settings);
if (storeType.isEmpty()) {
throw new IllegalArgumentException(
"Failed to parse value for setting [" + IndexModule.INDEX_STORE_TYPE_SETTING.getKey() + "] must not be empty"
);
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

can we add a unit test for this change

@github-actions

Copy link
Copy Markdown
Contributor

✅ Gradle check result for aca623c: SUCCESS

@codecov

codecov Bot commented Jul 28, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 40.00000% with 3 lines in your changes missing coverage. Please review.
✅ Project coverage is 71.41%. Comparing base (d19f68e) to head (aca623c).
⚠️ Report is 3 commits behind head on main.

Files with missing lines Patch % Lines
...h/cluster/metadata/MetadataCreateIndexService.java 40.00% 2 Missing and 1 partial ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##               main   #22592      +/-   ##
============================================
- Coverage     71.43%   71.41%   -0.02%     
- Complexity    76760    76794      +34     
============================================
  Files          6142     6142              
  Lines        357766   357799      +33     
  Branches      52148    52164      +16     
============================================
- Hits         255581   255539      -42     
- Misses        81861    81945      +84     
+ Partials      20324    20315       -9     

☔ View full report in Codecov by Harness.
📢 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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working Other

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG] Explicit empty index.store.type creates an unusable red index

2 participants