Skip to content

Commit

Permalink
Merge branch 'main' into auto-casting-functions
Browse files Browse the repository at this point in the history
  • Loading branch information
fang-xing-esql committed Apr 2, 2024
2 parents 21819de + 08c7b65 commit d61ef8d
Show file tree
Hide file tree
Showing 74 changed files with 663 additions and 677 deletions.
2 changes: 1 addition & 1 deletion .buildkite/pipelines/intake.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ steps:
timeout_in_minutes: 300
matrix:
setup:
BWC_VERSION: ["7.17.20", "8.13.1", "8.14.0"]
BWC_VERSION: ["7.17.20", "8.13.2", "8.14.0"]
agents:
provider: gcp
image: family/elasticsearch-ubuntu-2004
Expand Down
6 changes: 3 additions & 3 deletions .buildkite/pipelines/periodic-packaging.yml
Original file line number Diff line number Diff line change
Expand Up @@ -529,8 +529,8 @@ steps:
env:
BWC_VERSION: 8.12.2

- label: "{{matrix.image}} / 8.13.1 / packaging-tests-upgrade"
command: ./.ci/scripts/packaging-test.sh -Dbwc.checkout.align=true destructiveDistroUpgradeTest.v8.13.1
- label: "{{matrix.image}} / 8.13.2 / packaging-tests-upgrade"
command: ./.ci/scripts/packaging-test.sh -Dbwc.checkout.align=true destructiveDistroUpgradeTest.v8.13.2
timeout_in_minutes: 300
matrix:
setup:
Expand All @@ -543,7 +543,7 @@ steps:
machineType: custom-16-32768
buildDirectory: /dev/shm/bk
env:
BWC_VERSION: 8.13.1
BWC_VERSION: 8.13.2

- label: "{{matrix.image}} / 8.14.0 / packaging-tests-upgrade"
command: ./.ci/scripts/packaging-test.sh -Dbwc.checkout.align=true destructiveDistroUpgradeTest.v8.14.0
Expand Down
10 changes: 5 additions & 5 deletions .buildkite/pipelines/periodic.yml
Original file line number Diff line number Diff line change
Expand Up @@ -312,16 +312,16 @@ steps:
buildDirectory: /dev/shm/bk
env:
BWC_VERSION: 8.12.2
- label: 8.13.1 / bwc
command: .ci/scripts/run-gradle.sh -Dbwc.checkout.align=true v8.13.1#bwcTest
- label: 8.13.2 / bwc
command: .ci/scripts/run-gradle.sh -Dbwc.checkout.align=true v8.13.2#bwcTest
timeout_in_minutes: 300
agents:
provider: gcp
image: family/elasticsearch-ubuntu-2004
machineType: n1-standard-32
buildDirectory: /dev/shm/bk
env:
BWC_VERSION: 8.13.1
BWC_VERSION: 8.13.2
- label: 8.14.0 / bwc
command: .ci/scripts/run-gradle.sh -Dbwc.checkout.align=true v8.14.0#bwcTest
timeout_in_minutes: 300
Expand Down Expand Up @@ -396,7 +396,7 @@ steps:
setup:
ES_RUNTIME_JAVA:
- openjdk17
BWC_VERSION: ["7.17.20", "8.13.1", "8.14.0"]
BWC_VERSION: ["7.17.20", "8.13.2", "8.14.0"]
agents:
provider: gcp
image: family/elasticsearch-ubuntu-2004
Expand Down Expand Up @@ -438,7 +438,7 @@ steps:
- graalvm-ce17
- openjdk17
- openjdk21
BWC_VERSION: ["7.17.20", "8.13.1", "8.14.0"]
BWC_VERSION: ["7.17.20", "8.13.2", "8.14.0"]
agents:
provider: gcp
image: family/elasticsearch-ubuntu-2004
Expand Down
2 changes: 1 addition & 1 deletion .ci/bwcVersions
Original file line number Diff line number Diff line change
Expand Up @@ -30,5 +30,5 @@ BWC_VERSION:
- "8.10.4"
- "8.11.4"
- "8.12.2"
- "8.13.1"
- "8.13.2"
- "8.14.0"
2 changes: 1 addition & 1 deletion .ci/snapshotBwcVersions
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
BWC_VERSION:
- "7.17.20"
- "8.13.1"
- "8.13.2"
- "8.14.0"
5 changes: 0 additions & 5 deletions docs/changelog/106564.yaml

