Skip to content

Commit fd061a9

Browse files
alchemist51Shailendra Singh
authored andcommitted
Pick remote-routing-table service refactoring changes.
Signed-off-by: Shailendra Singh <[email protected]>
1 parent c19f565 commit fd061a9

22 files changed

+933
-819
lines changed

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,9 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
1313
- Add batching supported processor base type AbstractBatchingProcessor ([#14554](https://github.com/opensearch-project/OpenSearch/pull/14554))
1414
- Fix race condition while parsing derived fields from search definition ([14445](https://github.com/opensearch-project/OpenSearch/pull/14445))
1515
- Add allowlist setting for ingest-common and search-pipeline-common processors ([#14439](https://github.com/opensearch-project/OpenSearch/issues/14439))
16+
- Create SystemIndexRegistry with helper method matchesSystemIndex ([#14415](https://github.com/opensearch-project/OpenSearch/pull/14415))
17+
- Print reason why parent task was cancelled ([#14604](https://github.com/opensearch-project/OpenSearch/issues/14604))
18+
- Refactor remote-routing-table service inline with remote state interfaces([#14668](https://github.com/opensearch-project/OpenSearch/pull/14668))
1619

1720
### Dependencies
1821
- Bump `org.gradle.test-retry` from 1.5.8 to 1.5.9 ([#13442](https://github.com/opensearch-project/OpenSearch/pull/13442))

server/src/main/java/org/opensearch/cluster/routing/remote/InternalRemoteRoutingTableService.java

Lines changed: 74 additions & 318 deletions
Large diffs are not rendered by default.

server/src/main/java/org/opensearch/cluster/routing/remote/NoopRemoteRoutingTableService.java

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -9,15 +9,12 @@
99
package org.opensearch.cluster.routing.remote;
1010

1111
import org.opensearch.action.LatchedActionListener;
12-
import org.opensearch.cluster.ClusterState;
1312
import org.opensearch.cluster.Diff;
1413
import org.opensearch.cluster.DiffableUtils;
1514
import org.opensearch.cluster.routing.IndexRoutingTable;
1615
import org.opensearch.cluster.routing.RoutingTable;
1716
import org.opensearch.common.CheckedRunnable;
18-
import org.opensearch.common.blobstore.BlobPath;
1917
import org.opensearch.common.lifecycle.AbstractLifecycleComponent;
20-
import org.opensearch.core.index.Index;
2118
import org.opensearch.gateway.remote.ClusterMetadataManifest;
2219

2320
import java.io.IOException;
@@ -48,21 +45,23 @@ public DiffableUtils.MapDiff<String, IndexRoutingTable, Map<String, IndexRouting
4845
}
4946

5047
@Override
51-
public CheckedRunnable<IOException> getIndexRoutingAsyncAction(
52-
ClusterState clusterState,
48+
public CheckedRunnable<IOException> getAsyncIndexRoutingWriteAction(
49+
String clusterUUID,
50+
long term,
51+
long version,
5352
IndexRoutingTable indexRouting,
54-
LatchedActionListener<ClusterMetadataManifest.UploadedMetadata> latchedActionListener,
55-
BlobPath clusterBasePath
53+
LatchedActionListener<ClusterMetadataManifest.UploadedMetadata> latchedActionListener
5654
) {
5755
// noop
5856
return () -> {};
5957
}
6058

61-
public CheckedRunnable<IOException> getIndexRoutingDiffAsyncAction(
62-
ClusterState clusterState,
59+
public CheckedRunnable<IOException> getAsyncIndexRoutingDiffWriteAction(
60+
String clusterUUID,
61+
long term,
62+
long version,
6363
Map<String, Diff<IndexRoutingTable>> indexRoutingTableDiff,
64-
LatchedActionListener<ClusterMetadataManifest.UploadedMetadata> latchedActionListener,
65-
BlobPath clusterBasePath
64+
LatchedActionListener<ClusterMetadataManifest.UploadedMetadata> latchedActionListener
6665
) {
6766
// noop
6867
return () -> {};
@@ -80,8 +79,8 @@ public List<ClusterMetadataManifest.UploadedIndexMetadata> getAllUploadedIndices
8079

8180
@Override
8281
public CheckedRunnable<IOException> getAsyncIndexRoutingReadAction(
82+
String clusterUUID,
8383
String uploadedFilename,
84-
Index index,
8584
LatchedActionListener<IndexRoutingTable> latchedActionListener
8685
) {
8786
// noop

server/src/main/java/org/opensearch/cluster/routing/remote/RemoteRoutingTableService.java

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -9,18 +9,15 @@
99
package org.opensearch.cluster.routing.remote;
1010

1111
import org.opensearch.action.LatchedActionListener;
12-
import org.opensearch.cluster.ClusterState;
1312
import org.opensearch.cluster.Diff;
1413
import org.opensearch.cluster.DiffableUtils;
1514
import org.opensearch.cluster.routing.IndexRoutingTable;
1615
import org.opensearch.cluster.routing.IndexShardRoutingTable;
1716
import org.opensearch.cluster.routing.RoutingTable;
1817
import org.opensearch.common.CheckedRunnable;
19-
import org.opensearch.common.blobstore.BlobPath;
2018
import org.opensearch.common.lifecycle.LifecycleComponent;
2119
import org.opensearch.core.common.io.stream.StreamInput;
2220
import org.opensearch.core.common.io.stream.StreamOutput;
23-
import org.opensearch.core.index.Index;
2421
import org.opensearch.gateway.remote.ClusterMetadataManifest;
2522
import org.opensearch.gateway.remote.routingtable.RemoteIndexShardRoutingTableDiff;
2623

@@ -73,8 +70,8 @@ public Diff<IndexRoutingTable> diff(IndexRoutingTable currentState, IndexRouting
7370
List<IndexRoutingTable> getIndicesRouting(RoutingTable routingTable);
7471

7572
CheckedRunnable<IOException> getAsyncIndexRoutingReadAction(
73+
String clusterUUID,
7674
String uploadedFilename,
77-
Index index,
7875
LatchedActionListener<IndexRoutingTable> latchedActionListener
7976
);
8077

@@ -94,18 +91,20 @@ DiffableUtils.MapDiff<String, IndexRoutingTable, Map<String, IndexRoutingTable>>
9491
RoutingTable after
9592
);
9693

97-
CheckedRunnable<IOException> getIndexRoutingAsyncAction(
98-
ClusterState clusterState,
94+
CheckedRunnable<IOException> getAsyncIndexRoutingWriteAction(
95+
String clusterUUID,
96+
long term,
97+
long version,
9998
IndexRoutingTable indexRouting,
100-
LatchedActionListener<ClusterMetadataManifest.UploadedMetadata> latchedActionListener,
101-
BlobPath clusterBasePath
99+
LatchedActionListener<ClusterMetadataManifest.UploadedMetadata> latchedActionListener
102100
);
103101

104-
CheckedRunnable<IOException> getIndexRoutingDiffAsyncAction(
105-
ClusterState clusterState,
102+
CheckedRunnable<IOException> getAsyncIndexRoutingDiffWriteAction(
103+
String clusterUUID,
104+
long term,
105+
long version,
106106
Map<String, Diff<IndexRoutingTable>> indexRoutingTableDiff,
107-
LatchedActionListener<ClusterMetadataManifest.UploadedMetadata> latchedActionListener,
108-
BlobPath clusterBasePath
107+
LatchedActionListener<ClusterMetadataManifest.UploadedMetadata> latchedActionListener
109108
);
110109

111110
List<ClusterMetadataManifest.UploadedIndexMetadata> getAllUploadedIndicesRouting(

server/src/main/java/org/opensearch/cluster/routing/remote/RemoteRoutingTableServiceFactory.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,10 +34,11 @@ public static RemoteRoutingTableService getService(
3434
Supplier<RepositoriesService> repositoriesService,
3535
Settings settings,
3636
ClusterSettings clusterSettings,
37-
ThreadPool threadPool
37+
ThreadPool threadPool,
38+
String clusterName
3839
) {
3940
if (isRemoteRoutingTableEnabled(settings)) {
40-
return new InternalRemoteRoutingTableService(repositoriesService, settings, clusterSettings, threadPool);
41+
return new InternalRemoteRoutingTableService(repositoriesService, settings, clusterSettings, threadPool, clusterName);
4142
}
4243
return new NoopRemoteRoutingTableService();
4344
}

server/src/main/java/org/opensearch/common/remote/AbstractRemoteWritableBlobEntity.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,10 @@ public AbstractRemoteWritableBlobEntity(final String clusterUUID, final Compress
4444
this(clusterUUID, compressor, null);
4545
}
4646

47+
public AbstractRemoteWritableBlobEntity() {
48+
this(null, null, null);
49+
}
50+
4751
public abstract BlobPathParameters getBlobPathParameters();
4852

4953
public abstract String getType();

server/src/main/java/org/opensearch/common/settings/ClusterSettings.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,6 @@
7777
import org.opensearch.cluster.routing.allocation.decider.SameShardAllocationDecider;
7878
import org.opensearch.cluster.routing.allocation.decider.ShardsLimitAllocationDecider;
7979
import org.opensearch.cluster.routing.allocation.decider.ThrottlingAllocationDecider;
80-
import org.opensearch.cluster.routing.remote.InternalRemoteRoutingTableService;
8180
import org.opensearch.cluster.service.ClusterApplierService;
8281
import org.opensearch.cluster.service.ClusterManagerService;
8382
import org.opensearch.cluster.service.ClusterManagerTaskThrottler;
@@ -107,6 +106,7 @@
107106
import org.opensearch.gateway.ShardsBatchGatewayAllocator;
108107
import org.opensearch.gateway.remote.RemoteClusterStateCleanupManager;
109108
import org.opensearch.gateway.remote.RemoteClusterStateService;
109+
import org.opensearch.gateway.remote.model.RemoteRoutingTableBlobStore;
110110
import org.opensearch.http.HttpTransportSettings;
111111
import org.opensearch.index.IndexModule;
112112
import org.opensearch.index.IndexSettings;
@@ -730,8 +730,8 @@ public void apply(Settings value, Settings current, Settings previous) {
730730
RemoteStoreNodeService.MIGRATION_DIRECTION_SETTING,
731731
IndicesService.CLUSTER_REMOTE_INDEX_RESTRICT_ASYNC_DURABILITY_SETTING,
732732
IndicesService.CLUSTER_INDEX_RESTRICT_REPLICATION_TYPE_SETTING,
733-
InternalRemoteRoutingTableService.REMOTE_ROUTING_TABLE_PATH_TYPE_SETTING,
734-
InternalRemoteRoutingTableService.REMOTE_ROUTING_TABLE_PATH_HASH_ALGO_SETTING,
733+
RemoteRoutingTableBlobStore.REMOTE_ROUTING_TABLE_PATH_TYPE_SETTING,
734+
RemoteRoutingTableBlobStore.REMOTE_ROUTING_TABLE_PATH_HASH_ALGO_SETTING,
735735

736736
// Admission Control Settings
737737
AdmissionControlSettings.ADMISSION_CONTROL_TRANSPORT_LAYER_MODE,

0 commit comments

Comments
 (0)