|
41 | 41 | import org.elasticsearch.common.inject.Inject;
|
42 | 42 | import org.elasticsearch.common.io.stream.StreamInput;
|
43 | 43 | import org.elasticsearch.common.io.stream.StreamOutput;
|
| 44 | +import org.elasticsearch.common.logging.DeprecationLogger; |
44 | 45 | import org.elasticsearch.common.util.concurrent.ConcurrentCollections;
|
45 | 46 | import org.elasticsearch.common.util.concurrent.CountDown;
|
46 | 47 | import org.elasticsearch.index.Index;
|
|
71 | 72 | import java.util.List;
|
72 | 73 | import java.util.Map;
|
73 | 74 | import java.util.concurrent.ConcurrentMap;
|
| 75 | +import java.util.stream.StreamSupport; |
74 | 76 |
|
75 | 77 | public class SyncedFlushService implements IndexEventListener {
|
76 | 78 |
|
77 | 79 | private static final Logger logger = LogManager.getLogger(SyncedFlushService.class);
|
78 | 80 |
|
| 81 | + private static final DeprecationLogger DEPRECATION_LOGGER = new DeprecationLogger(logger); |
| 82 | + |
| 83 | + public static final String SYNCED_FLUSH_DEPRECATION_MESSAGE = |
| 84 | + "Synced flush is deprecated and will be removed in 8.0. Use flush at _/flush or /{index}/_flush instead."; |
| 85 | + |
79 | 86 | private static final String PRE_SYNCED_FLUSH_ACTION_NAME = "internal:indices/flush/synced/pre";
|
80 | 87 | private static final String SYNCED_FLUSH_ACTION_NAME = "internal:indices/flush/synced/sync";
|
81 | 88 | private static final String IN_FLIGHT_OPS_ACTION_NAME = "internal:indices/flush/synced/in_flight";
|
@@ -130,6 +137,9 @@ public void attemptSyncedFlush(final String[] aliasesOrIndices,
|
130 | 137 | IndicesOptions indicesOptions,
|
131 | 138 | final ActionListener<SyncedFlushResponse> listener) {
|
132 | 139 | final ClusterState state = clusterService.state();
|
| 140 | + if (StreamSupport.stream(state.nodes().spliterator(), false).allMatch(n -> n.getVersion().onOrAfter(Version.V_7_6_0))) { |
| 141 | + DEPRECATION_LOGGER.deprecatedAndMaybeLog("synced_flush", SYNCED_FLUSH_DEPRECATION_MESSAGE); |
| 142 | + } |
133 | 143 | final Index[] concreteIndices = indexNameExpressionResolver.concreteIndices(state, indicesOptions, aliasesOrIndices);
|
134 | 144 | final Map<String, List<ShardsSyncedFlushResult>> results = ConcurrentCollections.newConcurrentMap();
|
135 | 145 | int numberOfShards = 0;
|
|
0 commit comments