Skip to content

Restore default shard_path_type to FIXED for snapshot repositories#20940

Open
mango766 wants to merge 1 commit intoopensearch-project:mainfrom
mango766:fix/restore-shard-path-type-default-to-fixed
Open

Restore default shard_path_type to FIXED for snapshot repositories#20940
mango766 wants to merge 1 commit intoopensearch-project:mainfrom
mango766:fix/restore-shard-path-type-default-to-fixed

Conversation

@mango766
Copy link

Description

Restores the default value of shard_path_type in BlobStoreRepository from HASHED_PREFIX back to FIXED.

PR #18163 changed this default, which causes snapshot shard blobs to be uploaded outside the configured base_path in storage services like S3/MinIO. This is a breaking change for anyone upgrading from 2.x to 3.x — incremental backups fail because the new path layout is incompatible with existing repositories. The change also went in without a changelog entry.

The fix aligns the repository setting default with the existing IndexId.DEFAULT_SHARD_PATH_TYPE constant, which is already FIXED. Users who want HASHED_PREFIX can still set it explicitly when registering their repository.

Related Issues

Resolves #20643

Check List

  • 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.

PR opensearch-project#18163 changed the default shard_path_type from FIXED to HASHED_PREFIX,
which causes snapshot blobs to be uploaded outside the configured base_path.
This is a breaking change for users upgrading from 2.x to 3.x, as it breaks
incremental backups and places files outside the expected repository path.

Restoring the default to FIXED to match the 2.x behavior and the existing
IndexId.DEFAULT_SHARD_PATH_TYPE constant.

Signed-off-by: mango766 <mango766@users.noreply.github.com>
Signed-off-by: easonysliu <easonysliu@tencent.com>
@mango766 mango766 requested a review from a team as a code owner March 20, 2026 10:14
@github-actions github-actions bot added bug Something isn't working Storage:Snapshots labels Mar 20, 2026
@github-actions
Copy link
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
⚡ Recommended focus areas for review

Breaking Change

Changing the default shard_path_type from HASHED_PREFIX back to FIXED is a breaking change for users who upgraded to 3.x and already created repositories with the HASHED_PREFIX default. Those users will now have a mismatch between existing snapshot data (stored under hashed paths) and the new default, potentially causing incremental backup failures. Consider whether a migration path or warning is needed for users already on 3.x with HASHED_PREFIX repositories.

public static final Setting<PathType> SHARD_PATH_TYPE = new Setting<>(
    "shard_path_type",
    PathType.FIXED.toString(),
    PathType::parseString
);

@github-actions
Copy link
Contributor

✅ Gradle check result for ea78a17: SUCCESS

@codecov
Copy link

codecov bot commented Mar 20, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 73.24%. Comparing base (06539a4) to head (ea78a17).

Additional details and impacted files
@@             Coverage Diff              @@
##               main   #20940      +/-   ##
============================================
- Coverage     73.27%   73.24%   -0.03%     
+ Complexity    72497    72442      -55     
============================================
  Files          5819     5819              
  Lines        331352   331352              
  Branches      47875    47875              
============================================
- Hits         242784   242699      -85     
- Misses        69065    69151      +86     
+ Partials      19503    19502       -1     

☔ 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.

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

Labels

bug Something isn't working Storage:Snapshots

Projects

Status: No status

Development

Successfully merging this pull request may close these issues.

[BUG] Default value of parameter shard_path_type changed in 3.x

1 participant