Skip to content

Commit

Permalink
Merge branch 'main' into multi-project/fix/transport-version-test
Browse files Browse the repository at this point in the history
  • Loading branch information
tvernum authored Feb 27, 2025
2 parents a0efa78 + 2c0fb18 commit 696b767
Show file tree
Hide file tree
Showing 6 changed files with 71 additions and 50 deletions.
21 changes: 0 additions & 21 deletions .github/workflows/comment-on-asciidoc-changes.yml

This file was deleted.

19 changes: 19 additions & 0 deletions .github/workflows/docs-build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
name: docs-build

on:
push:
branches:
- main
pull_request_target: ~
merge_group: ~

jobs:
docs-preview:
uses: elastic/docs-builder/.github/workflows/preview-build.yml@main
with:
path-pattern: docs/**
permissions:
deployments: write
id-token: write
contents: read
pull-requests: read
14 changes: 14 additions & 0 deletions .github/workflows/docs-cleanup.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
name: docs-cleanup

on:
pull_request_target:
types:
- closed

jobs:
docs-preview:
uses: elastic/docs-builder/.github/workflows/preview-cleanup.yml@main
permissions:
contents: none
id-token: write
deployments: write
53 changes: 35 additions & 18 deletions libs/core/src/main/java/org/elasticsearch/core/Releasables.java
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@

package org.elasticsearch.core;

import java.io.IOException;
import java.io.UncheckedIOException;
import java.util.Arrays;
import java.util.Iterator;
import java.util.concurrent.atomic.AtomicReference;
Expand All @@ -21,11 +19,17 @@ public enum Releasables {

/** Release the provided {@link Releasable}s. */
public static void close(Iterable<? extends Releasable> releasables) {
try {
// this does the right thing with respect to add suppressed and not wrapping errors etc.
IOUtils.close(releasables);
} catch (IOException e) {
throw new UncheckedIOException(e);
RuntimeException firstException = null;
for (final Releasable releasable : releasables) {
try {
close(releasable);
} catch (RuntimeException e) {
firstException = useOrSuppress(firstException, e);
}
}

if (firstException != null) {
throw firstException;
}
}

Expand All @@ -38,7 +42,18 @@ public static void close(@Nullable Releasable releasable) {

/** Release the provided {@link Releasable}s. */
public static void close(Releasable... releasables) {
close(true, releasables);
RuntimeException firstException = null;
for (final Releasable releasable : releasables) {
try {
close(releasable);
} catch (RuntimeException e) {
firstException = useOrSuppress(firstException, e);
}
}

if (firstException != null) {
throw firstException;
}
}

/** Release the provided {@link Releasable}s expecting no exception to by thrown by any of them. */
Expand All @@ -63,19 +78,21 @@ public static void closeExpectNoException(Releasable releasable) {

/** Release the provided {@link Releasable}s, ignoring exceptions. */
public static void closeWhileHandlingException(Releasable... releasables) {
close(false, releasables);
for (final Releasable releasable : releasables) {
try {
close(releasable);
} catch (RuntimeException e) {
// ignored
}
}
}

/** Release the provided {@link Releasable}s, ignoring exceptions if <code>success</code> is {@code false}. */
private static void close(boolean success, Releasable... releasables) {
try {
// this does the right thing with respect to add suppressed and not wrapping errors etc.
IOUtils.close(releasables);
} catch (IOException e) {
if (success) {
throw new UncheckedIOException(e);
}
private static RuntimeException useOrSuppress(RuntimeException firstException, RuntimeException e) {
if (firstException == null || firstException == e) {
return e;
}
firstException.addSuppressed(e);
return firstException;
}

/** Wrap several releasables into a single one. This is typically useful for use with try-with-resources: for example let's assume
Expand Down
12 changes: 1 addition & 11 deletions server/src/main/java/org/elasticsearch/TransportVersions.java
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
package org.elasticsearch;

import org.elasticsearch.core.Assertions;
import org.elasticsearch.core.FixForMultiProject;
import org.elasticsearch.core.UpdateForV9;

import java.lang.reflect.Field;
Expand Down Expand Up @@ -206,16 +205,7 @@ static TransportVersion def(int id) {
public static final TransportVersion BYTE_SIZE_VALUE_ALWAYS_USES_BYTES = def(9_015_0_00);
public static final TransportVersion ESQL_SERIALIZE_SOURCE_FUNCTIONS_WARNINGS = def(9_016_0_00);
public static final TransportVersion ESQL_DRIVER_NODE_DESCRIPTION = def(9_017_0_00);

/*
* WARNING: DO NOT MERGE INTO MAIN!
* This is the transport version used for all multi-project changes.
* This is above any possible transport version that could exist on main during multi-project branch development.
* We don't care about BwC during initial development. Before this code is merged into main,
* this variable needs to be changed to a regular transport version following the same rules as above.
*/
@FixForMultiProject
public static final TransportVersion MULTI_PROJECT = def(9_999_990);
public static final TransportVersion MULTI_PROJECT = def(9_018_0_00);

/*
* STOP! READ THIS FIRST! No, really,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
import org.apache.logging.log4j.Level;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.apache.lucene.tests.util.LuceneTestCase;
import org.elasticsearch.action.ActionListener;
import org.elasticsearch.cluster.ClusterChangedEvent;
import org.elasticsearch.cluster.ClusterName;
Expand Down Expand Up @@ -84,6 +85,7 @@
import static org.mockito.Mockito.times;
import static org.mockito.Mockito.verify;

@LuceneTestCase.SuppressFileSystems("ExtrasFS")
public class FileSettingsServiceTests extends ESTestCase {
private static final Logger logger = LogManager.getLogger(FileSettingsServiceTests.class);
private Environment env;
Expand Down

0 comments on commit 696b767

Please sign in to comment.