Skip to content

Commit 40d7c95

Browse files
committed
First round feedback on ClusterStatePublisher
1 parent 05c9455 commit 40d7c95

File tree

5 files changed

+11
-9
lines changed

5 files changed

+11
-9
lines changed

server/src/main/java/org/elasticsearch/discovery/ClusterStatePublisher.java renamed to server/src/main/java/org/elasticsearch/cluster/coordination/ClusterStatePublisher.java

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -16,39 +16,39 @@
1616
* specific language governing permissions and limitations
1717
* under the License.
1818
*/
19-
package org.elasticsearch.discovery;
19+
package org.elasticsearch.cluster.coordination;
2020

2121
import org.elasticsearch.action.ActionListener;
2222
import org.elasticsearch.cluster.ClusterChangedEvent;
2323
import org.elasticsearch.cluster.node.DiscoveryNode;
2424
import org.elasticsearch.common.Nullable;
2525
import org.elasticsearch.common.unit.TimeValue;
26+
import org.elasticsearch.discovery.FailedToCommitClusterStateException;
2627

2728
public interface ClusterStatePublisher {
2829
/**
2930
* Publish all the changes to the cluster from the master (can be called just by the master). The publish
3031
* process should apply this state to the master as well!
3132
*
32-
* The publishListener allows to wait for the publication to go through.
33+
* The publishListener allows to wait for the publication to complete, which can be either successful completion, timing out or failing.
34+
* The method is guaranteed to pass back a {@link FailedToCommitClusterStateException} to the publishListener if the change is not
35+
* committed and should be rejected. Any other exception signals that something bad happened but the change is committed.
3336
*
3437
* The {@link AckListener} allows to keep track of the ack received from nodes, and verify whether
3538
* they updated their own cluster state or not.
36-
*
37-
* The method is guaranteed to throw a {@link FailedToCommitClusterStateException} if the change is not committed and should be
38-
* rejected. Any other exception signals the something wrong happened but the change is committed.
3939
*/
4040
void publish(ClusterChangedEvent clusterChangedEvent, ActionListener<Void> publishListener, AckListener ackListener);
4141

4242
interface AckListener {
4343
/**
44-
* Should be called when the discovery layer has committed the clusters state (i.e. even if this publication fails,
44+
* Should be called when the cluster coordination layer has committed the cluster state (i.e. even if this publication fails,
4545
* it is guaranteed to appear in future publications).
4646
* @param commitTime the time it took to commit the cluster state
4747
*/
4848
void onCommit(TimeValue commitTime);
4949

5050
/**
51-
* Should be called whenever the discovery layer receives confirmation from a node that it has successfully applied
51+
* Should be called whenever the cluster coordination layer receives confirmation from a node that it has successfully applied
5252
* the cluster state. In case of failures, an exception should be provided as parameter.
5353
* @param node the node
5454
* @param e the optional exception

server/src/main/java/org/elasticsearch/cluster/service/MasterService.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@
4949
import org.elasticsearch.common.util.concurrent.FutureUtils;
5050
import org.elasticsearch.common.util.concurrent.PrioritizedEsThreadPoolExecutor;
5151
import org.elasticsearch.common.util.concurrent.ThreadContext;
52-
import org.elasticsearch.discovery.ClusterStatePublisher;
52+
import org.elasticsearch.cluster.coordination.ClusterStatePublisher;
5353
import org.elasticsearch.discovery.Discovery;
5454
import org.elasticsearch.discovery.FailedToCommitClusterStateException;
5555
import org.elasticsearch.threadpool.ThreadPool;

server/src/main/java/org/elasticsearch/discovery/Discovery.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919

2020
package org.elasticsearch.discovery;
2121

22+
import org.elasticsearch.cluster.coordination.ClusterStatePublisher;
2223
import org.elasticsearch.common.component.LifecycleComponent;
2324

2425
/**

server/src/main/java/org/elasticsearch/discovery/FailedToCommitClusterStateException.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
package org.elasticsearch.discovery;
2020

2121
import org.elasticsearch.ElasticsearchException;
22+
import org.elasticsearch.cluster.coordination.ClusterStatePublisher;
2223
import org.elasticsearch.common.io.stream.StreamInput;
2324

2425
import java.io.IOException;

server/src/test/java/org/elasticsearch/cluster/service/MasterServiceTests.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@
4242
import org.elasticsearch.common.unit.TimeValue;
4343
import org.elasticsearch.common.util.concurrent.BaseFuture;
4444
import org.elasticsearch.common.util.concurrent.ThreadContext;
45-
import org.elasticsearch.discovery.ClusterStatePublisher;
45+
import org.elasticsearch.cluster.coordination.ClusterStatePublisher;
4646
import org.elasticsearch.discovery.FailedToCommitClusterStateException;
4747
import org.elasticsearch.test.ESTestCase;
4848
import org.elasticsearch.test.MockLogAppender;

0 commit comments

Comments
 (0)