Skip to content

Commit

Permalink
Merge branch '2.x' into space-type-bug-fix-backport
Browse files Browse the repository at this point in the history
Signed-off-by: Doo Yong Kim <[email protected]>
  • Loading branch information
0ctopus13prime authored Jan 14, 2025
2 parents 0c6585d + 04e6b84 commit 09a336d
Show file tree
Hide file tree
Showing 190 changed files with 7,086 additions and 2,950 deletions.
2 changes: 1 addition & 1 deletion .github/CODEOWNERS
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
# This should match the owning team set up in https://github.com/orgs/opensearch-project/teams
* @heemin32 @navneet1v @VijayanB @vamshin @jmazanec15 @naveentatikonda @junqiu-lei @martin-gaievski @ryanbogan @luyuncheng
* @heemin32 @navneet1v @VijayanB @vamshin @jmazanec15 @naveentatikonda @junqiu-lei @martin-gaievski @ryanbogan @luyuncheng @shatejas @0ctopus13prime
29 changes: 16 additions & 13 deletions .github/workflows/CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ on:
- 'buildSrc/**'
- 'gradle/**'
- 'jni/**'
- 'micro-benchmarks/**'
- '.github/workflows/CI.yml'
pull_request:
branches:
Expand All @@ -28,10 +27,7 @@ on:
- 'buildSrc/**'
- 'gradle/**'
- 'jni/**'
- 'micro-benchmarks/**'
- '.github/workflows/CI.yml'
env:
ACTIONS_ALLOW_USE_UNSECURE_NODE_VERSION: true

jobs:
Get-CI-Image-Tag:
Expand All @@ -52,11 +48,14 @@ jobs:
# this image tag is subject to change as more dependencies and updates will arrive over time
image: ${{ needs.Get-CI-Image-Tag.outputs.ci-image-version-linux }}
# need to switch to root so that github actions can install runner binary on container without permission issues.
options: --user root
options: ${{ needs.Get-CI-Image-Tag.outputs.ci-image-start-options }}

steps:
- name: Run start commands
run: ${{ needs.Get-CI-Image-Tag.outputs.ci-image-start-command }}

- name: Checkout k-NN
uses: actions/checkout@v1
uses: actions/checkout@v4

# Setup git user so that patches for native libraries can be applied and committed
- name: Setup git user
Expand All @@ -65,9 +64,10 @@ jobs:
su `id -un 1000` -c 'git config --global user.email "github-actions[bot]@users.noreply.github.com"'
- name: Setup Java ${{ matrix.java }}
uses: actions/setup-java@v1
uses: actions/setup-java@v4
with:
java-version: ${{ matrix.java }}
distribution: 'temurin'

- name: Run build
# switching the user, as OpenSearch cluster can only be started as root/Administrator on linux-deb/linux-rpm/windows-zip.
Expand All @@ -88,7 +88,7 @@ jobs:
- name: Upload Coverage Report
uses: codecov/codecov-action@v1
uses: codecov/codecov-action@v4
with:
token: ${{ secrets.CODECOV_TOKEN }}

Expand All @@ -99,11 +99,11 @@ jobs:

name: Build and Test k-NN Plugin on MacOS
needs: Get-CI-Image-Tag
runs-on: macos-12
runs-on: macos-13

steps:
- name: Checkout k-NN
uses: actions/checkout@v1
uses: actions/checkout@v4

# Setup git user so that patches for native libraries can be applied and committed
- name: Setup git user
Expand All @@ -112,12 +112,14 @@ jobs:
git config --global user.email "github-actions[bot]@users.noreply.github.com"
- name: Setup Java ${{ matrix.java }}
uses: actions/setup-java@v1
uses: actions/setup-java@v4
with:
java-version: ${{ matrix.java }}
distribution: 'temurin'

- name: Install dependencies on macos
run: |
brew install libomp
brew reinstall gcc
export FC=/usr/local/Cellar/gcc/12.2.0/bin/gfortran
Expand All @@ -144,7 +146,7 @@ jobs:

steps:
- name: Checkout k-NN
uses: actions/checkout@v1
uses: actions/checkout@v4

# Setup git user so that patches for native libraries can be applied and committed
- name: Setup git user
Expand All @@ -153,9 +155,10 @@ jobs:
git config --global user.email "github-actions[bot]@users.noreply.github.com"
- name: Setup Java ${{ matrix.java }}
uses: actions/setup-java@v1
uses: actions/setup-java@v4
with:
java-version: ${{ matrix.java }}
distribution: 'temurin'

