Skip to content

Commit

Permalink
Merge branch 'main' into index-metadata-system
Browse files Browse the repository at this point in the history
  • Loading branch information
cwperks committed Nov 19, 2024
2 parents 7ff0651 + 05513df commit 76bde0e
Show file tree
Hide file tree
Showing 155 changed files with 1,191 additions and 775 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/detect-breaking-change.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
with:
cache-disabled: true
arguments: japicmp
gradle-version: 8.7
gradle-version: 8.11
build-root-directory: server
- if: failure()
run: cat server/build/reports/java-compatibility/report.txt
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/gradle-check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ jobs:
- name: Upload Coverage Report
if: success()
uses: codecov/codecov-action@v4
uses: codecov/codecov-action@v5
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: ./codeCoverage.xml
Expand Down
12 changes: 11 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,21 +13,29 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
- Switch from `buildSrc/version.properties` to Gradle version catalog (`gradle/libs.versions.toml`) to enable dependabot to perform automated upgrades on common libs ([#16284](https://github.com/opensearch-project/OpenSearch/pull/16284))
- Increase segrep pressure checkpoint default limit to 30 ([#16577](https://github.com/opensearch-project/OpenSearch/pull/16577/files))
- Add dynamic setting allowing size > 0 requests to be cached in the request cache ([#16483](https://github.com/opensearch-project/OpenSearch/pull/16483))
- Support installing plugin SNAPSHOTs with SNASPHOT distribution ([#16581](https://github.com/opensearch-project/OpenSearch/pull/16581))
- Make IndexStoreListener a pluggable interface ([#16583](https://github.com/opensearch-project/OpenSearch/pull/16583))
- Support for keyword fields in star-tree index ([#16233](https://github.com/opensearch-project/OpenSearch/pull/16233))
- Add a flag in QueryShardContext to differentiate inner hit query ([#16600](https://github.com/opensearch-project/OpenSearch/pull/16600))
- Add vertical scaling and SoftReference for snapshot repository data cache ([#16489](https://github.com/opensearch-project/OpenSearch/pull/16489))
- Support prefix list for remote repository attributes([#16271](https://github.com/opensearch-project/OpenSearch/pull/16271))
- Add new configuration setting `synonym_analyzer`, to the `synonym` and `synonym_graph` filters, enabling the specification of a custom analyzer for reading the synonym file ([#16488](https://github.com/opensearch-project/OpenSearch/pull/16488)).

### Dependencies
- Bump `com.google.cloud:google-cloud-core-http` from 2.23.0 to 2.47.0 ([#16504](https://github.com/opensearch-project/OpenSearch/pull/16504))
- Bump `google-auth-library-oauth2-http` from 1.7.0 to 1.29.0 in /plugins/repository-gcs ([#16520](https://github.com/opensearch-project/OpenSearch/pull/16520))
- Bump `com.azure:azure-storage-common` from 12.25.1 to 12.27.1 ([#16521](https://github.com/opensearch-project/OpenSearch/pull/16521))
- Bump `com.google.apis:google-api-services-compute` from v1-rev20240407-2.0.0 to v1-rev20241021-2.0.0 ([#16502](https://github.com/opensearch-project/OpenSearch/pull/16502), [#16548](https://github.com/opensearch-project/OpenSearch/pull/16548))
- Bump `com.google.apis:google-api-services-compute` from v1-rev20240407-2.0.0 to v1-rev20241105-2.0.0 ([#16502](https://github.com/opensearch-project/OpenSearch/pull/16502), [#16548](https://github.com/opensearch-project/OpenSearch/pull/16548), [#16613](https://github.com/opensearch-project/OpenSearch/pull/16613))
- Bump `com.azure:azure-storage-blob` from 12.23.0 to 12.28.1 ([#16501](https://github.com/opensearch-project/OpenSearch/pull/16501))
- Bump `org.apache.hadoop:hadoop-minicluster` from 3.4.0 to 3.4.1 ([#16550](https://github.com/opensearch-project/OpenSearch/pull/16550))
- Bump `org.apache.xmlbeans:xmlbeans` from 5.2.1 to 5.2.2 ([#16612](https://github.com/opensearch-project/OpenSearch/pull/16612))
- Bump `com.nimbusds:nimbus-jose-jwt` from 9.41.1 to 9.46 ([#16611](https://github.com/opensearch-project/OpenSearch/pull/16611))
- Bump `lycheeverse/lychee-action` from 2.0.2 to 2.1.0 ([#16610](https://github.com/opensearch-project/OpenSearch/pull/16610))
- Bump `me.champeau.gradle.japicmp` from 0.4.4 to 0.4.5 ([#16614](https://github.com/opensearch-project/OpenSearch/pull/16614))
- Bump `mockito` from 5.14.1 to 5.14.2, `objenesis` from 3.2 to 3.3 and `bytebuddy` from 1.15.4 to 1.15.10 ([#16655](https://github.com/opensearch-project/OpenSearch/pull/16655))
- Bump `Netty` from 4.1.114.Final to 4.1.115.Final ([#16661](https://github.com/opensearch-project/OpenSearch/pull/16661))
- Bump `org.xerial.snappy:snappy-java` from 1.1.10.6 to 1.1.10.7 ([#16665](https://github.com/opensearch-project/OpenSearch/pull/16665))
- Bump `codecov/codecov-action` from 4 to 5 ([#16667](https://github.com/opensearch-project/OpenSearch/pull/16667))

### Changed

Expand All @@ -43,6 +51,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
- Support retrieving doc values of unsigned long field ([#16543](https://github.com/opensearch-project/OpenSearch/pull/16543))
- Fix rollover alias supports restored searchable snapshot index([#16483](https://github.com/opensearch-project/OpenSearch/pull/16483))
- Fix permissions error on scripted query against remote snapshot ([#16544](https://github.com/opensearch-project/OpenSearch/pull/16544))
- Fix `doc_values` only (`index:false`) IP field searching for masks ([#16628](https://github.com/opensearch-project/OpenSearch/pull/16628))
- Fix stale cluster state custom file deletion ([#16670](https://github.com/opensearch-project/OpenSearch/pull/16670))
- Ensure consistency of system flag on IndexMetadata after diff is applied ([#16644](https://github.com/opensearch-project/OpenSearch/pull/16644))

### Security
Expand Down
33 changes: 10 additions & 23 deletions DEVELOPER_GUIDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,7 @@
- [Getting Started](#getting-started)
- [Git Clone OpenSearch Repo](#git-clone-opensearch-repo)
- [Install Prerequisites](#install-prerequisites)
- [JDK 11](#jdk-11)
- [JDK 14](#jdk-14)
- [JDK 17](#jdk-17)
- [JDK](#jdk)
- [Custom Runtime JDK](#custom-runtime-jdk)
- [Windows](#windows)
- [Docker](#docker)
Expand Down Expand Up @@ -76,35 +74,24 @@ Fork [opensearch-project/OpenSearch](https://github.com/opensearch-project/OpenS

### Install Prerequisites

#### JDK 11
#### JDK

OpenSearch builds using Java 11 at a minimum, using the Adoptium distribution. This means you must have a JDK 11 installed with the environment variable `JAVA_HOME` referencing the path to Java home for your JDK 11 installation, e.g. `JAVA_HOME=/usr/lib/jvm/jdk-11`. This is configured in [buildSrc/build.gradle](buildSrc/build.gradle) and [distribution/tools/java-version-checker/build.gradle](distribution/tools/java-version-checker/build.gradle).
OpenSearch recommends building with the [Temurin/Adoptium](https://adoptium.net/temurin/releases/) distribution. JDK 11 is the minimum supported, and JDK-23 is the newest supported. You must have a supported JDK installed with the environment variable `JAVA_HOME` referencing the path to Java home for your JDK installation, e.g. `JAVA_HOME=/usr/lib/jvm/jdk-21`.

```
allprojects {
targetCompatibility = JavaVersion.VERSION_11
sourceCompatibility = JavaVersion.VERSION_11
}
```
Download Java 11 from [here](https://adoptium.net/releases.html?variant=openjdk11).

```
sourceCompatibility = JavaVersion.VERSION_11
targetCompatibility = JavaVersion.VERSION_11
```

Download Java 11 from [here](https://adoptium.net/releases.html?variant=openjdk11).
In addition, certain backward compatibility tests check out and compile the previous major version of OpenSearch, and therefore require installing [JDK 11](https://adoptium.net/temurin/releases/?version=11) and [JDK 17](https://adoptium.net/temurin/releases/?version=17) and setting the `JAVA11_HOME` and `JAVA17_HOME` environment variables. More to that, since 8.10 release, Gradle has deprecated the usage of the any JDKs below JDK-16. For smooth development experience, the recommendation is to install at least [JDK 17](https://adoptium.net/temurin/releases/?version=17) or [JDK 21](https://adoptium.net/temurin/releases/?version=21). If you still want to build with JDK-11 only, please add `-Dorg.gradle.warning.mode=none` when invoking any Gradle build task from command line, for example:

#### JDK 14

To run the full suite of tests, download and install [JDK 14](https://jdk.java.net/archive/) and set `JAVA11_HOME`, and `JAVA14_HOME`. They are required by the [backwards compatibility test](./TESTING.md#testing-backwards-compatibility).

#### JDK 17
```
./gradlew check -Dorg.gradle.warning.mode=none
```

By default, the test tasks use bundled JDK runtime, configured in [buildSrc/version.properties](buildSrc/version.properties), and set to JDK 17 (LTS).
By default, the test tasks use bundled JDK runtime, configured in version catalog [gradle/libs.versions.toml](gradle/libs.versions.toml), and set to JDK 23 (non-LTS).

```
bundled_jdk_vendor = adoptium
bundled_jdk = 17.0.2+8
bundled_jdk = 23.0.1+11
```

#### Custom Runtime JDK
Expand Down
20 changes: 13 additions & 7 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -162,14 +162,20 @@ Map<String, String> buildMetadataMap = buildMetadataValue.tokenize(';').collectE
return [key, value]
}

/**
* Using 'git' command line (if available), tries to fetch the commit date of the current revision
* @return commit date of the current revision or 0 if it is not available
*/
// See please https://docs.gradle.org/8.11/userguide/service_injection.html#execoperations
interface InjectedExecOps {
@Inject ExecOperations getExecOps()
}

/**
* Using 'git' command line (if available), tries to fetch the commit date of the current revision
* @return commit date of the current revision or 0 if it is not available
*/
long gitRevisionDate = {
def execOps = project.objects.newInstance(InjectedExecOps)
// Try to get last commit date as Unix timestamp
try (ByteArrayOutputStream stdout = new ByteArrayOutputStream()) {
ExecResult result = project.exec(spec -> {
ExecResult result = execOps.execOps.exec(spec -> {
spec.setIgnoreExitValue(true);
spec.setStandardOutput(stdout);
spec.commandLine("git", "log", "-1", "--format=%ct");
Expand Down Expand Up @@ -362,7 +368,7 @@ allprojects {
if ((dep instanceof ProjectDependency) == false) {
return
}
Project upstreamProject = dep.dependencyProject
Project upstreamProject = project.project(dep.path)
if (upstreamProject == null) {
return
}
Expand Down Expand Up @@ -438,7 +444,7 @@ gradle.projectsEvaluated {

configurations.matching { it.canBeResolved }.all { Configuration configuration ->
dependencies.matching { it instanceof ProjectDependency }.all { ProjectDependency dep ->
Project upstreamProject = dep.dependencyProject
Project upstreamProject = project.project(dep.path)
if (upstreamProject != null) {
if (project.path == upstreamProject.path) {
// TODO: distribution integ tests depend on themselves (!), fix that
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,12 @@ class TestWithDependenciesPlugin implements Plugin<Project> {

project.configurations.testImplementation.dependencies.all { Dependency dep ->
// this closure is run every time a compile dependency is added
if (dep instanceof ProjectDependency && dep.dependencyProject.plugins.hasPlugin(PluginBuildPlugin)) {
project.gradle.projectsEvaluated {
addPluginResources(project, dep.dependencyProject)
if (dep instanceof ProjectDependency) {
Project dependencyProject = project.project(((ProjectDependency)dep).path)
if (dependencyProject.plugins.hasPlugin(PluginBuildPlugin)) {
project.gradle.projectsEvaluated {
addPluginResources(project, dependencyProject)
}
}
}
}
Expand Down
11 changes: 9 additions & 2 deletions buildSrc/src/main/java/org/opensearch/gradle/LoggedExec.java
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,11 @@ public class LoggedExec extends Exec implements FileSystemOperationsAware {
private Consumer<Logger> outputLogger;
private FileSystemOperations fileSystemOperations;

interface InjectedExecOps {
@Inject
ExecOperations getExecOps();
}

@Inject
public LoggedExec(FileSystemOperations fileSystemOperations) {
this.fileSystemOperations = fileSystemOperations;
Expand Down Expand Up @@ -133,15 +138,17 @@ public void setSpoolOutput(boolean spoolOutput) {
}

public static ExecResult exec(Project project, Action<ExecSpec> action) {
return genericExec(project::exec, action);
final InjectedExecOps execOps = project.getObjects().newInstance(InjectedExecOps.class);
return exec(execOps.getExecOps(), action);
}

public static ExecResult exec(ExecOperations execOperations, Action<ExecSpec> action) {
return genericExec(execOperations::exec, action);
}

public static ExecResult javaexec(Project project, Action<JavaExecSpec> action) {
return genericExec(project::javaexec, action);
final InjectedExecOps execOps = project.getObjects().newInstance(InjectedExecOps.class);
return genericExec(execOps.getExecOps()::javaexec, action);
}

/** Returns JVM arguments suitable for a short-lived forked task */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ public String call() throws Exception {
Node dependencyNode = dependenciesNode.appendNode("dependency");
dependencyNode.appendNode("groupId", dependency.getGroup());
ProjectDependency projectDependency = (ProjectDependency) dependency;
String artifactId = getArchivesBaseName(projectDependency.getDependencyProject());
String artifactId = getArchivesBaseName(project.project(projectDependency.getPath()));
dependencyNode.appendNode("artifactId", artifactId);
dependencyNode.appendNode("version", dependency.getVersion());
dependencyNode.appendNode("scope", "compile");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,11 @@
import org.gradle.api.tasks.PathSensitivity;
import org.gradle.api.tasks.SkipWhenEmpty;
import org.gradle.api.tasks.TaskAction;
import org.gradle.process.ExecOperations;
import org.gradle.process.ExecResult;

import javax.inject.Inject;

import java.io.ByteArrayOutputStream;
import java.io.File;
import java.io.IOException;
Expand Down Expand Up @@ -108,6 +111,11 @@ public class ThirdPartyAuditTask extends DefaultTask {

public boolean jarHellEnabled = true;

interface InjectedExecOps {
@Inject
ExecOperations getExecOps();
}

@Input
public Property<JavaVersion> getTargetCompatibility() {
return targetCompatibility;
Expand Down Expand Up @@ -357,7 +365,8 @@ private String formatClassList(Set<String> classList) {

private String runForbiddenAPIsCli() throws IOException {
ByteArrayOutputStream errorOut = new ByteArrayOutputStream();
ExecResult result = getProject().javaexec(spec -> {
InjectedExecOps execOps = getProject().getObjects().newInstance(InjectedExecOps.class);
ExecResult result = execOps.getExecOps().javaexec(spec -> {
if (javaHome != null) {
spec.setExecutable(javaHome + "/bin/java");
}
Expand Down Expand Up @@ -391,7 +400,8 @@ private String runForbiddenAPIsCli() throws IOException {

private Set<String> runJdkJarHellCheck() throws IOException {
ByteArrayOutputStream standardOut = new ByteArrayOutputStream();
ExecResult execResult = getProject().javaexec(spec -> {
InjectedExecOps execOps = getProject().getObjects().newInstance(InjectedExecOps.class);
ExecResult execResult = execOps.getExecOps().javaexec(spec -> {
spec.classpath(
jdkJarHellClasspath,
getRuntimeConfiguration(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -137,8 +137,6 @@
*/
class InstallPluginCommand extends EnvironmentAwareCommand {

private static final String PROPERTY_STAGING_ID = "opensearch.plugins.staging";

// exit codes for install
/** A plugin with the same name is already installed. */
static final int PLUGIN_EXISTS = 1;
Expand Down Expand Up @@ -307,14 +305,7 @@ void execute(Terminal terminal, List<String> pluginIds, boolean isBatch, Environ
private Path download(Terminal terminal, String pluginId, Path tmpDir, boolean isBatch) throws Exception {

if (OFFICIAL_PLUGINS.contains(pluginId)) {
final String url = getOpenSearchUrl(
terminal,
getStagingHash(),
Version.CURRENT,
isSnapshot(),
pluginId,
Platforms.PLATFORM_NAME
);
final String url = getOpenSearchUrl(terminal, Version.CURRENT, isSnapshot(), pluginId, Platforms.PLATFORM_NAME);
terminal.println("-> Downloading " + pluginId + " from opensearch");
return downloadAndValidate(terminal, url, tmpDir, true, isBatch);
}
Expand All @@ -341,38 +332,25 @@ private Path download(Terminal terminal, String pluginId, Path tmpDir, boolean i
return downloadZip(terminal, pluginId, tmpDir, isBatch);
}

// pkg private so tests can override
String getStagingHash() {
return System.getProperty(PROPERTY_STAGING_ID);
}

boolean isSnapshot() {
return Build.CURRENT.isSnapshot();
}

/** Returns the url for an official opensearch plugin. */
private String getOpenSearchUrl(
final Terminal terminal,
final String stagingHash,
final Version version,
final boolean isSnapshot,
final String pluginId,
final String platform
) throws IOException, UserException {
final String baseUrl;
if (isSnapshot && stagingHash == null) {
throw new UserException(
ExitCodes.CONFIG,
"attempted to install release build of official plugin on snapshot build of OpenSearch"
);
}
if (stagingHash != null) {
if (isSnapshot == true) {
baseUrl = String.format(
Locale.ROOT,
"https://artifacts.opensearch.org/snapshots/plugins/%s/%s-%s",
"https://artifacts.opensearch.org/snapshots/plugins/%s/%s",
pluginId,
version,
stagingHash
Build.CURRENT.getQualifiedVersion()
);
} else {
baseUrl = String.format(
Expand Down
Loading

0 comments on commit 76bde0e

Please sign in to comment.