This file was deleted.

5 changes: 0 additions & 5 deletions docs/changelog/106602.yaml

This file was deleted.

5 changes: 0 additions & 5 deletions docs/changelog/106655.yaml

This file was deleted.

6 changes: 0 additions & 6 deletions docs/changelog/106678.yaml

This file was deleted.

7 changes: 0 additions & 7 deletions docs/changelog/106793.yaml

This file was deleted.

5 changes: 0 additions & 5 deletions docs/changelog/106799.yaml

This file was deleted.

5 changes: 0 additions & 5 deletions docs/changelog/106878.yaml

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ protected Collection<Class<? extends Plugin>> nodePlugins() {
return Set.of(KibanaPlugin.class);
}

@AwaitsFix(bugUrl = "https://github.com/elastic/elasticsearch/issues/106957")
public void testKibanaThreadPool() {
runWithBlockedThreadPools(() -> {
// index documents
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -439,6 +439,7 @@ public void testCorruptionOnNetworkLayer() throws InterruptedException {
final var maxRetries = MaxRetryAllocationDecider.SETTING_ALLOCATION_MAX_RETRY.get(Settings.EMPTY);
new ClusterStateObserver(
internalCluster().getCurrentMasterNodeInstance(ClusterService.class),
TimeValue.timeValueMillis(60000),
logger,
new ThreadContext(Settings.EMPTY)
).waitForNextChange(new ClusterStateObserver.Listener() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,7 @@ public void testNoDoubleFinalization() throws Exception {
private PlainActionFuture<Void> setWaitForClusterState(Predicate<ClusterState> predicate) {
final var clusterStateObserver = new ClusterStateObserver(
internalCluster().getCurrentMasterNodeInstance(ClusterService.class),
TimeValue.timeValueMillis(60000),
logger,
new ThreadContext(Settings.EMPTY)
);
Expand Down
1 change: 1 addition & 0 deletions server/src/main/java/org/elasticsearch/Version.java
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,7 @@ public class Version implements VersionId<Version>, ToXContentFragment {
public static final Version V_8_12_2 = new Version(8_12_02_99);
public static final Version V_8_13_0 = new Version(8_13_00_99);
public static final Version V_8_13_1 = new Version(8_13_01_99);
public static final Version V_8_13_2 = new Version(8_13_02_99);
public static final Version V_8_14_0 = new Version(8_14_00_99);
public static final Version CURRENT = V_8_14_0;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@

import org.elasticsearch.ElasticsearchException;
import org.elasticsearch.action.ActionListener;
import org.elasticsearch.action.DelegatingActionListener;
import org.elasticsearch.action.support.ActionFilters;
import org.elasticsearch.action.support.RefCountingListener;
import org.elasticsearch.action.support.SubscribableListener;
Expand Down Expand Up @@ -248,26 +247,16 @@ void getMultipleReposSnapshotInfo(ActionListener<GetSnapshotsResponse> listener)
}
})

.<SnapshotsInRepo>andThen((l, repositoryData) -> loadSnapshotInfos(repoName, repositoryData, l))
.<Void>andThen((l, repositoryData) -> loadSnapshotInfos(repoName, repositoryData, l))

.addListener(new DelegatingActionListener<>(listeners.acquire()) {
@Override
public void onResponse(SnapshotsInRepo snapshotsInRepo) {
allSnapshotInfos.add(snapshotsInRepo.snapshotInfos());
totalCount.addAndGet(snapshotsInRepo.totalCount());
delegate.onResponse(null);
}

@Override
public void onFailure(Exception e) {
if (isMultiRepoRequest && e instanceof ElasticsearchException elasticsearchException) {
failuresByRepository.put(repoName, elasticsearchException);
delegate.onResponse(null);
} else {
delegate.onFailure(e);
}
.addListener(listeners.acquire().delegateResponse((l, e) -> {
if (isMultiRepoRequest && e instanceof ElasticsearchException elasticsearchException) {
failuresByRepository.put(repoName, elasticsearchException);
l.onResponse(null);
} else {
l.onFailure(e);
}
});
}));
}
}
})
Expand All @@ -284,7 +273,7 @@ private boolean skipRepository(String repositoryName) {
}
}

private void loadSnapshotInfos(String repo, @Nullable RepositoryData repositoryData, ActionListener<SnapshotsInRepo> listener) {
private void loadSnapshotInfos(String repo, @Nullable RepositoryData repositoryData, ActionListener<Void> listener) {
assert ThreadPool.assertCurrentThreadPool(ThreadPool.Names.MANAGEMENT);

if (cancellableTask.notifyIfCancelled(listener)) {
Expand Down Expand Up @@ -322,24 +311,17 @@ private void loadSnapshotInfos(String repo, @Nullable RepositoryData repositoryD
assert fromSortValuePredicates.isMatchAll() : "filtering is not supported in non-verbose mode";
assert slmPolicyPredicate == SlmPolicyPredicate.MATCH_ALL_POLICIES : "filtering is not supported in non-verbose mode";

listener.onResponse(
buildSimpleSnapshotInfos(
toResolve,
repo,
repositoryData,
snapshotsInProgress.forRepo(repo).stream().map(entry -> SnapshotInfo.inProgress(entry).basic()).toList()
)
addSimpleSnapshotInfos(
toResolve,
repo,
repositoryData,
snapshotsInProgress.forRepo(repo).stream().map(entry -> SnapshotInfo.inProgress(entry).basic()).toList()
);
listener.onResponse(null);
}
}

/**
* Returns a list of snapshots from repository sorted by snapshot creation date
*
* @param repositoryName repository name
* @param snapshotIds snapshots for which to fetch snapshot information
*/
private void snapshots(String repositoryName, Collection<SnapshotId> snapshotIds, ActionListener<SnapshotsInRepo> listener) {
private void snapshots(String repositoryName, Collection<SnapshotId> snapshotIds, ActionListener<Void> listener) {
if (cancellableTask.notifyIfCancelled(listener)) {
return;
}
Expand Down Expand Up @@ -416,20 +398,23 @@ public void onFailure(Exception e) {
}
})

.addListener(listener.safeMap(v ->
// no need to synchronize access to snapshots: Repository#getSnapshotInfo fails fast but we're on the success path here
applyAfterPredicate(snapshots)), executor, threadPool.getThreadContext());
.addListener(listener.safeMap(v -> {
// no need to synchronize access to snapshots: Repository#getSnapshotInfo fails fast but we're on the success path here
applyAfterPredicateAndAdd(snapshots);
return null;
}), executor, threadPool.getThreadContext());
}

private SnapshotsInRepo buildSimpleSnapshotInfos(
private void addSimpleSnapshotInfos(
final Set<Snapshot> toResolve,
final String repoName,
final RepositoryData repositoryData,
final List<SnapshotInfo> currentSnapshots
) {
if (repositoryData == null) {
// only want current snapshots
return applyAfterPredicate(currentSnapshots);
applyAfterPredicateAndAdd(currentSnapshots);
return;
} // else want non-current snapshots as well, which are found in the repository data

List<SnapshotInfo> snapshotInfos = new ArrayList<>();
Expand Down Expand Up @@ -460,11 +445,12 @@ private SnapshotsInRepo buildSimpleSnapshotInfos(
)
);
}
return applyAfterPredicate(snapshotInfos);
applyAfterPredicateAndAdd(snapshotInfos);
}

private SnapshotsInRepo applyAfterPredicate(List<SnapshotInfo> snapshotInfos) {
return new SnapshotsInRepo(snapshotInfos.stream().filter(afterPredicate).toList(), snapshotInfos.size());
private void applyAfterPredicateAndAdd(List<SnapshotInfo> snapshotInfos) {
allSnapshotInfos.add(snapshotInfos.stream().filter(afterPredicate).toList());
totalCount.addAndGet(snapshotInfos.size());
}

private GetSnapshotsResponse buildResponse() {
Expand Down Expand Up @@ -672,8 +658,6 @@ private static int indexCount(SnapshotId snapshotId, RepositoryData repositoryDa
}
}

private record SnapshotsInRepo(List<SnapshotInfo> snapshotInfos, int totalCount) {}

/**
* Throttling executor for retrieving {@link SnapshotInfo} instances from the repository without spamming the SNAPSHOT_META threadpool
* and starving other users of access to it. Similar to {@link Repository#getSnapshotInfo} but allows for finer-grained control over
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
import org.elasticsearch.index.mapper.Mapper;
import org.elasticsearch.index.mapper.MapperService;
import org.elasticsearch.rest.BaseRestHandler;
import org.elasticsearch.xcontent.ConstructingObjectParser;
import org.elasticsearch.xcontent.ParseField;
import org.elasticsearch.xcontent.ToXContentFragment;
import org.elasticsearch.xcontent.ToXContentObject;
Expand Down Expand Up @@ -124,12 +123,6 @@ public record FieldMappingMetadata(String fullName, BytesReference source) imple
private static final ParseField FULL_NAME = new ParseField("full_name");
private static final ParseField MAPPING = new ParseField("mapping");

private static final ConstructingObjectParser<FieldMappingMetadata, String> PARSER = new ConstructingObjectParser<>(
"field_mapping_meta_data",
true,
a -> new FieldMappingMetadata((String) a[0], (BytesReference) a[1])
);

/**
* Returns the mappings as a map. Note that the returned map has a single key which is always the field's {@link Mapper#name}.
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,6 @@ public class ClusterStateObserver {
volatile Long startTimeMS;
volatile boolean timedOut;

public ClusterStateObserver(ClusterService clusterService, Logger logger, ThreadContext contextHolder) {
this(clusterService, new TimeValue(60000), logger, contextHolder);
}

/**
* @param timeout a global timeout for this observer. After it has expired the observer
* will fail any existing or new #waitForNextChange calls. Set to null
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
import org.elasticsearch.xcontent.ParseField;
import org.elasticsearch.xcontent.ToXContent;
import org.elasticsearch.xcontent.XContentBuilder;
import org.elasticsearch.xcontent.XContentParser;

import java.io.IOException;
import java.util.Objects;
Expand Down Expand Up @@ -66,8 +65,6 @@ public void setNode(String node) {
this.node = node;
}

public abstract Builder<T> parse(XContentParser parser) throws IOException;

public abstract T build();

protected void validate() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,7 @@ public static AllocateEmptyPrimaryAllocationCommand fromXContent(XContentParser

public static class Builder extends BasePrimaryAllocationCommand.Builder<AllocateEmptyPrimaryAllocationCommand> {

@Override
public Builder parse(XContentParser parser) throws IOException {
private Builder parse(XContentParser parser) throws IOException {
return EMPTY_PRIMARY_PARSER.parse(parser, this, null);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,7 @@ public static AllocateReplicaAllocationCommand fromXContent(XContentParser parse

protected static class Builder extends AbstractAllocateAllocationCommand.Builder<AllocateReplicaAllocationCommand> {

@Override
public Builder parse(XContentParser parser) throws IOException {
private Builder parse(XContentParser parser) throws IOException {
return REPLICA_PARSER.parse(parser, this, null);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,7 @@ public static AllocateStalePrimaryAllocationCommand fromXContent(XContentParser

public static class Builder extends BasePrimaryAllocationCommand.Builder<AllocateStalePrimaryAllocationCommand> {

@Override
public Builder parse(XContentParser parser) throws IOException {
private Builder parse(XContentParser parser) throws IOException {
return STALE_PRIMARY_PARSER.parse(parser, this, null);
}

Expand Down
Loading

0 comments on commit d61ef8d

Please sign in to comment.