- name: Install MinGW Using Scoop
run: |
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/backwards_compatibility_tests_workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@ jobs:
strategy:
matrix:
java: [ 11, 17 ]
bwc_version : [ "1.1.0", "1.2.4", "1.3.8", "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", "2.17.0" ]
opensearch_version : [ "2.18.0-SNAPSHOT" ]
bwc_version : [ "1.1.0", "1.2.4", "1.3.8", "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", "2.17.0", "2.18.0" ]
opensearch_version : [ "2.19.0-SNAPSHOT" ]

name: k-NN Restart-Upgrade BWC Tests
runs-on: ubuntu-latest
Expand Down Expand Up @@ -82,8 +82,8 @@ jobs:
strategy:
matrix:
java: [ 11, 17 ]
bwc_version: [ "1.3.8", "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", "2.17.0"]
opensearch_version: [ "2.18.0-SNAPSHOT" ]
bwc_version: [ "1.3.8", "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", "2.17.0", "2.18.0"]
opensearch_version: [ "2.19.0-SNAPSHOT" ]

name: k-NN Rolling-Upgrade BWC Tests
runs-on: ubuntu-latest
Expand Down
17 changes: 12 additions & 5 deletions .github/workflows/delete_backport_branch.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,16 @@ on:
jobs:
delete-branch:
runs-on: ubuntu-latest
if: startsWith(github.event.pull_request.head.ref,'backport/')
permissions:
contents: write
if: github.repository == 'opensearch-project/k-NN' && startsWith(github.event.pull_request.head.ref,'backport/')
steps:
- name: Delete merged branch
uses: SvanBoxel/delete-merged-branch@main
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Delete merged branch
uses: actions/github-script@v7
with:
script: |
github.rest.git.deleteRef({
owner: context.repo.owner,
repo: context.repo.repo,
ref: `heads/${context.payload.pull_request.head.ref}`,
})
11 changes: 6 additions & 5 deletions .github/workflows/test_security.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,6 @@ on:
- 'gradle/**'
- 'jni/**'
- '.github/workflows/test_security.yml'
env:
ACTIONS_ALLOW_USE_UNSECURE_NODE_VERSION: true

jobs:
Get-CI-Image-Tag:
Expand All @@ -50,21 +48,24 @@ jobs:
# this image tag is subject to change as more dependencies and updates will arrive over time
image: ${{ needs.Get-CI-Image-Tag.outputs.ci-image-version-linux }}
# need to switch to root so that github actions can install runner binary on container without permission issues.
options: --user root
options: ${{ needs.Get-CI-Image-Tag.outputs.ci-image-start-options }}

steps:
- name: Run start commands
run: ${{ needs.Get-CI-Image-Tag.outputs.ci-image-start-command }}
- name: Checkout k-NN
uses: actions/checkout@v1
uses: actions/checkout@v4
# Setup git user so that patches for native libraries can be applied and committed
- name: Setup git user
run: |
su `id -un 1000` -c 'git config --global user.name "github-actions[bot]"'
su `id -un 1000` -c 'git config --global user.email "github-actions[bot]@users.noreply.github.com"'
- name: Setup Java ${{ matrix.java }}
uses: actions/setup-java@v1
uses: actions/setup-java@v4
with:
java-version: ${{ matrix.java }}
distribution: 'temurin'

- name: Run build
# switching the user, as OpenSearch cluster can only be started as root/Administrator on linux-deb/linux-rpm/windows-zip.
Expand Down
15 changes: 15 additions & 0 deletions .idea/runConfigurations/Debug_OpenSearch.xml

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

12 changes: 12 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,14 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),

