Skip to content

Commit 4a20dca

Browse files
committed
Required changes after merging in master.
1 parent 56472d6 commit 4a20dca

File tree

5 files changed

+8
-4
lines changed

5 files changed

+8
-4
lines changed

server/src/main/java/org/elasticsearch/persistent/AllocatedPersistentTask.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ public void waitForPersistentTask(final Predicate<PersistentTasksCustomMetaData.
115115
persistentTasksService.waitForPersistentTaskCondition(persistentTaskId, predicate, timeout, listener);
116116
}
117117

118-
final boolean isCompleted() {
118+
protected final boolean isCompleted() {
119119
return state.get() == State.COMPLETED;
120120
}
121121

x-pack/plugin/ccr/src/main/java/org/elasticsearch/xpack/ccr/action/FollowIndexAction.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -238,7 +238,7 @@ void start(Request request, String clusterNameAlias, IndexMetaData leaderIndexMe
238238
new ShardId(followIndexMetadata.getIndex(), shardId),
239239
new ShardId(leaderIndexMetadata.getIndex(), shardId),
240240
request.batchSize, request.concurrentProcessors, request.processorMaxTranslogBytes, filteredHeaders);
241-
persistentTasksService.startPersistentTask(taskId, ShardFollowTask.NAME, shardFollowTask,
241+
persistentTasksService.sendStartRequest(taskId, ShardFollowTask.NAME, shardFollowTask,
242242
new ActionListener<PersistentTasksCustomMetaData.PersistentTask<ShardFollowTask>>() {
243243
@Override
244244
public void onResponse(PersistentTasksCustomMetaData.PersistentTask<ShardFollowTask> task) {

x-pack/plugin/ccr/src/main/java/org/elasticsearch/xpack/ccr/action/ShardFollowNodeTask.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,10 @@ protected void onCancelled() {
3434
markAsCompleted();
3535
}
3636

37+
public boolean isRunning() {
38+
return isCancelled() == false && isCompleted() == false;
39+
}
40+
3741
void updateProcessedGlobalCheckpoint(long processedGlobalCheckpoint) {
3842
this.processedGlobalCheckpoint.set(processedGlobalCheckpoint);
3943
}

x-pack/plugin/ccr/src/main/java/org/elasticsearch/xpack/ccr/action/ShardFollowTasksExecutor.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ protected void nodeOperation(AllocatedPersistentTask task, ShardFollowTask param
130130
void prepare(Client leaderClient, Client followerClient, ShardFollowNodeTask task, ShardFollowTask params,
131131
long followGlobalCheckPoint,
132132
IndexMetadataVersionChecker imdVersionChecker) {
133-
if (task.getState() != AllocatedPersistentTask.State.STARTED) {
133+
if (task.isRunning() == false) {
134134
// TODO: need better cancellation control
135135
return;
136136
}

x-pack/plugin/ccr/src/main/java/org/elasticsearch/xpack/ccr/action/UnfollowIndexAction.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ protected void doExecute(Request request, ActionListener<Response> listener) {
141141
for (int i = 0; i < numShards; i++) {
142142
final int shardId = i;
143143
String taskId = followIndexMetadata.getIndexUUID() + "-" + shardId;
144-
persistentTasksService.cancelPersistentTask(taskId,
144+
persistentTasksService.sendRemoveRequest(taskId,
145145
new ActionListener<PersistentTasksCustomMetaData.PersistentTask<?>>() {
146146
@Override
147147
public void onResponse(PersistentTasksCustomMetaData.PersistentTask<?> task) {

0 commit comments

Comments
 (0)