Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/main' into carlosdelest/semantic…
Browse files Browse the repository at this point in the history
…-text-new-ingestion-inference

# Conflicts:
#	server/src/main/java/org/elasticsearch/action/bulk/BulkOperation.java
#	x-pack/plugin/inference/qa/test-service-plugin/src/main/java/org/elasticsearch/xpack/inference/mock/TestDenseInferenceServiceExtension.java
#	x-pack/plugin/inference/src/main/java/org/elasticsearch/xpack/inference/InferencePlugin.java
#	x-pack/plugin/inference/src/yamlRestTest/resources/rest-api-spec/test/inference/30_semantic_text_inference.yml
  • Loading branch information
carlosdelest committed May 13, 2024
2 parents 3cbaea4 + 56c2835 commit 199d4ba
Show file tree
Hide file tree
Showing 678 changed files with 21,571 additions and 6,177 deletions.
2 changes: 1 addition & 1 deletion .buildkite/pipelines/intake.yml
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ steps:
timeout_in_minutes: 300
matrix:
setup:
BWC_VERSION: ["7.17.22", "8.13.4", "8.14.0", "8.15.0"]
BWC_VERSION: ["7.17.22", "8.13.5", "8.14.0", "8.15.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.4 / packaging-tests-upgrade"
command: ./.ci/scripts/packaging-test.sh -Dbwc.checkout.align=true destructiveDistroUpgradeTest.v8.13.4
- label: "{{matrix.image}} / 8.13.5 / packaging-tests-upgrade"
command: ./.ci/scripts/packaging-test.sh -Dbwc.checkout.align=true destructiveDistroUpgradeTest.v8.13.5
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.4
BWC_VERSION: 8.13.5

- 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 @@ -591,8 +591,8 @@ steps:
- signal_reason: agent_stop
limit: 3

- label: 8.13.4 / bwc
command: .ci/scripts/run-gradle.sh -Dbwc.checkout.align=true v8.13.4#bwcTest
- label: 8.13.5 / bwc
command: .ci/scripts/run-gradle.sh -Dbwc.checkout.align=true v8.13.5#bwcTest
timeout_in_minutes: 300
agents:
provider: gcp
Expand All @@ -601,7 +601,7 @@ steps:
buildDirectory: /dev/shm/bk
preemptible: true
env:
BWC_VERSION: 8.13.4
BWC_VERSION: 8.13.5
retry:
automatic:
- exit_status: "-1"
Expand Down Expand Up @@ -714,7 +714,7 @@ steps:
setup:
ES_RUNTIME_JAVA:
- openjdk17
BWC_VERSION: ["7.17.22", "8.13.4", "8.14.0", "8.15.0"]
BWC_VERSION: ["7.17.22", "8.13.5", "8.14.0", "8.15.0"]
agents:
provider: gcp
image: family/elasticsearch-ubuntu-2004
Expand Down Expand Up @@ -760,7 +760,7 @@ steps:
- openjdk17
- openjdk21
- openjdk22
BWC_VERSION: ["7.17.22", "8.13.4", "8.14.0", "8.15.0"]
BWC_VERSION: ["7.17.22", "8.13.5", "8.14.0", "8.15.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,6 +30,6 @@ BWC_VERSION:
- "8.10.4"
- "8.11.4"
- "8.12.2"
- "8.13.4"
- "8.13.5"
- "8.14.0"
- "8.15.0"
2 changes: 1 addition & 1 deletion .ci/snapshotBwcVersions
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
BWC_VERSION:
- "7.17.22"
- "8.13.4"
- "8.13.5"
- "8.14.0"
- "8.15.0"
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ static Thread createShutdownHook(Terminal terminal, Closeable closeable) {
try {
closeable.close();
} catch (final IOException e) {
e.printStackTrace(terminal.getErrorWriter());
terminal.errorPrintln(e);
}
terminal.flush(); // make sure to flush whatever the close or error might have written
}, "elasticsearch-cli-shutdown");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,14 @@
package org.elasticsearch.server.cli;

import org.elasticsearch.bootstrap.BootstrapInfo;
import org.elasticsearch.cli.Terminal;
import org.elasticsearch.cli.Terminal.Verbosity;

import java.io.BufferedReader;
import java.io.Closeable;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.nio.charset.StandardCharsets;
import java.util.List;
import java.util.concurrent.CountDownLatch;
Expand All @@ -29,9 +31,9 @@
* {@link BootstrapInfo#SERVER_READY_MARKER} signals the server is ready and the cli may
* detach if daemonizing. All other messages are passed through to stderr.
*/
class ErrorPumpThread extends Thread {
class ErrorPumpThread extends Thread implements Closeable {
private final BufferedReader reader;
private final PrintWriter writer;
private final Terminal terminal;

// a latch which changes state when the server is ready or has had a bootstrap error
private final CountDownLatch readyOrDead = new CountDownLatch(1);
Expand All @@ -42,10 +44,24 @@ class ErrorPumpThread extends Thread {
// an unexpected io failure that occurred while pumping stderr
private volatile IOException ioFailure;

ErrorPumpThread(PrintWriter errOutput, InputStream errInput) {
ErrorPumpThread(Terminal terminal, InputStream errInput) {
super("server-cli[stderr_pump]");
this.reader = new BufferedReader(new InputStreamReader(errInput, StandardCharsets.UTF_8));
this.writer = errOutput;
this.terminal = terminal;
}

private void checkForIoFailure() throws IOException {
IOException failure = ioFailure;
ioFailure = null;
if (failure != null) {
throw failure;
}
}

@Override
public void close() throws IOException {
assert isAlive() == false : "Pump thread must be drained first";
checkForIoFailure();
}

/**
Expand All @@ -56,9 +72,7 @@ class ErrorPumpThread extends Thread {
*/
boolean waitUntilReady() throws IOException {
nonInterruptibleVoid(readyOrDead::await);
if (ioFailure != null) {
throw ioFailure;
}
checkForIoFailure();
return ready;
}

Expand All @@ -81,13 +95,13 @@ public void run() {
ready = true;
readyOrDead.countDown();
} else if (filter.contains(line) == false) {
writer.println(line);
terminal.errorPrintln(Verbosity.SILENT, line, false);
}
}
} catch (IOException e) {
ioFailure = e;
} finally {
writer.flush();
terminal.flush();
readyOrDead.countDown();
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ class KeystorePasswordTerminal extends Terminal implements Closeable {
private final SecureString password;

KeystorePasswordTerminal(Terminal delegate, SecureString password) {
super(delegate.getReader(), delegate.getWriter(), delegate.getErrorWriter());
super(delegate);
this.delegate = delegate;
this.password = password;
setVerbosity(delegate.getVerbosity());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
import org.elasticsearch.env.Environment;
import org.elasticsearch.monitor.jvm.JvmInfo;

import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Path;
import java.util.Arrays;
Expand Down Expand Up @@ -231,7 +232,7 @@ private ServerArgs createArgs(OptionSet options, Environment env, SecureSettings
}

@Override
public void close() {
public void close() throws IOException {
if (server != null) {
server.stop();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,16 +61,21 @@ public long pid() {
*/
public synchronized void detach() throws IOException {
errorPump.drain();
IOUtils.close(jvmProcess.getOutputStream(), jvmProcess.getInputStream(), jvmProcess.getErrorStream());
detached = true;
try {
IOUtils.close(jvmProcess.getOutputStream(), jvmProcess.getInputStream(), jvmProcess.getErrorStream(), errorPump);
} finally {
detached = true;
}
}

/**
* Waits for the subprocess to exit.
*/
public int waitFor() {
public int waitFor() throws IOException {
errorPump.drain();
return nonInterruptible(jvmProcess::waitFor);
int exitCode = nonInterruptible(jvmProcess::waitFor);
errorPump.close();
return exitCode;
}

/**
Expand All @@ -81,7 +86,7 @@ public int waitFor() {
*
* <p> Note that if {@link #detach()} has been called, this method is a no-op.
*/
public synchronized void stop() {
public synchronized void stop() throws IOException {
if (detached) {
return;
}
Expand All @@ -93,7 +98,7 @@ public synchronized void stop() {
/**
* Stop the subprocess, sending a SIGKILL.
*/
public void forceStop() {
public void forceStop() throws IOException {
assert detached == false;
jvmProcess.destroyForcibly();
waitFor();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ ServerProcess start(ProcessStarter processStarter) throws UserException {
boolean success = false;
try {
jvmProcess = createProcess(getCommand(), getJvmArgs(), jvmOptions, getEnvironment(), processStarter);
errorPump = new ErrorPumpThread(terminal.getErrorWriter(), jvmProcess.getErrorStream());
errorPump = new ErrorPumpThread(terminal, jvmProcess.getErrorStream());
errorPump.start();
sendArgs(serverArgs, jvmProcess.getOutputStream());

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Path;
import java.util.List;
import java.util.Locale;
import java.util.Optional;
import java.util.concurrent.atomic.AtomicBoolean;
Expand All @@ -43,8 +44,11 @@
import static org.hamcrest.CoreMatchers.equalTo;
import static org.hamcrest.Matchers.allOf;
import static org.hamcrest.Matchers.emptyString;
import static org.hamcrest.Matchers.greaterThan;
import static org.hamcrest.Matchers.hasItem;
import static org.hamcrest.Matchers.hasSize;
import static org.hamcrest.Matchers.is;
import static org.hamcrest.Matchers.matchesRegex;
import static org.hamcrest.Matchers.not;

public class ServerCliTests extends CommandTestCase {
Expand Down Expand Up @@ -321,11 +325,16 @@ protected ServerProcess startServer(Terminal terminal, ProcessInfo processInfo,
throw new InterruptedException("interrupted while get jvm options");
}
};
var e = expectThrows(
InterruptedException.class,
() -> command.main(new String[0], terminal, new ProcessInfo(sysprops, envVars, esHomeDir))
);
assertThat(e.getMessage(), equalTo("interrupted while get jvm options"));

int exitCode = command.main(new String[0], terminal, new ProcessInfo(sysprops, envVars, esHomeDir));
assertThat(exitCode, is(ExitCodes.CODE_ERROR));

String[] lines = terminal.getErrorOutput().split(System.lineSeparator());
assertThat(List.of(lines), hasSize(greaterThan(10))); // at least decent sized stacktrace
assertThat(lines[0], is("java.lang.InterruptedException: interrupted while get jvm options"));
assertThat(lines[1], matchesRegex("\\tat org.elasticsearch.server.cli.ServerCliTests.+startServer\\(ServerCliTests.java:\\d+\\)"));
assertThat(lines[lines.length - 1], matchesRegex("\tat java.base/java.lang.Thread.run\\(Thread.java:\\d+\\)"));

command.close();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
import java.util.List;
import java.util.Map;
import java.util.concurrent.CancellationException;
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.ExecutorService;
Expand Down Expand Up @@ -393,15 +394,24 @@ public void testWaitFor() throws Exception {
stderr.println("final message");
};
var server = startProcess(false, false);

CompletableFuture<Void> stopping = new CompletableFuture<>();
new Thread(() -> {
// simulate stop run as shutdown hook in another thread, eg from Ctrl-C
nonInterruptibleVoid(mainReady::await);
server.stop();
try {
// simulate stop run as shutdown hook in another thread, eg from Ctrl-C
nonInterruptibleVoid(mainReady::await);
server.stop();
stopping.complete(null);
} catch (Throwable e) {
stopping.completeExceptionally(e);
}
}).start();
int exitCode = server.waitFor();
assertThat(process.main.isDone(), is(true));
assertThat(exitCode, equalTo(0));
assertThat(terminal.getErrorOutput(), containsString("final message"));
// rethrow any potential exception observed while stopping
stopping.get();
}

public void testProcessDies() throws Exception {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@
import org.elasticsearch.server.cli.ServerProcessBuilder;
import org.elasticsearch.server.cli.ServerProcessUtils;

import java.io.IOException;

/**
* Starts an Elasticsearch process, but does not wait for it to exit.
* <p>
Expand Down Expand Up @@ -55,7 +57,7 @@ public void execute(Terminal terminal, OptionSet options, Environment env, Proce
}

@Override
public void close() {
public void close() throws IOException {
if (server != null) {
server.stop();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@
import static org.hamcrest.Matchers.containsString;
import static org.hamcrest.Matchers.emptyString;
import static org.hamcrest.Matchers.equalTo;
import static org.hamcrest.Matchers.is;
import static org.hamcrest.Matchers.startsWith;

public class ProcrunCommandTests extends WindowsServiceCliTestCase {

Expand Down Expand Up @@ -111,8 +113,10 @@ protected String getDefaultFailureMessage() {

public void testMissingExe() throws Exception {
Files.delete(serviceExe);
var e = expectThrows(IllegalStateException.class, () -> executeMain("install"));
assertThat(e.getMessage(), containsString("Missing procrun exe"));
int exitCode = executeMain("install");

assertThat(exitCode, is(ExitCodes.CODE_ERROR));
assertThat(terminal.getErrorOutput(), startsWith("java.lang.IllegalStateException: Missing procrun exe"));
}

public void testServiceId() throws Exception {
Expand Down
5 changes: 5 additions & 0 deletions docs/changelog/106820.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
pr: 106820
summary: Add a capabilities API to check node and cluster capabilities
area: Infra/REST API
type: feature
issues: []
5 changes: 5 additions & 0 deletions docs/changelog/107088.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
pr: 107088
summary: Introduce role description field
area: Authorization
type: enhancement
issues: []
5 changes: 5 additions & 0 deletions docs/changelog/107876.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
pr: 107876
summary: "ESQL: Add aggregates node level reduction"
area: ES|QL
type: enhancement
issues: []
5 changes: 0 additions & 5 deletions docs/changelog/107886.yaml

This file was deleted.

Loading

0 comments on commit 199d4ba

Please sign in to comment.