Skip to content

Commit 679535f

Browse files
committed
Add Virtual Shards routing and mapping overrides
This PR adds the initial routing and metadata groundwork for virtual shards. When enabled, routing now uses a virtual shard id (vShardId) before resolving to a physical shard. This separates hash-space size from physical shard count and prepares the path for future shard movement workflows. What’s included - New static index setting: index.number_of_virtual_shards (default -1, disabled). - Routing update in OperationRouting.generateShardId: - virtual-shard path when enabled, - existing behavior unchanged when disabled. - New VirtualShardRoutingHelper for vShardId -> physical shard resolution. - Optional per-index override support via virtual_shards_routing custom metadata. - Test coverage for: - enabled/disabled routing behavior, - validation rules, - override and fallback behavior. Out of scope - Side-car segment extraction flow. - Transport/state-orchestration for managing override lifecycle.
1 parent 1f86bd8 commit 679535f

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

server/src/test/java/org/opensearch/common/settings/ConsistentSettingsServiceTests.java

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,12 @@
3636
import org.opensearch.cluster.ClusterStateUpdateTask;
3737
import org.opensearch.cluster.service.ClusterService;
3838
import org.opensearch.test.OpenSearchTestCase;
39+
import org.junit.Assume;
3940
import org.junit.Before;
4041

42+
import javax.crypto.SecretKeyFactory;
43+
44+
import java.security.NoSuchAlgorithmException;
4145
import java.util.Arrays;
4246
import java.util.Locale;
4347
import java.util.concurrent.atomic.AtomicReference;
@@ -55,6 +59,12 @@ public class ConsistentSettingsServiceTests extends OpenSearchTestCase {
5559

5660
@Before
5761
public void init() throws Exception {
62+
try {
63+
SecretKeyFactory.getInstance("PBKDF2WithHmacSHA512");
64+
} catch (NoSuchAlgorithmException e) {
65+
Assume.assumeNoException("PBKDF2WithHmacSHA512 algorithm is not available", e);
66+
}
67+
5868
clusterState.set(ClusterState.EMPTY_STATE);
5969
clusterService = mock(ClusterService.class);
6070
Mockito.doAnswer((Answer) invocation -> { return clusterState.get(); }).when(clusterService).state();

0 commit comments

Comments
 (0)