## [Unreleased 2.x](https://github.com/opensearch-project/k-NN/compare/2.18...2.x)
### Features
- Add Support for Multi Values in innerHit for Nested k-NN Fields in Lucene and FAISS (#2283)[https://github.com/opensearch-project/k-NN/pull/2283]
- Add binary index support for Lucene engine. (#2292)[https://github.com/opensearch-project/k-NN/pull/2292]
- Add expand_nested_docs Parameter support to NMSLIB engine (#2331)[https://github.com/opensearch-project/k-NN/pull/2331]
### Enhancements
- Introduced a writing layer in native engines where relies on the writing interface to process IO. (#2241)[https://github.com/opensearch-project/k-NN/pull/2241]
- Allow method parameter override for training based indices (#2290) https://github.com/opensearch-project/k-NN/pull/2290]
- Optimizes lucene query execution to prevent unnecessary rewrites (#2305)[https://github.com/opensearch-project/k-NN/pull/2305]
- Add check to directly use ANN Search when filters match all docs. (#2320)[https://github.com/opensearch-project/k-NN/pull/2320]
### Bug Fixes
* Fixing the bug when a segment has no vector field present for disk based vector search (#2282)[https://github.com/opensearch-project/k-NN/pull/2282]
* Fix for NPE while merging segments after all the vector fields docs are deleted (#2365)[https://github.com/opensearch-project/k-NN/pull/2365]
Expand All @@ -26,7 +33,12 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
* Fix filter rewrite logic which was resulting in getting inconsistent / incorrect results for cases where filter was getting rewritten for shards (#2359)[https://github.com/opensearch-project/k-NN/pull/2359]
* Fixing it to retrieve space_type from index setting when both method and top level don't have the value. [#2374](https://github.com/opensearch-project/k-NN/pull/2374)
### Infrastructure
* Updated C++ version in JNI from c++11 to c++17 [#2259](https://github.com/opensearch-project/k-NN/pull/2259)
* Upgrade bytebuddy and objenesis version to match OpenSearch core and, update github ci runner for macos [#2279](https://github.com/opensearch-project/k-NN/pull/2279)
### Documentation
### Maintenance
* Select index settings based on cluster version[2236](https://github.com/opensearch-project/k-NN/pull/2236)
* Added null checks for fieldInfo in ExactSearcher to avoid NPE while running exact search for segments with no vector field (#2278)[https://github.com/opensearch-project/k-NN/pull/2278]
* Upgrade jsonpath from 2.8.0 to 2.9.0[2325](https://github.com/opensearch-project/k-NN/pull/2325)
* Bump Faiss commit from 1f42e81 to 0cbc2a8 to accelerate hamming distance calculation using _mm512_popcnt_epi64 intrinsic and also add avx512-fp16 instructions to boost performance [#2381](https://github.com/opensearch-project/k-NN/pull/2381)
### Refactoring
2 changes: 1 addition & 1 deletion DEVELOPER_GUIDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -412,7 +412,7 @@ OR
./gradlew run --debug-jvm # to just start a cluster that can be debugged
```
The OpenSearch server JVM will connect to a debugger attached to `localhost:5005` before starting. If there are multiple nodes, the servers will connect to debuggers listening on ports `5005, 5006, ...`
The OpenSearch server JVM will connect to a debugger attached to `localhost:5005` before starting. If there are multiple nodes, the servers will connect to debuggers listening on ports `5005, 5006, ...`. A simple debugger configuration for IntelliJ is included in this project and can be found [here](https://github.com/opensearch-project/k-NN/tree/main/.idea/runConfigurations/Debug_OpenSearch.xml).
To debug code running in an integration test (which exercises the server from a separate JVM), first, setup a remote debugger listening on port `8000`, and then run:
Expand Down
3 changes: 3 additions & 0 deletions MAINTAINERS.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,15 @@ This document contains a list of maintainers in this repo. See [opensearch-proje

| Maintainer | GitHub ID | Affiliation |
|-------------------------|-------------------------------------------------------|-------------|
| Doo Yong Kim | [0ctopus13prime](https://github.com/0ctopus13prime) | Amazon |
| Heemin Kim | [heemin32](https://github.com/heemin32) | Amazon |
| Jack Mazanec | [jmazanec15](https://github.com/jmazanec15) | Amazon |
| Junqiu Lei | [junqiu-lei](https://github.com/junqiu-lei) | Amazon |
| Martin Gaievski | [martin-gaievski](https://github.com/martin-gaievski) | Amazon |
| Naveen Tatikonda | [naveentatikonda](https://github.com/naveentatikonda) | Amazon |
| Navneet Verma | [navneet1v](https://github.com/navneet1v) | Amazon |
| Ryan Bogan | [ryanbogan](https://github.com/ryanbogan) | Amazon |
| Tejas Shah | [shatejas](https://github.com/shatejas) | Amazon |
| Vamshi Vijay Nakkirtha | [vamshin](https://github.com/vamshin) | Amazon |
| Vijayan Balasubramanian | [VijayanB](https://github.com/VijayanB) | Amazon |
| Yuncheng Lu | [luyuncheng](https://github.com/luyuncheng) | Bytedance |
12 changes: 9 additions & 3 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ buildscript {
ext {
// build.version_qualifier parameter applies to knn plugin artifacts only. OpenSearch version must be set
// explicitly as 'opensearch.version' property, for instance opensearch.version=2.0.0-rc1-SNAPSHOT
opensearch_version = System.getProperty("opensearch.version", "2.18.0-SNAPSHOT")
opensearch_version = System.getProperty("opensearch.version", "2.19.0-SNAPSHOT")
version_qualifier = System.getProperty("build.version_qualifier", "")
opensearch_group = "org.opensearch"
isSnapshot = "true" == System.getProperty("build.snapshot", "true")
Expand Down Expand Up @@ -295,13 +295,19 @@ dependencies {
api group: 'com.google.guava', name: 'guava', version:'32.1.3-jre'
api group: 'commons-lang', name: 'commons-lang', version: '2.6'
testFixturesImplementation "org.opensearch.test:framework:${opensearch_version}"
testImplementation group: 'net.bytebuddy', name: 'byte-buddy', version: '1.15.4'
testImplementation group: 'org.objenesis', name: 'objenesis', version: '3.2'
testImplementation group: 'net.bytebuddy', name: 'byte-buddy', version: '1.15.10'
testImplementation group: 'org.objenesis', name: 'objenesis', version: '3.3'
testImplementation group: 'net.bytebuddy', name: 'byte-buddy-agent', version: '1.15.4'
// json-path 2.9.0 depends on slf4j 2.0.11, which conflicts with the version used by OpenSearch core.
// Excluding slf4j here since json-path is only used for testing, and logging failures in this context are acceptable.
testFixturesImplementation('com.jayway.jsonpath:json-path:2.9.0') {
exclude group: 'org.slf4j', module: 'slf4j-api'
}
testFixturesImplementation "org.opensearch:common-utils:${version}"
implementation 'com.github.oshi:oshi-core:6.4.13'
api "net.java.dev.jna:jna:5.13.0"
api "net.java.dev.jna:jna-platform:5.13.0"
// OpenSearch core is using slf4j 1.7.36. Therefore, we cannot change the version here.
implementation 'org.slf4j:slf4j-api:1.7.36'

zipArchive group: 'org.opensearch.plugin', name:'opensearch-security', version: "${opensearch_build}"
Expand Down
2 changes: 1 addition & 1 deletion jni/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ set(TARGET_LIB_NMSLIB opensearchknn_nmslib) # nmslib JNI
set(TARGET_LIB_FAISS opensearchknn_faiss) # faiss JNI
set(TARGET_LIBS "") # Libs to be installed

set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED True)
option(CONFIG_FAISS "Configure faiss library build when this is on")
option(CONFIG_NMSLIB "Configure nmslib library build when this is on")
Expand Down
1 change: 1 addition & 0 deletions jni/cmake/init-nmslib.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ if(NOT DEFINED APPLY_LIB_PATCHES OR "${APPLY_LIB_PATCHES}" STREQUAL true)
list(APPEND PATCH_FILE_LIST "${CMAKE_CURRENT_SOURCE_DIR}/patches/nmslib/0001-Initialize-maxlevel-during-add-from-enterpoint-level.patch")
list(APPEND PATCH_FILE_LIST "${CMAKE_CURRENT_SOURCE_DIR}/patches/nmslib/0002-Adds-ability-to-pass-ef-parameter-in-the-query-for-h.patch")
list(APPEND PATCH_FILE_LIST "${CMAKE_CURRENT_SOURCE_DIR}/patches/nmslib/0003-Added-streaming-apis-for-vector-index-loading-in-Hnsw.patch")
list(APPEND PATCH_FILE_LIST "${CMAKE_CURRENT_SOURCE_DIR}/patches/nmslib/0004-Added-a-new-save-apis-in-Hnsw-with-streaming-interfa.patch")

# Get patch id of the last commit
execute_process(COMMAND sh -c "git --no-pager show HEAD | git patch-id --stable" OUTPUT_VARIABLE PATCH_ID_OUTPUT_FROM_COMMIT WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/external/nmslib)
Expand Down
2 changes: 1 addition & 1 deletion jni/external/faiss
Submodule faiss updated 738 files
6 changes: 6 additions & 0 deletions jni/include/commons.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@
* Modifications Copyright OpenSearch Contributors. See
* GitHub history for details.
*/

#ifndef OPENSEARCH_KNN_COMMONS_H
#define OPENSEARCH_KNN_COMMONS_H

#include "jni_util.h"
#include <jni.h>
namespace knn_jni {
Expand Down Expand Up @@ -99,3 +103,5 @@ namespace knn_jni {
int getIntegerMethodParameter(JNIEnv *, knn_jni::JNIUtilInterface *, std::unordered_map<std::string, jobject>, std::string, int);
}
}

#endif
Loading

0 comments on commit 09a336d

Please sign in to comment.