From 8fbb1c0f6a22639f33f40c8371740cb3f63aa8a4 Mon Sep 17 00:00:00 2001 From: John Mazanec Date: Thu, 2 Nov 2023 10:31:41 -0700 Subject: [PATCH 1/4] Update CI to use jdk-21 This updates the CI system to use jdk-21, which is latest LTS supported version. Coming from https://github.com/opensearch-project/OpenSearch/issues/10334 Signed-off-by: John Mazanec --- .github/workflows/CI.yml | 6 +++--- .../workflows/backwards_compatibility_tests_workflow.yml | 4 ++-- .github/workflows/test_security.yml | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index 84b4f09f9..c807e348e 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -20,7 +20,7 @@ jobs: Build-k-NN-Linux: strategy: matrix: - java: [11, 17] + java: [11, 17, 21] name: Build and Test k-NN Plugin on Linux runs-on: ubuntu-latest @@ -57,7 +57,7 @@ jobs: Build-k-NN-MacOS: strategy: matrix: - java: [ 11, 17 ] + java: [ 11, 17, 21 ] name: Build and Test k-NN Plugin on MacOS needs: Get-CI-Image-Tag @@ -84,7 +84,7 @@ jobs: Build-k-NN-Windows: strategy: matrix: - java: [ 11, 17 ] + java: [ 11, 17, 21 ] name: Build and Test k-NN Plugin on Windows needs: Get-CI-Image-Tag diff --git a/.github/workflows/backwards_compatibility_tests_workflow.yml b/.github/workflows/backwards_compatibility_tests_workflow.yml index 61cba5839..5357a4778 100644 --- a/.github/workflows/backwards_compatibility_tests_workflow.yml +++ b/.github/workflows/backwards_compatibility_tests_workflow.yml @@ -13,7 +13,7 @@ jobs: Restart-Upgrade-BWCTests-k-NN: strategy: matrix: - java: [ 11, 17 ] + java: [ 11, 17, 21 ] os: [ubuntu-latest] bwc_version : [ "2.0.1", "2.1.0", "2.2.1", "2.3.0", "2.4.1", "2.5.0", "2.6.0", "2.7.0", "2.8.0", "2.9.0", "2.10.0", "2.11.0-SNAPSHOT"] opensearch_version : [ "3.0.0-SNAPSHOT" ] @@ -86,7 +86,7 @@ jobs: Rolling-Upgrade-BWCTests-k-NN: strategy: matrix: - java: [ 11, 17 ] + java: [ 11, 17, 21 ] os: [ubuntu-latest] bwc_version: [ "2.11.0-SNAPSHOT" ] opensearch_version: [ "3.0.0-SNAPSHOT" ] diff --git a/.github/workflows/test_security.yml b/.github/workflows/test_security.yml index 3813ff675..ff3ca1459 100644 --- a/.github/workflows/test_security.yml +++ b/.github/workflows/test_security.yml @@ -15,7 +15,7 @@ jobs: Build-ad: strategy: matrix: - java: [ 11,17 ] + java: [ 11,17,21 ] os: [ubuntu-latest] fail-fast: true From 4c54838ca5cadc13e3084632d1210d6f5cf0f316 Mon Sep 17 00:00:00 2001 From: John Mazanec Date: Mon, 6 Nov 2023 13:22:55 -0800 Subject: [PATCH 2/4] Update version of spotless to 6.20 Signed-off-by: John Mazanec --- build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.gradle b/build.gradle index 86df9eed5..d1a1edd3e 100644 --- a/build.gradle +++ b/build.gradle @@ -36,7 +36,7 @@ plugins { id 'java-library' id 'java-test-fixtures' id 'idea' - id "com.diffplug.spotless" version "6.3.0" apply false + id "com.diffplug.spotless" version "6.20.0" apply false id 'io.freefair.lombok' version '8.4' } From 07ffa97ae36bc2988c1777f01c1483d29a1f92ec Mon Sep 17 00:00:00 2001 From: John Mazanec Date: Mon, 6 Nov 2023 13:34:10 -0800 Subject: [PATCH 3/4] Fix spotless Signed-off-by: John Mazanec --- src/main/java/org/opensearch/knn/indices/ModelDao.java | 4 +++- src/testFixtures/java/org/opensearch/knn/TestUtils.java | 9 +++------ 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/src/main/java/org/opensearch/knn/indices/ModelDao.java b/src/main/java/org/opensearch/knn/indices/ModelDao.java index fe0deb1cf..eada08b44 100644 --- a/src/main/java/org/opensearch/knn/indices/ModelDao.java +++ b/src/main/java/org/opensearch/knn/indices/ModelDao.java @@ -654,7 +654,9 @@ private void removeModelIdFromGraveyardOnFailure(String modelId, Exception excep client.execute( UpdateModelGraveyardAction.INSTANCE, new UpdateModelGraveyardRequest(modelId, true), - ActionListener.wrap(acknowledgedResponse -> { throw exceptionFromPreviousStep; }, unblockingFailedException -> { + ActionListener.wrap(acknowledgedResponse -> { + throw exceptionFromPreviousStep; + }, unblockingFailedException -> { // If it fails to remove the modelId from Model Graveyard, then log the error message and // throw the exception that was passed as a parameter from previous step String errorMessage = String.format("Failed to remove \" %s \" from Model Graveyard", modelId); diff --git a/src/testFixtures/java/org/opensearch/knn/TestUtils.java b/src/testFixtures/java/org/opensearch/knn/TestUtils.java index f22e4b267..941721660 100644 --- a/src/testFixtures/java/org/opensearch/knn/TestUtils.java +++ b/src/testFixtures/java/org/opensearch/knn/TestUtils.java @@ -210,12 +210,9 @@ public static PriorityQueue computeGroundTruthValues(int k, SpaceTyp public static float computeDistFromSpaceType(SpaceType spaceType, float[] indexVector, float[] queryVector) { float dist; if (spaceType != null) { - dist = KNN_SCORING_SPACE_TYPE.getOrDefault( - spaceType, - (defaultQueryVector, defaultIndexVector) -> { - throw new IllegalArgumentException(String.format("Invalid SpaceType function: \"%s\"", spaceType)); - } - ).apply(queryVector, indexVector); + dist = KNN_SCORING_SPACE_TYPE.getOrDefault(spaceType, (defaultQueryVector, defaultIndexVector) -> { + throw new IllegalArgumentException(String.format("Invalid SpaceType function: \"%s\"", spaceType)); + }).apply(queryVector, indexVector); } else { throw new NullPointerException("SpaceType is null. Provide a valid SpaceType."); } From 2106daaed01a6a2e0e31ff498c8bde8cdeceabfc Mon Sep 17 00:00:00 2001 From: John Mazanec Date: Mon, 6 Nov 2023 14:26:37 -0800 Subject: [PATCH 4/4] Remove bwc jdk-21 as we havent release support yet Signed-off-by: John Mazanec --- .github/workflows/backwards_compatibility_tests_workflow.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/backwards_compatibility_tests_workflow.yml b/.github/workflows/backwards_compatibility_tests_workflow.yml index 5357a4778..61cba5839 100644 --- a/.github/workflows/backwards_compatibility_tests_workflow.yml +++ b/.github/workflows/backwards_compatibility_tests_workflow.yml @@ -13,7 +13,7 @@ jobs: Restart-Upgrade-BWCTests-k-NN: strategy: matrix: - java: [ 11, 17, 21 ] + java: [ 11, 17 ] os: [ubuntu-latest] bwc_version : [ "2.0.1", "2.1.0", "2.2.1", "2.3.0", "2.4.1", "2.5.0", "2.6.0", "2.7.0", "2.8.0", "2.9.0", "2.10.0", "2.11.0-SNAPSHOT"] opensearch_version : [ "3.0.0-SNAPSHOT" ] @@ -86,7 +86,7 @@ jobs: Rolling-Upgrade-BWCTests-k-NN: strategy: matrix: - java: [ 11, 17, 21 ] + java: [ 11, 17 ] os: [ubuntu-latest] bwc_version: [ "2.11.0-SNAPSHOT" ] opensearch_version: [ "3.0.0-SNAPSHOT" ]