@@ -147,16 +147,16 @@ public void registerRepository(final PutRepositoryRequest request, final ActionL
147
147
}
148
148
149
149
final StepListener <AcknowledgedResponse > acknowledgementStep = new StepListener <>();
150
- final StepListener <Void > publicationStep = new StepListener <>();
150
+ final StepListener <Boolean > publicationStep = new StepListener <>(); // Boolean==changed.
151
151
152
152
if (request .verify ()) {
153
153
154
154
// When publication has completed (and all acks received or timed out) then verify the repository.
155
155
// (if acks timed out then acknowledgementStep completes before the master processes this cluster state, hence why we have
156
156
// to wait for the publication to be complete too)
157
157
final StepListener <List <DiscoveryNode >> verifyStep = new StepListener <>();
158
- publicationStep .whenComplete (ignored -> acknowledgementStep .whenComplete (clusterStateUpdateResponse -> {
159
- if (clusterStateUpdateResponse .isAcknowledged ()) {
158
+ publicationStep .whenComplete (changed -> acknowledgementStep .whenComplete (clusterStateUpdateResponse -> {
159
+ if (clusterStateUpdateResponse .isAcknowledged () && changed ) {
160
160
// The response was acknowledged - all nodes should know about the new repository, let's verify them
161
161
verifyRepository (request .name (), verifyStep );
162
162
} else {
@@ -201,10 +201,6 @@ public ClusterState execute(ClusterState currentState) {
201
201
List <RepositoryMetadata > repositoriesMetadata = new ArrayList <>(repositories .repositories ().size () + 1 );
202
202
for (RepositoryMetadata repositoryMetadata : repositories .repositories ()) {
203
203
if (repositoryMetadata .name ().equals (newRepositoryMetadata .name ())) {
204
- if (newRepositoryMetadata .equalsIgnoreGenerations (repositoryMetadata )) {
205
- // Previous version is the same as this one no update is needed.
206
- return currentState ;
207
- }
208
204
Repository existing = RepositoriesService .this .repositories .get (request .name ());
209
205
if (existing == null ) {
210
206
existing = RepositoriesService .this .internalRepositories .get (request .name ());
@@ -213,6 +209,10 @@ public ClusterState execute(ClusterState currentState) {
213
209
assert existing .getMetadata () == repositoryMetadata ;
214
210
final RepositoryMetadata updatedMetadata ;
215
211
if (canUpdateInPlace (newRepositoryMetadata , existing )) {
212
+ if (repositoryMetadata .settings ().equals (newRepositoryMetadata .settings ())) {
213
+ // Previous version is the same as this one no update is needed.
214
+ return currentState ;
215
+ }
216
216
// we're updating in place so the updated metadata must point at the same uuid and generations
217
217
updatedMetadata = repositoryMetadata .withSettings (newRepositoryMetadata .settings ());
218
218
} else {
@@ -256,7 +256,7 @@ public void clusterStateProcessed(String source, ClusterState oldState, ClusterS
256
256
logger .info ("put repository [{}]" , request .name ());
257
257
}
258
258
}
259
- publicationStep .onResponse (null );
259
+ publicationStep .onResponse (oldState != newState );
260
260
}
261
261
}
262
262
);
0 commit comments