-
Notifications
You must be signed in to change notification settings - Fork 191
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Breaking changes for type removal #132
Changes from all commits
adac661
e629651
5898cc0
a8d1300
d82f4b6
0b0a118
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
name: Integration with Unreleased OpenSearch | ||
|
||
on: | ||
push: | ||
branches: | ||
- "main" | ||
pull_request: | ||
branches: | ||
- "main" | ||
|
||
env: | ||
OPENSEARCH_VERSION: '2.0' | ||
|
||
jobs: | ||
test: | ||
runs-on: ubuntu-latest | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
java: [ 11 ] | ||
steps: | ||
- name: Set up JDK ${{ matrix.java }} | ||
uses: actions/setup-java@v1 | ||
with: | ||
java-version: ${{ matrix.java }} | ||
|
||
- name: Checkout OpenSearch | ||
uses: actions/checkout@v2 | ||
with: | ||
repository: opensearch-project/opensearch | ||
ref: ${{ env.OPENSEARCH_VERSION }} | ||
path: opensearch | ||
|
||
- name: Assemble OpenSearch | ||
run: | | ||
cd opensearch | ||
./gradlew assemble | ||
|
||
# This step runs the docker image generated during gradle assemble in OpenSearch. It is tagged as opensearch:test. | ||
# Reference: https://github.com/opensearch-project/OpenSearch/blob/2.0/distribution/docker/build.gradle#L190 | ||
- name: Run Docker Image | ||
run: | | ||
docker run -p 9200:9200 -p 9600:9600 -d -e "discovery.type=single-node" -e "bootstrap.memory_lock=true" opensearch:test | ||
sleep 90 | ||
|
||
- name: Checkout Java Client | ||
uses: actions/checkout@v2 | ||
with: | ||
path: opensearch-java | ||
|
||
- name: Run Integration Test | ||
run: | | ||
cd opensearch-java | ||
./gradlew clean integrationTest -Dhttps=false |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -36,8 +36,9 @@ import java.io.FileWriter | |
|
||
buildscript { | ||
repositories { | ||
mavenCentral() | ||
mavenLocal() | ||
maven(url = "https://aws.oss.sonatype.org/content/repositories/snapshots") | ||
mavenCentral() | ||
maven(url = "https://plugins.gradle.org/m2/") | ||
} | ||
} | ||
|
@@ -55,8 +56,8 @@ checkstyle { | |
} | ||
|
||
java { | ||
targetCompatibility = JavaVersion.VERSION_1_8 | ||
sourceCompatibility = JavaVersion.VERSION_1_8 | ||
targetCompatibility = JavaVersion.VERSION_11 | ||
sourceCompatibility = JavaVersion.VERSION_11 | ||
|
||
withJavadocJar() | ||
withSourcesJar() | ||
|
@@ -122,13 +123,14 @@ val integrationTest = task<Test>("integrationTest") { | |
|
||
dependencies { | ||
|
||
val opensearchVersion = "1.2.4" | ||
val opensearchVersion = "2.0.0-alpha1-SNAPSHOT" | ||
val jacksonVersion = "2.12.6" | ||
val jacksonDatabindVersion = "2.12.6.1" | ||
|
||
// Apache 2.0 | ||
implementation("org.opensearch.client", "opensearch-rest-client", opensearchVersion) | ||
testImplementation("org.opensearch.test", "framework", opensearchVersion) | ||
implementation("org.apache.logging.log4j", "log4j-core", "2.17.2") | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is this introducing a hard-coded dependency on the Log4j framework? Surely the client should only be dependent on the facade? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think you may be right @dermot-hardy! Care to open an issue/contribute a fix? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
|
||
// Apache 2.0 | ||
// https://search.maven.org/artifact/com.google.code.findbugs/jsr305 | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -95,9 +95,6 @@ public class BulkRequest extends RequestBase implements NdJsonpSerializable, Jso | |
@Nullable | ||
private final Time timeout; | ||
|
||
@Nullable | ||
private final String type; | ||
|
||
@Nullable | ||
private final WaitForActiveShards waitForActiveShards; | ||
|
||
|
@@ -116,7 +113,6 @@ private BulkRequest(Builder builder) { | |
this.requireAlias = builder.requireAlias; | ||
this.routing = builder.routing; | ||
this.timeout = builder.timeout; | ||
this.type = builder.type; | ||
this.waitForActiveShards = builder.waitForActiveShards; | ||
this.operations = ApiTypeHelper.unmodifiableRequired(builder.operations, this, "operations"); | ||
|
||
|
@@ -224,16 +220,6 @@ public final Time timeout() { | |
return this.timeout; | ||
} | ||
|
||
/** | ||
* Default document type for items which don't provide one | ||
* <p> | ||
* API name: {@code type} | ||
*/ | ||
@Nullable | ||
public final String type() { | ||
return this.type; | ||
} | ||
|
||
/** | ||
* Sets the number of shard copies that must be active before proceeding with | ||
* the bulk operation. Defaults to 1, meaning the primary shard only. Set to | ||
|
@@ -304,9 +290,6 @@ public static class Builder extends ObjectBuilderBase implements ObjectBuilder<B | |
@Nullable | ||
private Time timeout; | ||
|
||
@Nullable | ||
private String type; | ||
|
||
@Nullable | ||
private WaitForActiveShards waitForActiveShards; | ||
|
||
|
@@ -457,16 +440,6 @@ public final Builder timeout(Function<Time.Builder, ObjectBuilder<Time>> fn) { | |
return this.timeout(fn.apply(new Time.Builder()).build()); | ||
} | ||
|
||
/** | ||
* Default document type for items which don't provide one | ||
* <p> | ||
* API name: {@code type} | ||
*/ | ||
public final Builder type(@Nullable String value) { | ||
this.type = value; | ||
return this; | ||
} | ||
|
||
/** | ||
* Sets the number of shard copies that must be active before proceeding with | ||
* the bulk operation. Defaults to 1, meaning the primary shard only. Set to | ||
|
@@ -559,14 +532,11 @@ public BulkRequest build() { | |
// Request path | ||
request -> { | ||
final int _index = 1 << 0; | ||
final int _type = 1 << 1; | ||
|
||
int propsSet = 0; | ||
|
||
if (request.index() != null) | ||
propsSet |= _index; | ||
if (request.type() != null) | ||
propsSet |= _type; | ||
|
||
if (propsSet == 0) { | ||
StringBuilder buf = new StringBuilder(); | ||
|
@@ -580,15 +550,6 @@ public BulkRequest build() { | |
buf.append("/_bulk"); | ||
return buf.toString(); | ||
} | ||
if (propsSet == (_index | _type)) { | ||
StringBuilder buf = new StringBuilder(); | ||
buf.append("/"); | ||
SimpleEndpoint.pathEncode(request.index, buf); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Seems like There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ah ... not visible in changeset, thank you! |
||
buf.append("/"); | ||
SimpleEndpoint.pathEncode(request.type, buf); | ||
buf.append("/_bulk"); | ||
return buf.toString(); | ||
} | ||
throw SimpleEndpoint.noPathTemplateFound("path"); | ||
|
||
}, | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am 100% sure there is a staging repository for Docker images, @dblock @peterzhuamazon could you please refer to the right one?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes there is one, but the staging image is with all the plugins which isn't ready yet. This is to test against min OpenSearch image. This also helps in client development when a new version of OpenSearch is being developed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I also tried the route of writing Dockerfile and related things to create a docker image for min OpenSearch and use the script in opensearch-build to use the build and run the image. But then I found this gradle task that runs in assemble for OpenSearch so used this one. LMK if you think the Dockerfile route is better. I can use that instead.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think publishing min Docker images (along with artifacts) would be the best option, may be we could quickly address that? Another possibility is to use OpenSearch test scaffolding (available as set of Gradle plugins) to run clusters from the test suites. What do you think?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I didn't use the Gradle plugins since I wanted to create a CI way for all the clients. It can work for java client but we would still end up in the same place for other clients. The main purpose of this is for clients to be ready to be released when a new version of OpenSearch is being released.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agree, thank you, publishing min Docker images (along with artifacts) would be the answer, right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes that would be the best option. Till that happens, is it fine if we use this change so we can start the development for 2.0? WDYT?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, sure, I think it is viable option
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe we will be adding API for plugins too and we need unreleased complete distribution for testing. Shall we create an issue to track this if it is not created already?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, please do, I think it will useful for many