Skip to content

Commit

Permalink
Merge branch 'main' into task_monitoring_changes
Browse files Browse the repository at this point in the history
Signed-off-by: Sagar <99425694+sgup432@users.noreply.github.com>
  • Loading branch information
sgup432 committed Jun 7, 2023
2 parents dc65e48 + 8773509 commit 51f4369
Show file tree
Hide file tree
Showing 272 changed files with 2,576 additions and 1,809 deletions.
1 change: 1 addition & 0 deletions .ci/bwcVersions
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,5 @@ BWC_VERSION:
- "2.7.0"
- "2.7.1"
- "2.8.0"
- "2.8.1"
- "2.9.0"
2 changes: 1 addition & 1 deletion .idea/inspectionProfiles/Project_Default.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
- Add `com.github.luben:zstd-jni` version 1.5.5-3 ([#2996](https://github.com/opensearch-project/OpenSearch/pull/2996))
- OpenJDK Update (April 2023 Patch releases) ([#7344](https://github.com/opensearch-project/OpenSearch/pull/7344)
- Bump `com.amazonaws` 1.12.270 to `software.amazon.awssdk` 2.20.55 ([7372](https://github.com/opensearch-project/OpenSearch/pull/7372/))
- Bump `com.google.http-client:google-http-client:1.43.2` from 1.42.0 to 1.43.2 ([7928](https://github.com/opensearch-project/OpenSearch/pull/7928)))
- Bump `com.azure:azure-storage-blob` from 12.21.1 to 12.22.2 ([7930](https://github.com/opensearch-project/OpenSearch/pull/7930))

### Changed
- [CCR] Add getHistoryOperationsFromTranslog method to fetch the history snapshot from translogs ([#3948](https://github.com/opensearch-project/OpenSearch/pull/3948))
Expand Down Expand Up @@ -98,6 +100,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
### Changed
- Replace jboss-annotations-api_1.2_spec with jakarta.annotation-api ([#7836](https://github.com/opensearch-project/OpenSearch/pull/7836))
- Add min, max, average and thread info to resource stats in tasks API ([#7673](https://github.com/opensearch-project/OpenSearch/pull/7673))
- Compress and cache cluster state during validate join request ([#7321](https://github.com/opensearch-project/OpenSearch/pull/7321))

### Deprecated

Expand Down
2 changes: 1 addition & 1 deletion buildSrc/version.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
opensearch = 3.0.0
lucene = 9.7.0-snapshot-4d1ed9e
lucene = 9.7.0-snapshot-204acc3

bundled_jdk_vendor = adoptium
bundled_jdk = 20.0.1+9
Expand Down
24 changes: 17 additions & 7 deletions libs/core/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -103,13 +103,23 @@ tasks.named('forbiddenApisMain').configure {
tasks.named("thirdPartyAudit").configure {
ignoreMissingClasses(
// from log4j
'org.osgi.framework.Bundle',
'org.osgi.framework.BundleActivator',
'org.osgi.framework.BundleContext',
'org.osgi.framework.BundleEvent',
'org.osgi.framework.SynchronousBundleListener',
'org.osgi.framework.wiring.BundleWire',
'org.osgi.framework.wiring.BundleWiring'
*[
'org.osgi.framework.Bundle',
'org.osgi.framework.BundleActivator',
'org.osgi.framework.BundleContext',
'org.osgi.framework.BundleEvent',
'org.osgi.framework.SynchronousBundleListener',
'org.osgi.framework.wiring.BundleWire',
'org.osgi.framework.wiring.BundleWiring',
] + (BuildParams.runtimeJavaVersion < JavaVersion.VERSION_20) ? [] : [
'jdk.incubator.vector.ByteVector',
'jdk.incubator.vector.FloatVector',
'jdk.incubator.vector.IntVector',
'jdk.incubator.vector.ShortVector',
'jdk.incubator.vector.Vector',
'jdk.incubator.vector.VectorOperators',
'jdk.incubator.vector.VectorSpecies'
]
)
}

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
3aa698cf90f074cbf24acfd7feaaad84c5a6f829

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,10 @@
*/
package org.opensearch;

import org.opensearch.common.CheckedFunction;
import org.opensearch.common.Nullable;
import org.opensearch.core.common.Strings;
import org.opensearch.core.common.io.stream.BaseStreamInput;
import org.opensearch.core.common.logging.LoggerMessageFormat;
import org.opensearch.core.xcontent.ToXContent;
import org.opensearch.core.xcontent.ToXContentFragment;
Expand All @@ -41,10 +43,12 @@

import java.io.IOException;
import java.util.Arrays;
import java.util.Collection;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.concurrent.ConcurrentHashMap;

import static java.util.Collections.singletonMap;

Expand Down Expand Up @@ -434,4 +438,98 @@ private String getShardIdString() {
}
return null;
}

/**
* An ExceptionHandle for registering Exceptions that can be serialized over the transport wire
*
* @opensearch.internal
*/
protected static abstract class BaseOpenSearchExceptionHandle {
final Class<? extends BaseOpenSearchException> exceptionClass;
final CheckedFunction<? extends BaseStreamInput, ? extends BaseOpenSearchException, IOException> constructor;
final int id;
final Version versionAdded;

<E extends BaseOpenSearchException, S extends BaseStreamInput> BaseOpenSearchExceptionHandle(
Class<E> exceptionClass,
CheckedFunction<S, E, IOException> constructor,
int id,
Version versionAdded
) {
// We need the exceptionClass because you can't dig it out of the constructor reliably.
this.exceptionClass = exceptionClass;
this.constructor = constructor;
this.versionAdded = versionAdded;
this.id = id;
}
}

@SuppressWarnings("unchecked")
public static <T extends BaseStreamInput> BaseOpenSearchException readException(T input, int id) throws IOException {
CheckedFunction<T, ? extends BaseOpenSearchException, IOException> opensearchException = (CheckedFunction<
T,
? extends BaseOpenSearchException,
IOException>) OpenSearchExceptionHandleRegistry.getSupplier(id);
if (opensearchException == null) {
throw new IllegalStateException("unknown exception for id: " + id);
}
return opensearchException.apply(input);
}

/**
* Registry of ExceptionHandlers
*
* @opensearch.internal
*/
public static class OpenSearchExceptionHandleRegistry {
/** Registry mapping from unique Ordinal to the Exception Constructor */
private static final Map<
Integer,
CheckedFunction<? extends BaseStreamInput, ? extends BaseOpenSearchException, IOException>> ID_TO_SUPPLIER_REGISTRY =
new ConcurrentHashMap<>();
/** Registry mapping from Exception class to the Exception Handler */
private static final Map<
Class<? extends BaseOpenSearchException>,
BaseOpenSearchExceptionHandle> CLASS_TO_OPENSEARCH_EXCEPTION_HANDLE_REGISTRY = new ConcurrentHashMap<>();

/** returns the Exception constructor function from a given ordinal */
public static CheckedFunction<? extends BaseStreamInput, ? extends BaseOpenSearchException, IOException> getSupplier(final int id) {
return ID_TO_SUPPLIER_REGISTRY.get(id);
}

/** registers the Exception handler */
public static void registerExceptionHandle(final BaseOpenSearchExceptionHandle handle) {
ID_TO_SUPPLIER_REGISTRY.put(handle.id, handle.constructor);
CLASS_TO_OPENSEARCH_EXCEPTION_HANDLE_REGISTRY.put(handle.exceptionClass, handle);
}

/** Gets the unique ordinal id of the Exception from the given class */
public static int getId(final Class<? extends BaseOpenSearchException> exception) {
return CLASS_TO_OPENSEARCH_EXCEPTION_HANDLE_REGISTRY.get(exception).id;
}

/** returns a set of ids */
public static Set<Integer> ids() {
return ID_TO_SUPPLIER_REGISTRY.keySet();
}

/** returns a collection of handles */
public static Collection<BaseOpenSearchExceptionHandle> handles() {
return CLASS_TO_OPENSEARCH_EXCEPTION_HANDLE_REGISTRY.values();
}

/** checks that the exception class is registered */
public static boolean isRegistered(final Class<? extends Throwable> exception, final Version version) {
BaseOpenSearchExceptionHandle openSearchExceptionHandle = CLASS_TO_OPENSEARCH_EXCEPTION_HANDLE_REGISTRY.get(exception);
if (openSearchExceptionHandle != null) {
return version.onOrAfter(openSearchExceptionHandle.versionAdded);
}
return false;
}

/** returns a set of registered exception classes */
public static Set<Class<? extends BaseOpenSearchException>> getRegisteredKeys() { // for testing
return CLASS_TO_OPENSEARCH_EXCEPTION_HANDLE_REGISTRY.keySet();
}
}
}
1 change: 1 addition & 0 deletions libs/core/src/main/java/org/opensearch/Version.java
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ public class Version implements Comparable<Version>, ToXContentFragment {
public static final Version V_2_7_0 = new Version(2070099, org.apache.lucene.util.Version.LUCENE_9_5_0);
public static final Version V_2_7_1 = new Version(2070199, org.apache.lucene.util.Version.LUCENE_9_5_0);
public static final Version V_2_8_0 = new Version(2080099, org.apache.lucene.util.Version.LUCENE_9_6_0);
public static final Version V_2_8_1 = new Version(2080199, org.apache.lucene.util.Version.LUCENE_9_6_0);
public static final Version V_2_9_0 = new Version(2090099, org.apache.lucene.util.Version.LUCENE_9_6_0);
public static final Version V_3_0_0 = new Version(3000099, org.apache.lucene.util.Version.LUCENE_9_7_0);
public static final Version CURRENT = V_3_0_0;
Expand Down

0 comments on commit 51f4369

Please sign in to comment.