Skip to content

Commit 8f1f4c8

Browse files
committed
fixup! Remove security migrations improvement
1 parent 371a2c1 commit 8f1f4c8

File tree

1 file changed

+7
-31
lines changed

1 file changed

+7
-31
lines changed

x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/support/SecurityMigrationExecutor.java

Lines changed: 7 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,6 @@
1010
import org.apache.logging.log4j.LogManager;
1111
import org.apache.logging.log4j.Logger;
1212
import org.elasticsearch.action.ActionListener;
13-
import org.elasticsearch.action.admin.indices.refresh.RefreshAction;
14-
import org.elasticsearch.action.admin.indices.refresh.RefreshRequest;
1513
import org.elasticsearch.action.support.ThreadedActionListener;
1614
import org.elasticsearch.client.internal.Client;
1715
import org.elasticsearch.core.TimeValue;
@@ -26,9 +24,6 @@
2624
import java.util.TreeMap;
2725
import java.util.concurrent.Executor;
2826

29-
import static org.elasticsearch.xpack.core.ClientHelper.SECURITY_ORIGIN;
30-
import static org.elasticsearch.xpack.core.ClientHelper.executeAsyncWithOrigin;
31-
3227
public class SecurityMigrationExecutor extends PersistentTasksExecutor<SecurityMigrationTaskParams> {
3328

3429
private static final Logger logger = LogManager.getLogger(SecurityMigrationExecutor.class);
@@ -88,17 +83,13 @@ private void applyOutstandingMigrations(AllocatedPersistentTask task, int curren
8883
response -> updateMigrationVersion(
8984
migrationEntry.getKey(),
9085
securityIndexManager.getConcreteIndexName(),
91-
new ThreadedActionListener<>(this.getExecutor(), ActionListener.wrap(updateResponse -> {
92-
refreshSecurityIndex(
93-
new ThreadedActionListener<>(
94-
this.getExecutor(),
95-
ActionListener.wrap(
96-
refreshResponse -> applyOutstandingMigrations(task, migrationEntry.getKey(), listener),
97-
listener::onFailure
98-
)
99-
)
100-
);
101-
}, listener::onFailure))
86+
new ThreadedActionListener<>(
87+
this.getExecutor(),
88+
ActionListener.wrap(
89+
updateResponse -> applyOutstandingMigrations(task, migrationEntry.getKey(), listener),
90+
listener::onFailure
91+
)
92+
)
10293
),
10394
listener::onFailure
10495
)
@@ -109,21 +100,6 @@ private void applyOutstandingMigrations(AllocatedPersistentTask task, int curren
109100
}
110101
}
111102

112-
/**
113-
* Refresh security index to make sure that docs that were migrated are visible to the next migration and to prevent version conflicts
114-
* or unexpected behaviour by APIs relying on migrated docs.
115-
*/
116-
private void refreshSecurityIndex(ActionListener<Void> listener) {
117-
RefreshRequest refreshRequest = new RefreshRequest(securityIndexManager.getConcreteIndexName());
118-
executeAsyncWithOrigin(
119-
client,
120-
SECURITY_ORIGIN,
121-
RefreshAction.INSTANCE,
122-
refreshRequest,
123-
ActionListener.wrap(response -> listener.onResponse(null), listener::onFailure)
124-
);
125-
}
126-
127103
private void updateMigrationVersion(int migrationVersion, String indexName, ActionListener<Void> listener) {
128104
client.execute(
129105
UpdateIndexMigrationVersionAction.INSTANCE,

0 commit comments

Comments
 (0)