5050public class RemoteStatePublicationIT extends RemoteStoreBaseIntegTestCase {
5151
5252 private static String INDEX_NAME = "test-index" ;
53+ private boolean isRemoteStateEnabled = true ;
54+ private String isRemotePublicationEnabled = "true" ;
5355
5456 @ Before
5557 public void setup () {
5658 asyncUploadMockFsRepo = false ;
59+ isRemoteStateEnabled = true ;
60+ isRemotePublicationEnabled = "true" ;
5761 }
5862
5963 @ Override
6064 protected Settings featureFlagSettings () {
61- return Settings .builder ().put (super .featureFlagSettings ()).put (FeatureFlags .REMOTE_PUBLICATION_EXPERIMENTAL , "true" ).build ();
65+ return Settings .builder ()
66+ .put (super .featureFlagSettings ())
67+ .put (FeatureFlags .REMOTE_PUBLICATION_EXPERIMENTAL , isRemotePublicationEnabled )
68+ .build ();
6269 }
6370
6471 @ Override
@@ -76,7 +83,7 @@ protected Settings nodeSettings(int nodeOrdinal) {
7683 );
7784 return Settings .builder ()
7885 .put (super .nodeSettings (nodeOrdinal ))
79- .put (REMOTE_CLUSTER_STATE_ENABLED_SETTING .getKey (), true )
86+ .put (REMOTE_CLUSTER_STATE_ENABLED_SETTING .getKey (), isRemoteStateEnabled )
8087 .put ("node.attr." + REMOTE_STORE_ROUTING_TABLE_REPOSITORY_NAME_ATTRIBUTE_KEY , routingTableRepoName )
8188 .put (routingTableRepoTypeAttributeKey , ReloadableFsRepository .TYPE )
8289 .put (routingTableRepoSettingsAttributeKeyPrefix + "location" , segmentRepoPath )
@@ -136,6 +143,18 @@ public void testPublication() throws Exception {
136143 }
137144 }
138145
146+ public void testRemotePublicationDisableIfRemoteStateDisabled () {
147+ // only disable remote state
148+ isRemoteStateEnabled = false ;
149+ // create cluster with multi node with in-consistent settings
150+ prepareCluster (3 , 2 , INDEX_NAME , 1 , 2 );
151+ // assert cluster is stable, ensuring publication falls back to legacy transport with inconsistent settings
152+ ensureStableCluster (5 );
153+ ensureGreen (INDEX_NAME );
154+
155+ assertNull (internalCluster ().getCurrentClusterManagerNodeInstance (RemoteClusterStateService .class ));
156+ }
157+
139158 private Map <String , Integer > getMetadataFiles (BlobStoreRepository repository , String subDirectory ) throws IOException {
140159 BlobPath metadataPath = repository .basePath ()
141160 .add (
@@ -151,5 +170,4 @@ private Map<String, Integer> getMetadataFiles(BlobStoreRepository repository, St
151170 return fileName .split (DELIMITER )[0 ];
152171 }).collect (Collectors .toMap (Function .identity (), key -> 1 , Integer ::sum ));
153172 }
154-
155173}
0 commit comments