From 523c68188b5682ba5aadf5687244ca3b44a41c85 Mon Sep 17 00:00:00 2001 From: Navneet Verma Date: Fri, 2 Aug 2024 00:27:50 -0700 Subject: [PATCH 1/2] Removed JDK 11 and 17 version from CI runs (#1921) Signed-off-by: Navneet Verma --- .github/workflows/CI.yml | 6 +++--- .../workflows/backwards_compatibility_tests_workflow.yml | 4 ++-- .github/workflows/maven-publish.yml | 2 +- CHANGELOG.md | 1 + 4 files changed, 7 insertions(+), 6 deletions(-) diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index 3e04f3724f..a5d21e56c7 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -42,7 +42,7 @@ jobs: Build-k-NN-Linux: strategy: matrix: - java: [11, 17, 21] + java: [21] name: Build and Test k-NN Plugin on Linux runs-on: ubuntu-latest @@ -91,7 +91,7 @@ jobs: Build-k-NN-MacOS: strategy: matrix: - java: [ 11, 17, 21 ] + java: [ 21 ] name: Build and Test k-NN Plugin on MacOS needs: Get-CI-Image-Tag @@ -131,7 +131,7 @@ jobs: Build-k-NN-Windows: strategy: matrix: - java: [ 11, 17, 21 ] + java: [ 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 5092cd170d..90a20eda89 100644 --- a/.github/workflows/backwards_compatibility_tests_workflow.yml +++ b/.github/workflows/backwards_compatibility_tests_workflow.yml @@ -33,7 +33,7 @@ jobs: Restart-Upgrade-BWCTests-k-NN: strategy: matrix: - java: [ 11, 17 ] + java: [ 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", "2.12.0", "2.13.0", "2.14.0", "2.15.0", "2.16.0-SNAPSHOT"] opensearch_version : [ "3.0.0-SNAPSHOT" ] @@ -112,7 +112,7 @@ jobs: Rolling-Upgrade-BWCTests-k-NN: strategy: matrix: - java: [ 11, 17 ] + java: [ 21 ] os: [ubuntu-latest] bwc_version: [ "2.16.0-SNAPSHOT" ] opensearch_version: [ "3.0.0-SNAPSHOT" ] diff --git a/.github/workflows/maven-publish.yml b/.github/workflows/maven-publish.yml index 724e3a2139..644342c78b 100644 --- a/.github/workflows/maven-publish.yml +++ b/.github/workflows/maven-publish.yml @@ -20,7 +20,7 @@ jobs: - uses: actions/setup-java@v3 with: distribution: temurin # Temurin is a distribution of adoptium - java-version: 11 + java-version: 21 - uses: actions/checkout@v3 - uses: aws-actions/configure-aws-credentials@v1 with: diff --git a/CHANGELOG.md b/CHANGELOG.md index 575d5b6bdf..867fe9683b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), ### Enhancements ### Bug Fixes ### Infrastructure +* Removed JDK 11 and 17 version from CI runs [#1921](https://github.com/opensearch-project/k-NN/pull/1921) ### Documentation ### Maintenance ### Refactoring From ea8a6352d622a007c563b539da66929f67a842f6 Mon Sep 17 00:00:00 2001 From: Navneet Verma Date: Fri, 2 Aug 2024 10:38:33 -0700 Subject: [PATCH 2/2] Fix a flaky unit test:testMultiFieldsKnnIndex, which was failing due to inconsistent merge behaviors (#1924) Signed-off-by: Navneet Verma --- CHANGELOG.md | 1 + .../opensearch/knn/index/codec/KNNCodecTestCase.java | 11 +++++------ 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 867fe9683b..d2bb2494d7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -21,6 +21,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), ### Infrastructure ### Documentation ### Maintenance +* Fix a flaky unit test:testMultiFieldsKnnIndex, which was failing due to inconsistent merge behaviors [#1924](https://github.com/opensearch-project/k-NN/pull/1924) ### Refactoring * Introduce KNNVectorValues interface to iterate on different types of Vector values during indexing and search [#1897](https://github.com/opensearch-project/k-NN/pull/1897) * Clean up parsing for query [#1824](https://github.com/opensearch-project/k-NN/pull/1824) diff --git a/src/test/java/org/opensearch/knn/index/codec/KNNCodecTestCase.java b/src/test/java/org/opensearch/knn/index/codec/KNNCodecTestCase.java index 05e244fd4b..70b055df40 100644 --- a/src/test/java/org/opensearch/knn/index/codec/KNNCodecTestCase.java +++ b/src/test/java/org/opensearch/knn/index/codec/KNNCodecTestCase.java @@ -137,20 +137,19 @@ public void testMultiFieldsKnnIndex(Codec codec) throws Exception { Document doc = new Document(); doc.add(vectorField); writer.addDocument(doc); - writer.close(); + // ensuring the refresh happens, to create the segment and hnsw file + writer.flush(); /** * Add doc with field "my_vector" */ - IndexWriterConfig iwc1 = newIndexWriterConfig(); - iwc1.setMergeScheduler(new SerialMergeScheduler()); - iwc1.setCodec(ACTUAL_CODEC); - writer = new RandomIndexWriter(random(), dir, iwc1); float[] array1 = { 6.0f, 14.0f }; VectorField vectorField1 = new VectorField("my_vector", array1, sampleFieldType); Document doc1 = new Document(); doc1.add(vectorField1); writer.addDocument(doc1); + // ensuring the refresh happens, to create the segment and hnsw file + writer.flush(); IndexReader reader = writer.getReader(); writer.close(); ResourceWatcherService resourceWatcherService = createDisabledResourceWatcherService(); @@ -158,7 +157,7 @@ public void testMultiFieldsKnnIndex(Codec codec) throws Exception { List hnswfiles = Arrays.stream(dir.listAll()).filter(x -> x.contains("hnsw")).collect(Collectors.toList()); // there should be 2 hnsw index files created. one for test_vector and one for my_vector - assertEquals(hnswfiles.size(), 2); + assertEquals(2, hnswfiles.size()); assertEquals(hnswfiles.stream().filter(x -> x.contains("test_vector")).collect(Collectors.toList()).size(), 1); assertEquals(hnswfiles.stream().filter(x -> x.contains("my_vector")).collect(Collectors.toList()).size(), 1);