Skip to content

Commit 135c472

Browse files
committed
Handle version during repository registration for prefix mode verification (#16831)
Signed-off-by: Ashish Singh <[email protected]>
1 parent aa4721a commit 135c472

File tree

3 files changed

+19
-1
lines changed

3 files changed

+19
-1
lines changed

server/src/main/java/org/opensearch/cluster/service/ClusterApplierService.java

+7
Original file line numberDiff line numberDiff line change
@@ -233,6 +233,13 @@ public ClusterState state() {
233233
return clusterState;
234234
}
235235

236+
/**
237+
* Returns true if the appliedClusterState is not null
238+
*/
239+
public boolean isStateInitialised() {
240+
return this.state.get() != null;
241+
}
242+
236243
/**
237244
* Returns true if the appliedClusterState is not null
238245
*/

server/src/main/java/org/opensearch/cluster/service/ClusterService.java

+7
Original file line numberDiff line numberDiff line change
@@ -183,6 +183,13 @@ public ClusterState state() {
183183
return clusterApplierService.state();
184184
}
185185

186+
/**
187+
* Returns true if the state in appliedClusterState is not null
188+
*/
189+
public boolean isStateInitialised() {
190+
return clusterApplierService.isStateInitialised();
191+
}
192+
186193
/**
187194
* The state that is persisted to store but may not be applied to cluster.
188195
* @return ClusterState

server/src/main/java/org/opensearch/repositories/blobstore/BlobStoreRepository.java

+5-1
Original file line numberDiff line numberDiff line change
@@ -3093,7 +3093,11 @@ public String startVerification() {
30933093
*/
30943094
private BlobContainer testContainer(String seed) {
30953095
BlobPath testBlobPath;
3096-
if (prefixModeVerification == true) {
3096+
if (prefixModeVerification == true
3097+
&& (clusterService.isStateInitialised() == false
3098+
|| clusterService.state().nodes().getMinNodeVersion().onOrAfter(Version.V_2_17_0))) {
3099+
// During the remote store node bootstrap, the cluster state is not initialised
3100+
// Otherwise, the cluster state is initialised and available with the min node version information
30973101
BasePathInput pathInput = BasePathInput.builder().basePath(basePath()).indexUUID(seed).build();
30983102
testBlobPath = PathType.HASHED_PREFIX.path(pathInput, FNV_1A_COMPOSITE_1);
30993103
} else {

0 commit comments

Comments
 (0)