Skip to content

Commit 7695a32

Browse files
committed
Revert "Adding re-writing of PIT id"
This reverts commit 68280cf.
1 parent 0b804c5 commit 7695a32

File tree

6 files changed

+11
-11
lines changed

6 files changed

+11
-11
lines changed

server/src/main/java/org/elasticsearch/action/search/AbstractSearchAsyncAction.java

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313
import org.apache.lucene.util.SetOnce;
1414
import org.elasticsearch.ElasticsearchException;
1515
import org.elasticsearch.ExceptionsHelper;
16-
import org.elasticsearch.TransportVersion;
1716
import org.elasticsearch.action.ActionListener;
1817
import org.elasticsearch.action.NoShardAvailableActionException;
1918
import org.elasticsearch.action.OriginalIndices;
@@ -94,7 +93,6 @@ abstract class AbstractSearchAsyncAction<Result extends SearchPhaseResult> exten
9493
private final Map<String, PendingExecutions> pendingExecutionsPerNode;
9594
private final AtomicBoolean requestCancelled = new AtomicBoolean();
9695
private final int skippedCount;
97-
private final TransportVersion clusterMinTransportVersion;
9896

9997
// protected for tests
10098
protected final SubscribableListener<Void> doneFuture = new SubscribableListener<>();
@@ -151,7 +149,6 @@ abstract class AbstractSearchAsyncAction<Result extends SearchPhaseResult> exten
151149
this.nodeIdToConnection = nodeIdToConnection;
152150
this.concreteIndexBoosts = concreteIndexBoosts;
153151
this.clusterStateVersion = clusterState.version();
154-
this.clusterMinTransportVersion = clusterState.getMinTransportVersion();
155152
this.aliasFilter = aliasFilter;
156153
this.results = resultConsumer;
157154
// register the release of the query consumer to free up the circuit breaker memory
@@ -612,7 +609,7 @@ public void sendSearchResponse(SearchResponseSections internalSearchResponse, At
612609
protected BytesReference buildSearchContextId(ShardSearchFailure[] failures) {
613610
var source = request.source();
614611
return source != null && source.pointInTimeBuilder() != null && source.pointInTimeBuilder().singleSession() == false
615-
? SearchContextId.encode(results.getAtomicArray().asList(), aliasFilter, clusterMinTransportVersion, failures)
612+
? source.pointInTimeBuilder().getEncodedId()
616613
: null;
617614
}
618615

server/src/main/java/org/elasticsearch/action/search/PITHelper.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222

2323
public class PITHelper {
2424

25-
public static SearchContextId decodePITId(String id) throws IOException {
25+
public static SearchContextId decodePITId(String id) {
2626
return decodePITId(new BytesArray(Base64.getUrlDecoder().decode(id)));
2727
}
2828

server/src/main/java/org/elasticsearch/action/search/SearchContextId.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ public final class SearchContextId {
4040
private final Map<String, AliasFilter> aliasFilter;
4141
private final transient Set<ShardSearchContextId> contextIds;
4242

43-
public SearchContextId(Map<ShardId, SearchContextIdForNode> shards, Map<String, AliasFilter> aliasFilter) {
43+
SearchContextId(Map<ShardId, SearchContextIdForNode> shards, Map<String, AliasFilter> aliasFilter) {
4444
this.shards = shards;
4545
this.aliasFilter = aliasFilter;
4646
this.contextIds = shards.values().stream().map(SearchContextIdForNode::getSearchContextId).collect(Collectors.toSet());
@@ -58,8 +58,8 @@ public boolean contains(ShardSearchContextId contextId) {
5858
return contextIds.contains(contextId);
5959
}
6060

61-
public static <SPR extends SearchPhaseResult> BytesReference encode(
62-
List<SPR> searchPhaseResults,
61+
public static BytesReference encode(
62+
List<SearchPhaseResult> searchPhaseResults,
6363
Map<String, AliasFilter> aliasFilter,
6464
TransportVersion version,
6565
ShardSearchFailure[] shardFailures

server/src/main/java/org/elasticsearch/action/search/SearchContextIdForNode.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ public final class SearchContextIdForNode implements Writeable {
3131
* @param node The target node where the search context ID is defined, or {@code null} if the shard is missing or unavailable.
3232
* @param searchContextId The {@link ShardSearchContextId}, or {@code null} if the shard is missing or unavailable.
3333
*/
34-
public SearchContextIdForNode(@Nullable String clusterAlias, @Nullable String node, @Nullable ShardSearchContextId searchContextId) {
34+
SearchContextIdForNode(@Nullable String clusterAlias, @Nullable String node, @Nullable ShardSearchContextId searchContextId) {
3535
this.node = node;
3636
this.clusterAlias = clusterAlias;
3737
this.searchContextId = searchContextId;

server/src/main/java/org/elasticsearch/action/search/TransportSearchAction.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1233,7 +1233,8 @@ static List<SearchShardIterator> getRemoteShardsIteratorFromPointInTime(
12331233
// Otherwise, we add the shard iterator without a target node, allowing a partial search failure to
12341234
// be thrown when a search phase attempts to access it.
12351235
targetNodes.add(perNode.getNode());
1236-
// TODO we will need to adapt something here as well I think
1236+
// TODO this looks like its on the cross-cluster search path, we will need to adapt the retry mechanism here as well I
1237+
// think
12371238
if (perNode.getSearchContextId().getSearcherId() != null) {
12381239
for (String node : group.allocatedNodes()) {
12391240
if (node.equals(perNode.getNode()) == false) {

server/src/main/java/org/elasticsearch/search/SearchService.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1259,7 +1259,9 @@ final ReaderContext createOrGetReaderContext(ShardSearchRequest request) {
12591259
if (searcherId == null) {
12601260
throw e;
12611261
}
1262-
// TODO this retries on context with same searcher id, currently offered in FrozenEngine and ReadonlyEngine
1262+
// TODO here we retry creating contexts on the same node if we can get a Searchwe with same searcher id as the original
1263+
// PIT context. That seems to currently only be working for FrozenEngine and ReadonlyEngine where the commitId is used
1264+
// as a searcher id
12631265
final IndexService indexService = indicesService.indexServiceSafe(request.shardId().getIndex());
12641266
final IndexShard shard = indexService.getShard(request.shardId().id());
12651267
final Engine.SearcherSupplier searcherSupplier = shard.acquireSearcherSupplier();

0 commit comments

Comments
 (0)