Merge branch 'main' into invalid-driver

This commit is contained in:
workdone0 2024-04-24 19:55:03 +05:30
commit 7656b2518d
2970 changed files with 46622 additions and 1966 deletions

View File

@ -566,6 +566,27 @@
"test", "test",
"userTesting" "userTesting"
] ]
},
{
"login": "sahankj2000",
"name": "sahankj2000",
"avatar_url": "https://avatars.githubusercontent.com/u/55505318?v=4",
"profile": "https://github.com/sahankj2000",
"contributions": [
"code",
"userTesting"
]
},
{
"login": "stheodosius-sky",
"name": "Simon Theodosius",
"avatar_url": "https://avatars.githubusercontent.com/u/110117464?v=4",
"profile": "https://github.com/stheodosius-sky",
"contributions": [
"design",
"example",
"ideas"
]
} }
], ],
"commitType": "docs" "commitType": "docs"

13
.github/dependabot.yml vendored Normal file
View File

@ -0,0 +1,13 @@
# Set update schedule for GitHub Actions
version: 2
updates:
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "monthly"
- package-ecosystem: "docker"
directory: "/"
schedule:
interval: "monthly"

View File

@ -26,7 +26,7 @@ jobs:
java-version: '21' java-version: '21'
- name: Cache Maven packages - name: Cache Maven packages
uses: actions/cache@v3 uses: actions/cache@v4
with: with:
path: ~/.m2 path: ~/.m2
key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }} key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }}

View File

@ -1,80 +0,0 @@
# For most projects, this workflow file will not need changing; you simply need
# to commit it to your repository.
#
# You may wish to alter this file to override the set of languages analyzed,
# or to provide custom queries or build logic.
#
# ******** NOTE ********
# We have attempted to detect the languages in your repository. Please check
# the `language` matrix defined below to confirm you have the correct set of
# supported CodeQL languages.
#
name: "CodeQL"
on:
push:
branches: [ main ]
tags:
- "![0-9]+.[0-9]+.[0-9]+-preview"
- "![0-9]+.[0-9]+.[0-9]+-release"
pull_request:
# The branches below must be a subset of the branches above
branches: [ main ]
schedule:
- cron: '40 21 * * 3'
jobs:
analyze:
name: Analyze
runs-on: ubuntu-20.04
permissions:
actions: read
contents: read
security-events: write
strategy:
fail-fast: false
matrix:
language: [ 'java', 'javascript' ]
# CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python', 'ruby' ]
# Learn more about CodeQL language support at https://git.io/codeql-language-support
steps:
- uses: actions/setup-java@v3
with:
distribution: 'oracle'
java-version: '21'
- name: Checkout repository
uses: actions/checkout@v3
# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v2
with:
languages: ${{ matrix.language }}
# If you wish to specify custom queries, you can do so here or in a config file.
# By default, queries listed here will override any specified in a config file.
# Prefix the list here with "+" to use these queries and those in the config file.
# queries: ./path/to/local/query, your-org/your-repo/queries@main
# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
# If this step fails, then you should remove it and run the build manually (see below)
- name: Autobuild
uses: github/codeql-action/autobuild@v2
# Command-line programs to run using the OS shell.
# 📚 https://git.io/JvXDl
# ✏️ If the Autobuild fails above, remove it and uncomment the following three lines
# and modify them (or add more) to build your code if your project
# uses a compiled language
#- run: |
# make bootstrap
# make release
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v2

View File

@ -22,10 +22,10 @@ jobs:
steps: steps:
- name: checkout repo - name: checkout repo
uses: actions/checkout@v3 uses: actions/checkout@v4
- name: setup java - name: setup java
uses: actions/setup-java@v3 uses: actions/setup-java@v4
with: with:
distribution: 'oracle' distribution: 'oracle'
java-version: '21' java-version: '21'
@ -47,7 +47,7 @@ jobs:
df -h df -h
- name: Cache Maven packages - name: Cache Maven packages
uses: actions/cache@v3.2.3 uses: actions/cache@v4
with: with:
path: ~/.m2 path: ~/.m2
key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }} key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }}
@ -70,16 +70,16 @@ jobs:
mvn clean verify -Drevision="${{ env.PREVIEW_VERSION }}" mvn clean verify -Drevision="${{ env.PREVIEW_VERSION }}"
- name: Setup docker buildx - name: Setup docker buildx
uses: docker/setup-buildx-action@v2.2.1 uses: docker/setup-buildx-action@v3
- name: docker hub login - name: docker hub login
uses: docker/login-action@v2.1.0 uses: docker/login-action@v3
with: with:
username: ${{ secrets.DOCKER_USERNAME }} username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }} password: ${{ secrets.DOCKER_PASSWORD }}
- name: docker test build - name: docker test build
uses: docker/build-push-action@v3.3.0 uses: docker/build-push-action@v5.3.0
with: with:
context: . context: .
file: Dockerfile file: Dockerfile
@ -100,7 +100,7 @@ jobs:
cp nb5/target/nb5.jar nb5/target/nb5 staging cp nb5/target/nb5.jar nb5/target/nb5 staging
- name: upload artifacts - name: upload artifacts
uses: actions/upload-artifact@v1 uses: actions/upload-artifact@v4
with: with:
name: binaries name: binaries
path: staging path: staging
@ -130,7 +130,7 @@ jobs:
scripts/bump-minor-version scripts/bump-minor-version
- name: docker push to hub - name: docker push to hub
uses: docker/build-push-action@v3.3.0 uses: docker/build-push-action@v5.3.0
with: with:
context: . context: .
platforms: linux/amd64,linux/arm64 platforms: linux/amd64,linux/arm64
@ -141,7 +141,7 @@ jobs:
# https://github.com/softprops/action-gh-release # https://github.com/softprops/action-gh-release
- name: create github release - name: create github release
uses: softprops/action-gh-release@v0.1.15 uses: softprops/action-gh-release@v2.0.4
if: startsWith(github.ref, 'refs/tags/') if: startsWith(github.ref, 'refs/tags/')
with: with:
# body: ${{ steps.prepare_summary.outputs.release_summary }} # body: ${{ steps.prepare_summary.outputs.release_summary }}

View File

@ -19,10 +19,10 @@ jobs:
steps: steps:
- name: checkout repo - name: checkout repo
uses: actions/checkout@v3 uses: actions/checkout@v4
- name: setup java - name: setup java
uses: actions/setup-java@v3 uses: actions/setup-java@v4
with: with:
distribution: 'oracle' distribution: 'oracle'
java-version: '21' java-version: '21'
@ -44,7 +44,7 @@ jobs:
df -h df -h
- name: Cache Maven packages - name: Cache Maven packages
uses: actions/cache@v3.2.3 uses: actions/cache@v4
with: with:
path: ~/.m2 path: ~/.m2
key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }} key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }}
@ -65,16 +65,16 @@ jobs:
mvn clean package -Drevision="${{ env.RELEASE_VERSION }}" -P enable-container-tests mvn clean package -Drevision="${{ env.RELEASE_VERSION }}" -P enable-container-tests
- name: Setup docker buildx - name: Setup docker buildx
uses: docker/setup-buildx-action@v2.2.1 uses: docker/setup-buildx-action@v3
- name: docker hub login - name: docker hub login
uses: docker/login-action@v2.1.0 uses: docker/login-action@v3
with: with:
username: ${{ secrets.DOCKER_USERNAME }} username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }} password: ${{ secrets.DOCKER_PASSWORD }}
- name: docker test build - name: docker test build
uses: docker/build-push-action@v4 uses: docker/build-push-action@v5.3.0
with: with:
context: . context: .
file: Dockerfile file: Dockerfile
@ -95,7 +95,7 @@ jobs:
cp nb5/target/nb5.jar nb5/target/nb5 staging cp nb5/target/nb5.jar nb5/target/nb5 staging
- name: upload artifacts - name: upload artifacts
uses: actions/upload-artifact@v1 uses: actions/upload-artifact@v4
with: with:
name: binaries name: binaries
path: staging path: staging
@ -105,7 +105,7 @@ jobs:
# continue-on-error: false # continue-on-error: false
# #
# - name: upload javadoc # - name: upload javadoc
# uses: actions/upload-artifact@v3 # uses: actions/upload-artifact@v4
# with: # with:
# name: javadoc # name: javadoc
# path: target/nosqlbench-*-javadoc.jar # path: target/nosqlbench-*-javadoc.jar
@ -115,7 +115,7 @@ jobs:
scripts/bump-minor-version scripts/bump-minor-version
- name: docker push to hub - name: docker push to hub
uses: docker/build-push-action@v3.3.0 uses: docker/build-push-action@v5.3.0
with: with:
context: . context: .
platforms: linux/amd64,linux/arm64 platforms: linux/amd64,linux/arm64
@ -126,7 +126,7 @@ jobs:
# https://github.com/softprops/action-gh-release # https://github.com/softprops/action-gh-release
- name: create github release - name: create github release
uses: softprops/action-gh-release@v0.1.15 uses: softprops/action-gh-release@v2.0.4
if: startsWith(github.ref, 'refs/tags/') if: startsWith(github.ref, 'refs/tags/')
with: with:
# body: ${{ steps.prepare_summary.outputs.release_summary }} # body: ${{ steps.prepare_summary.outputs.release_summary }}
@ -178,7 +178,7 @@ jobs:
- name: Archive Test Results - name: Archive Test Results
if: always() if: always()
uses: actions/upload-artifact@v3 uses: actions/upload-artifact@v4
with: with:
name: test-results name: test-results
path: | path: |
@ -193,7 +193,7 @@ jobs:
# - name: set git email # - name: set git email
# run: git config --global user.name "${{ secrets.NBDROID_NAME }}" # run: git config --global user.name "${{ secrets.NBDROID_NAME }}"
# - name: download javadocs # - name: download javadocs
# uses: actions/download-artifact@v3 # uses: actions/download-artifact@v4
# with: # with:
# name: javadoc # name: javadoc
# - run: ls -la # - run: ls -la

2
.gitignore vendored
View File

@ -1,7 +1,9 @@
**/cache/**
exported_docs.zip exported_docs.zip
.nosqlbench/** .nosqlbench/**
workspaces/** workspaces/**
workshop/** workshop/**
local*
local/** local/**
metrics/** metrics/**
bin/** bin/**

View File

@ -0,0 +1,14 @@
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="await_index local" type="JarApplication" folderName="milvus_vectors local">
<extension name="software.aws.toolkits.jetbrains.core.execution.JavaAwsConnectionExtension">
<option name="credential" />
<option name="region" />
<option name="useCurrentConnection" value="false" />
</extension>
<option name="JAR_PATH" value="$PROJECT_DIR$/nb5/target/nb5.jar" />
<option name="PROGRAM_PARAMETERS" value="milvus_vector_live index.await_index dataset=&quot;vector/ANN/glove-25-angular/glove-25-angular&quot; milvushost=localhost --show-stacktraces --progress console:1s -v" />
<option name="WORKING_DIRECTORY" value="$PROJECT_DIR$/local/milvus" />
<option name="ALTERNATIVE_JRE_PATH" />
<method v="2" />
</configuration>
</component>

View File

@ -11,4 +11,4 @@
<option name="ALTERNATIVE_JRE_PATH" value="jdk21" /> <option name="ALTERNATIVE_JRE_PATH" value="jdk21" />
<method v="2" /> <method v="2" />
</configuration> </configuration>
</component> </component>

14
.run/drop local.run.xml Normal file
View File

@ -0,0 +1,14 @@
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="drop local" type="JarApplication" folderName="milvus_vectors local">
<extension name="software.aws.toolkits.jetbrains.core.execution.JavaAwsConnectionExtension">
<option name="credential" />
<option name="region" />
<option name="useCurrentConnection" value="false" />
</extension>
<option name="JAR_PATH" value="$PROJECT_DIR$/nb5/target/nb5.jar" />
<option name="PROGRAM_PARAMETERS" value="milvus_vector_live milvus_vectors.drop milvushost=localhost --show-stacktraces --progress console:1s -v" />
<option name="WORKING_DIRECTORY" value="$PROJECT_DIR$/local/milvus" />
<option name="ALTERNATIVE_JRE_PATH" />
<method v="2" />
</configuration>
</component>

View File

@ -0,0 +1,14 @@
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="load_collection local" type="JarApplication" folderName="milvus_vectors local">
<extension name="software.aws.toolkits.jetbrains.core.execution.JavaAwsConnectionExtension">
<option name="credential" />
<option name="region" />
<option name="useCurrentConnection" value="false" />
</extension>
<option name="JAR_PATH" value="$PROJECT_DIR$/nb5/target/nb5.jar" />
<option name="PROGRAM_PARAMETERS" value="milvus_vector_live milvus_vectors.load_collection milvushost=localhost --show-stacktraces --progress console:1s -v" />
<option name="WORKING_DIRECTORY" value="$PROJECT_DIR$/local/milvus" />
<option name="ALTERNATIVE_JRE_PATH" />
<method v="2" />
</configuration>
</component>

View File

@ -0,0 +1,14 @@
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="milvus drop localhost" type="JarApplication" folderName="Milvus">
<extension name="software.aws.toolkits.jetbrains.core.execution.JavaAwsConnectionExtension">
<option name="credential" />
<option name="region" />
<option name="useCurrentConnection" value="false" />
</extension>
<option name="JAR_PATH" value="$PROJECT_DIR$/nb5/target/nb5.jar" />
<option name="PROGRAM_PARAMETERS" value="milvus default.drop milvushost=localhost --show-stacktraces --progress console:1s -v" />
<option name="WORKING_DIRECTORY" value="$PROJECT_DIR$/local/milvus" />
<option name="ALTERNATIVE_JRE_PATH" />
<method v="2" />
</configuration>
</component>

View File

@ -0,0 +1,14 @@
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="milvus drop on aws" type="JarApplication" folderName="Milvus">
<extension name="software.aws.toolkits.jetbrains.core.execution.JavaAwsConnectionExtension">
<option name="credential" />
<option name="region" />
<option name="useCurrentConnection" value="false" />
</extension>
<option name="JAR_PATH" value="$PROJECT_DIR$/nb5/target/nb5.jar" />
<option name="PROGRAM_PARAMETERS" value="milvus default.drop milvushost=milvushost --show-stacktraces --progress console:1s -v" />
<option name="WORKING_DIRECTORY" value="$PROJECT_DIR$/local/milvus" />
<option name="ALTERNATIVE_JRE_PATH" />
<method v="2" />
</configuration>
</component>

View File

@ -0,0 +1,14 @@
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="milvus rampup localhost smoketest " type="JarApplication" folderName="Milvus">
<extension name="software.aws.toolkits.jetbrains.core.execution.JavaAwsConnectionExtension">
<option name="credential" />
<option name="region" />
<option name="useCurrentConnection" value="false" />
</extension>
<option name="JAR_PATH" value="$PROJECT_DIR$/nb5/target/nb5.jar" />
<option name="PROGRAM_PARAMETERS" value="milvus default.rampup rampup_threads=1 milvushost=localhost datafile=&quot;vector/ANN/glove-25-angular/glove-25-angular&quot; --show-stacktraces --progress console:1s -v" />
<option name="WORKING_DIRECTORY" value="$PROJECT_DIR$/local/milvus" />
<option name="ALTERNATIVE_JRE_PATH" />
<method v="2" />
</configuration>
</component>

View File

@ -0,0 +1,14 @@
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="milvus schema localhost" type="JarApplication" folderName="Milvus">
<extension name="software.aws.toolkits.jetbrains.core.execution.JavaAwsConnectionExtension">
<option name="credential" />
<option name="region" />
<option name="useCurrentConnection" value="false" />
</extension>
<option name="JAR_PATH" value="$PROJECT_DIR$/nb5/target/nb5.jar" />
<option name="PROGRAM_PARAMETERS" value="milvus default.schema milvushost=localhost --show-stacktraces --progress console:1s -v" />
<option name="WORKING_DIRECTORY" value="$PROJECT_DIR$/local/milvus" />
<option name="ALTERNATIVE_JRE_PATH" />
<method v="2" />
</configuration>
</component>

View File

@ -0,0 +1,14 @@
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="milvus schema on aws" type="JarApplication" folderName="Milvus">
<extension name="software.aws.toolkits.jetbrains.core.execution.JavaAwsConnectionExtension">
<option name="credential" />
<option name="region" />
<option name="useCurrentConnection" value="false" />
</extension>
<option name="JAR_PATH" value="$PROJECT_DIR$/nb5/target/nb5.jar" />
<option name="PROGRAM_PARAMETERS" value="milvus default.schema milvushost=milvushost --show-stacktraces --progress console:1s -v" />
<option name="WORKING_DIRECTORY" value="$PROJECT_DIR$/local/milvus" />
<option name="ALTERNATIVE_JRE_PATH" />
<method v="2" />
</configuration>
</component>

View File

@ -0,0 +1,14 @@
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="milvus_vector2__drop__glove_25" type="JarApplication" folderName="Milvus">
<extension name="software.aws.toolkits.jetbrains.core.execution.JavaAwsConnectionExtension">
<option name="credential" />
<option name="region" />
<option name="useCurrentConnection" value="false" />
</extension>
<option name="JAR_PATH" value="$PROJECT_DIR$/nb5/target/nb5.jar" />
<option name="PROGRAM_PARAMETERS" value="milvus default.drop --show-stacktraces dimensions=25 testsize=10000 trainsize=100000 datafile=glove-25-angular filetype=hdf5 collection=glove_25 similarity_function=cosine --progress console:1s -v --add-labels &quot;dimensions:25,dataset=glove-25&quot;" />
<option name="WORKING_DIRECTORY" value="$ProjectFileDir$/local/milvus" />
<option name="ALTERNATIVE_JRE_PATH" value="jdk21" />
<method v="2" />
</configuration>
</component>

View File

@ -0,0 +1,50 @@
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="nosqlbench [clean,compile,package...]" type="MavenRunConfiguration" factoryName="Maven" nameIsGenerated="true">
<MavenSettings>
<option name="myGeneralSettings" />
<option name="myRunnerSettings">
<MavenRunnerSettings>
<option name="delegateBuildToMaven" value="false" />
<option name="environmentProperties">
<map />
</option>
<option name="jreName" value="#USE_PROJECT_JDK" />
<option name="mavenProperties">
<map />
</option>
<option name="passParentEnv" value="true" />
<option name="runMavenInBackground" value="true" />
<option name="skipTests" value="false" />
<option name="vmOptions" value="" />
</MavenRunnerSettings>
</option>
<option name="myRunnerParameters">
<MavenRunnerParameters>
<option name="cmdOptions" />
<option name="profiles">
<set />
</option>
<option name="goals">
<list>
<option value="clean" />
<option value="compile" />
<option value="package" />
<option value="-DskipTests" />
</list>
</option>
<option name="multimoduleDir" />
<option name="pomFileName" />
<option name="profilesMap">
<map />
</option>
<option name="projectsCmdOptionValues">
<list />
</option>
<option name="resolveToWorkspace" value="false" />
<option name="workingDirPath" value="$PROJECT_DIR$" />
</MavenRunnerParameters>
</option>
</MavenSettings>
<method v="2" />
</configuration>
</component>

View File

@ -0,0 +1,33 @@
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="nosqlbench [clean,install]" type="MavenRunConfiguration" factoryName="Maven" nameIsGenerated="true">
<MavenSettings>
<option name="myGeneralSettings" />
<option name="myRunnerSettings" />
<option name="myRunnerParameters">
<MavenRunnerParameters>
<option name="cmdOptions" />
<option name="profiles">
<set />
</option>
<option name="goals">
<list>
<option value="clean" />
<option value="install" />
</list>
</option>
<option name="multimoduleDir" />
<option name="pomFileName" />
<option name="profilesMap">
<map />
</option>
<option name="projectsCmdOptionValues">
<list />
</option>
<option name="resolveToWorkspace" value="false" />
<option name="workingDirPath" value="$PROJECT_DIR$" />
</MavenRunnerParameters>
</option>
</MavenSettings>
<method v="2" />
</configuration>
</component>

View File

@ -0,0 +1,34 @@
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="nosqlbench [clean,package,--debug]" type="MavenRunConfiguration" factoryName="Maven" nameIsGenerated="true">
<MavenSettings>
<option name="myGeneralSettings" />
<option name="myRunnerSettings" />
<option name="myRunnerParameters">
<MavenRunnerParameters>
<option name="cmdOptions" />
<option name="profiles">
<set />
</option>
<option name="goals">
<list>
<option value="clean" />
<option value="package" />
<option value="--debug" />
</list>
</option>
<option name="multimoduleDir" />
<option name="pomFileName" />
<option name="profilesMap">
<map />
</option>
<option name="projectsCmdOptionValues">
<list />
</option>
<option name="resolveToWorkspace" value="false" />
<option name="workingDirPath" value="$PROJECT_DIR$" />
</MavenRunnerParameters>
</option>
</MavenSettings>
<method v="2" />
</configuration>
</component>

14
.run/rampup local.run.xml Normal file
View File

@ -0,0 +1,14 @@
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="rampup local" type="JarApplication" folderName="milvus_vectors local">
<extension name="software.aws.toolkits.jetbrains.core.execution.JavaAwsConnectionExtension">
<option name="credential" />
<option name="region" />
<option name="useCurrentConnection" value="false" />
</extension>
<option name="JAR_PATH" value="$PROJECT_DIR$/nb5/target/nb5.jar" />
<option name="PROGRAM_PARAMETERS" value="milvus_vector_live rampup dataset=&quot;vector/ANN/glove-25-angular/glove-25-angular&quot; rampup_threads=1 rampup_cycles=1183600 milvushost=localhost --show-stacktraces --progress console:1s -v" />
<option name="WORKING_DIRECTORY" value="$PROJECT_DIR$/local/milvus" />
<option name="ALTERNATIVE_JRE_PATH" />
<method v="2" />
</configuration>
</component>

View File

@ -0,0 +1,14 @@
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="rampup_batch 100x local" type="JarApplication" folderName="milvus_vectors local">
<extension name="software.aws.toolkits.jetbrains.core.execution.JavaAwsConnectionExtension">
<option name="credential" />
<option name="region" />
<option name="useCurrentConnection" value="false" />
</extension>
<option name="JAR_PATH" value="$PROJECT_DIR$/nb5/target/nb5.jar" />
<option name="PROGRAM_PARAMETERS" value="milvus_vector_live milvus_vectors.rampup_batch dataset=&quot;vector/ANN/glove-25-angular/glove-25-angular&quot; batch_size=100 rampup_threads=10 rampup_cycles=11836 milvushost=localhost --show-stacktraces --progress console:1s -v" />
<option name="WORKING_DIRECTORY" value="$PROJECT_DIR$/local/milvus" />
<option name="ALTERNATIVE_JRE_PATH" />
<method v="2" />
</configuration>
</component>

View File

@ -0,0 +1,14 @@
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="rampup_batch 2x local" type="JarApplication" folderName="milvus_vectors local">
<extension name="software.aws.toolkits.jetbrains.core.execution.JavaAwsConnectionExtension">
<option name="credential" />
<option name="region" />
<option name="useCurrentConnection" value="false" />
</extension>
<option name="JAR_PATH" value="$PROJECT_DIR$/nb5/target/nb5.jar" />
<option name="PROGRAM_PARAMETERS" value="milvus_vector_live milvus_vectors.rampup_batch dataset=&quot;vector/ANN/glove-25-angular/glove-25-angular&quot; batch_size=2 rampup_threads=1 rampup_cycles=600000 milvushost=localhost --show-stacktraces --progress console:1s -v" />
<option name="WORKING_DIRECTORY" value="$PROJECT_DIR$/local/milvus" />
<option name="ALTERNATIVE_JRE_PATH" />
<method v="2" />
</configuration>
</component>

14
.run/schema local.run.xml Normal file
View File

@ -0,0 +1,14 @@
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="schema local" type="JarApplication" folderName="milvus_vectors local">
<extension name="software.aws.toolkits.jetbrains.core.execution.JavaAwsConnectionExtension">
<option name="credential" />
<option name="region" />
<option name="useCurrentConnection" value="false" />
</extension>
<option name="JAR_PATH" value="$PROJECT_DIR$/nb5/target/nb5.jar" />
<option name="PROGRAM_PARAMETERS" value="milvus_vector_live milvus_vectors.schema milvushost=localhost --show-stacktraces --progress console:1s -v" />
<option name="WORKING_DIRECTORY" value="$PROJECT_DIR$/local/milvus" />
<option name="ALTERNATIVE_JRE_PATH" />
<method v="2" />
</configuration>
</component>

View File

@ -0,0 +1,14 @@
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="schema_index local" type="JarApplication" folderName="milvus_vectors local">
<extension name="software.aws.toolkits.jetbrains.core.execution.JavaAwsConnectionExtension">
<option name="credential" />
<option name="region" />
<option name="useCurrentConnection" value="false" />
</extension>
<option name="JAR_PATH" value="$PROJECT_DIR$/nb5/target/nb5.jar" />
<option name="PROGRAM_PARAMETERS" value="milvus_vector_live milvus_vectors.schema_index milvushost=localhost --show-stacktraces --progress console:1s -v" />
<option name="WORKING_DIRECTORY" value="$PROJECT_DIR$/local/milvus" />
<option name="ALTERNATIVE_JRE_PATH" />
<method v="2" />
</configuration>
</component>

View File

@ -0,0 +1,14 @@
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="search_and_verify threads=1 local" type="JarApplication" folderName="milvus_vectors local">
<extension name="software.aws.toolkits.jetbrains.core.execution.JavaAwsConnectionExtension">
<option name="credential" />
<option name="region" />
<option name="useCurrentConnection" value="false" />
</extension>
<option name="JAR_PATH" value="$PROJECT_DIR$/nb5/target/nb5.jar" />
<option name="PROGRAM_PARAMETERS" value="milvus_vector_live milvus_vectors.search_and_verify dataset=&quot;vector/ANN/glove-25-angular/glove-25-angular&quot; search_threads=1 search_cycles=100k milvushost=localhost --show-stacktraces --progress console:1s -v" />
<option name="WORKING_DIRECTORY" value="$PROJECT_DIR$/local/milvus" />
<option name="ALTERNATIVE_JRE_PATH" />
<method v="2" />
</configuration>
</component>

View File

@ -0,0 +1,14 @@
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="search_and_verify threads=100 local" type="JarApplication" folderName="milvus_vectors local">
<extension name="software.aws.toolkits.jetbrains.core.execution.JavaAwsConnectionExtension">
<option name="credential" />
<option name="region" />
<option name="useCurrentConnection" value="false" />
</extension>
<option name="JAR_PATH" value="$PROJECT_DIR$/nb5/target/nb5.jar" />
<option name="PROGRAM_PARAMETERS" value="milvus_vector_live milvus_vectors.search_and_verify dataset=&quot;vector/ANN/glove-25-angular/glove-25-angular&quot; search_threads=100 search_cycles=100k milvushost=localhost --show-stacktraces --progress console:1s -v" />
<option name="WORKING_DIRECTORY" value="$PROJECT_DIR$/local/milvus" />
<option name="ALTERNATIVE_JRE_PATH" />
<method v="2" />
</configuration>
</component>

View File

@ -12,4 +12,4 @@
<option name="ALTERNATIVE_JRE_PATH" value="17" /> <option name="ALTERNATIVE_JRE_PATH" value="17" />
<method v="2" /> <method v="2" />
</configuration> </configuration>
</component> </component>

View File

@ -180,6 +180,10 @@ For recognizing contributions, please follow [this documentation](https://allcon
<td align="center" valign="top" width="16.66%"><a href="https://github.com/ShaunakDas88"><img src="https://avatars.githubusercontent.com/u/11130580?v=4?s=50" width="50px;" alt="Shaunak Das"/><br /><sub><b>Shaunak Das</b></sub></a><br /><a href="https://github.com/nosqlbench/nosqlbench/issues?q=author%3AShaunakDas88" title="Bug reports">🐛</a> <a href="#business-ShaunakDas88" title="Business development">💼</a> <a href="https://github.com/nosqlbench/nosqlbench/commits?author=ShaunakDas88" title="Code">💻</a> <a href="#content-ShaunakDas88" title="Content">🖋</a> <a href="#data-ShaunakDas88" title="Data">🔣</a> <a href="https://github.com/nosqlbench/nosqlbench/commits?author=ShaunakDas88" title="Documentation">📖</a> <a href="#design-ShaunakDas88" title="Design">🎨</a> <a href="#example-ShaunakDas88" title="Examples">💡</a> <a href="#ideas-ShaunakDas88" title="Ideas, Planning, & Feedback">🤔</a> <a href="#infra-ShaunakDas88" title="Infrastructure (Hosting, Build-Tools, etc)">🚇</a> <a href="#maintenance-ShaunakDas88" title="Maintenance">🚧</a> <a href="#mentoring-ShaunakDas88" title="Mentoring">🧑‍🏫</a> <a href="#platform-ShaunakDas88" title="Packaging/porting to new platform">📦</a> <a href="#plugin-ShaunakDas88" title="Plugin/utility libraries">🔌</a> <a href="#projectManagement-ShaunakDas88" title="Project Management">📆</a> <a href="#research-ShaunakDas88" title="Research">🔬</a> <a href="https://github.com/nosqlbench/nosqlbench/pulls?q=is%3Apr+reviewed-by%3AShaunakDas88" title="Reviewed Pull Requests">👀</a> <a href="#security-ShaunakDas88" title="Security">🛡️</a> <a href="#tool-ShaunakDas88" title="Tools">🔧</a> <a href="https://github.com/nosqlbench/nosqlbench/commits?author=ShaunakDas88" title="Tests">⚠️</a> <a href="#userTesting-ShaunakDas88" title="User Testing">📓</a></td> <td align="center" valign="top" width="16.66%"><a href="https://github.com/ShaunakDas88"><img src="https://avatars.githubusercontent.com/u/11130580?v=4?s=50" width="50px;" alt="Shaunak Das"/><br /><sub><b>Shaunak Das</b></sub></a><br /><a href="https://github.com/nosqlbench/nosqlbench/issues?q=author%3AShaunakDas88" title="Bug reports">🐛</a> <a href="#business-ShaunakDas88" title="Business development">💼</a> <a href="https://github.com/nosqlbench/nosqlbench/commits?author=ShaunakDas88" title="Code">💻</a> <a href="#content-ShaunakDas88" title="Content">🖋</a> <a href="#data-ShaunakDas88" title="Data">🔣</a> <a href="https://github.com/nosqlbench/nosqlbench/commits?author=ShaunakDas88" title="Documentation">📖</a> <a href="#design-ShaunakDas88" title="Design">🎨</a> <a href="#example-ShaunakDas88" title="Examples">💡</a> <a href="#ideas-ShaunakDas88" title="Ideas, Planning, & Feedback">🤔</a> <a href="#infra-ShaunakDas88" title="Infrastructure (Hosting, Build-Tools, etc)">🚇</a> <a href="#maintenance-ShaunakDas88" title="Maintenance">🚧</a> <a href="#mentoring-ShaunakDas88" title="Mentoring">🧑‍🏫</a> <a href="#platform-ShaunakDas88" title="Packaging/porting to new platform">📦</a> <a href="#plugin-ShaunakDas88" title="Plugin/utility libraries">🔌</a> <a href="#projectManagement-ShaunakDas88" title="Project Management">📆</a> <a href="#research-ShaunakDas88" title="Research">🔬</a> <a href="https://github.com/nosqlbench/nosqlbench/pulls?q=is%3Apr+reviewed-by%3AShaunakDas88" title="Reviewed Pull Requests">👀</a> <a href="#security-ShaunakDas88" title="Security">🛡️</a> <a href="#tool-ShaunakDas88" title="Tools">🔧</a> <a href="https://github.com/nosqlbench/nosqlbench/commits?author=ShaunakDas88" title="Tests">⚠️</a> <a href="#userTesting-ShaunakDas88" title="User Testing">📓</a></td>
<td align="center" valign="top" width="16.66%"><a href="https://github.com/MarkWolters"><img src="https://avatars.githubusercontent.com/u/24706027?v=4?s=50" width="50px;" alt="Mark Wolters"/><br /><sub><b>Mark Wolters</b></sub></a><br /><a href="https://github.com/nosqlbench/nosqlbench/issues?q=author%3AMarkWolters" title="Bug reports">🐛</a> <a href="#business-MarkWolters" title="Business development">💼</a> <a href="https://github.com/nosqlbench/nosqlbench/commits?author=MarkWolters" title="Code">💻</a> <a href="#content-MarkWolters" title="Content">🖋</a> <a href="#data-MarkWolters" title="Data">🔣</a> <a href="https://github.com/nosqlbench/nosqlbench/commits?author=MarkWolters" title="Documentation">📖</a> <a href="#design-MarkWolters" title="Design">🎨</a> <a href="#example-MarkWolters" title="Examples">💡</a> <a href="#ideas-MarkWolters" title="Ideas, Planning, & Feedback">🤔</a> <a href="#infra-MarkWolters" title="Infrastructure (Hosting, Build-Tools, etc)">🚇</a> <a href="#maintenance-MarkWolters" title="Maintenance">🚧</a> <a href="#mentoring-MarkWolters" title="Mentoring">🧑‍🏫</a> <a href="#platform-MarkWolters" title="Packaging/porting to new platform">📦</a> <a href="#plugin-MarkWolters" title="Plugin/utility libraries">🔌</a> <a href="#projectManagement-MarkWolters" title="Project Management">📆</a> <a href="#research-MarkWolters" title="Research">🔬</a> <a href="https://github.com/nosqlbench/nosqlbench/pulls?q=is%3Apr+reviewed-by%3AMarkWolters" title="Reviewed Pull Requests">👀</a> <a href="#security-MarkWolters" title="Security">🛡️</a> <a href="#tool-MarkWolters" title="Tools">🔧</a> <a href="https://github.com/nosqlbench/nosqlbench/commits?author=MarkWolters" title="Tests">⚠️</a> <a href="#userTesting-MarkWolters" title="User Testing">📓</a></td> <td align="center" valign="top" width="16.66%"><a href="https://github.com/MarkWolters"><img src="https://avatars.githubusercontent.com/u/24706027?v=4?s=50" width="50px;" alt="Mark Wolters"/><br /><sub><b>Mark Wolters</b></sub></a><br /><a href="https://github.com/nosqlbench/nosqlbench/issues?q=author%3AMarkWolters" title="Bug reports">🐛</a> <a href="#business-MarkWolters" title="Business development">💼</a> <a href="https://github.com/nosqlbench/nosqlbench/commits?author=MarkWolters" title="Code">💻</a> <a href="#content-MarkWolters" title="Content">🖋</a> <a href="#data-MarkWolters" title="Data">🔣</a> <a href="https://github.com/nosqlbench/nosqlbench/commits?author=MarkWolters" title="Documentation">📖</a> <a href="#design-MarkWolters" title="Design">🎨</a> <a href="#example-MarkWolters" title="Examples">💡</a> <a href="#ideas-MarkWolters" title="Ideas, Planning, & Feedback">🤔</a> <a href="#infra-MarkWolters" title="Infrastructure (Hosting, Build-Tools, etc)">🚇</a> <a href="#maintenance-MarkWolters" title="Maintenance">🚧</a> <a href="#mentoring-MarkWolters" title="Mentoring">🧑‍🏫</a> <a href="#platform-MarkWolters" title="Packaging/porting to new platform">📦</a> <a href="#plugin-MarkWolters" title="Plugin/utility libraries">🔌</a> <a href="#projectManagement-MarkWolters" title="Project Management">📆</a> <a href="#research-MarkWolters" title="Research">🔬</a> <a href="https://github.com/nosqlbench/nosqlbench/pulls?q=is%3Apr+reviewed-by%3AMarkWolters" title="Reviewed Pull Requests">👀</a> <a href="#security-MarkWolters" title="Security">🛡️</a> <a href="#tool-MarkWolters" title="Tools">🔧</a> <a href="https://github.com/nosqlbench/nosqlbench/commits?author=MarkWolters" title="Tests">⚠️</a> <a href="#userTesting-MarkWolters" title="User Testing">📓</a></td>
<td align="center" valign="top" width="16.66%"><a href="https://github.com/dave2wave"><img src="https://avatars.githubusercontent.com/u/29803617?v=4?s=50" width="50px;" alt="Dave Fisher"/><br /><sub><b>Dave Fisher</b></sub></a><br /><a href="https://github.com/nosqlbench/nosqlbench/issues?q=author%3Adave2wave" title="Bug reports">🐛</a> <a href="#business-dave2wave" title="Business development">💼</a> <a href="https://github.com/nosqlbench/nosqlbench/commits?author=dave2wave" title="Code">💻</a> <a href="#content-dave2wave" title="Content">🖋</a> <a href="#data-dave2wave" title="Data">🔣</a> <a href="https://github.com/nosqlbench/nosqlbench/commits?author=dave2wave" title="Documentation">📖</a> <a href="#design-dave2wave" title="Design">🎨</a> <a href="#example-dave2wave" title="Examples">💡</a> <a href="#ideas-dave2wave" title="Ideas, Planning, & Feedback">🤔</a> <a href="#infra-dave2wave" title="Infrastructure (Hosting, Build-Tools, etc)">🚇</a> <a href="#maintenance-dave2wave" title="Maintenance">🚧</a> <a href="#mentoring-dave2wave" title="Mentoring">🧑‍🏫</a> <a href="#platform-dave2wave" title="Packaging/porting to new platform">📦</a> <a href="#plugin-dave2wave" title="Plugin/utility libraries">🔌</a> <a href="#projectManagement-dave2wave" title="Project Management">📆</a> <a href="#research-dave2wave" title="Research">🔬</a> <a href="https://github.com/nosqlbench/nosqlbench/pulls?q=is%3Apr+reviewed-by%3Adave2wave" title="Reviewed Pull Requests">👀</a> <a href="#security-dave2wave" title="Security">🛡️</a> <a href="#tool-dave2wave" title="Tools">🔧</a> <a href="https://github.com/nosqlbench/nosqlbench/commits?author=dave2wave" title="Tests">⚠️</a> <a href="#userTesting-dave2wave" title="User Testing">📓</a></td> <td align="center" valign="top" width="16.66%"><a href="https://github.com/dave2wave"><img src="https://avatars.githubusercontent.com/u/29803617?v=4?s=50" width="50px;" alt="Dave Fisher"/><br /><sub><b>Dave Fisher</b></sub></a><br /><a href="https://github.com/nosqlbench/nosqlbench/issues?q=author%3Adave2wave" title="Bug reports">🐛</a> <a href="#business-dave2wave" title="Business development">💼</a> <a href="https://github.com/nosqlbench/nosqlbench/commits?author=dave2wave" title="Code">💻</a> <a href="#content-dave2wave" title="Content">🖋</a> <a href="#data-dave2wave" title="Data">🔣</a> <a href="https://github.com/nosqlbench/nosqlbench/commits?author=dave2wave" title="Documentation">📖</a> <a href="#design-dave2wave" title="Design">🎨</a> <a href="#example-dave2wave" title="Examples">💡</a> <a href="#ideas-dave2wave" title="Ideas, Planning, & Feedback">🤔</a> <a href="#infra-dave2wave" title="Infrastructure (Hosting, Build-Tools, etc)">🚇</a> <a href="#maintenance-dave2wave" title="Maintenance">🚧</a> <a href="#mentoring-dave2wave" title="Mentoring">🧑‍🏫</a> <a href="#platform-dave2wave" title="Packaging/porting to new platform">📦</a> <a href="#plugin-dave2wave" title="Plugin/utility libraries">🔌</a> <a href="#projectManagement-dave2wave" title="Project Management">📆</a> <a href="#research-dave2wave" title="Research">🔬</a> <a href="https://github.com/nosqlbench/nosqlbench/pulls?q=is%3Apr+reviewed-by%3Adave2wave" title="Reviewed Pull Requests">👀</a> <a href="#security-dave2wave" title="Security">🛡️</a> <a href="#tool-dave2wave" title="Tools">🔧</a> <a href="https://github.com/nosqlbench/nosqlbench/commits?author=dave2wave" title="Tests">⚠️</a> <a href="#userTesting-dave2wave" title="User Testing">📓</a></td>
<td align="center" valign="top" width="16.66%"><a href="https://github.com/sahankj2000"><img src="https://avatars.githubusercontent.com/u/55505318?v=4?s=50" width="50px;" alt="sahankj2000"/><br /><sub><b>sahankj2000</b></sub></a><br /><a href="https://github.com/nosqlbench/nosqlbench/commits?author=sahankj2000" title="Code">💻</a> <a href="#userTesting-sahankj2000" title="User Testing">📓</a></td>
</tr>
<tr>
<td align="center" valign="top" width="16.66%"><a href="https://github.com/stheodosius-sky"><img src="https://avatars.githubusercontent.com/u/110117464?v=4?s=50" width="50px;" alt="Simon Theodosius"/><br /><sub><b>Simon Theodosius</b></sub></a><br /><a href="#design-stheodosius-sky" title="Design">🎨</a> <a href="#example-stheodosius-sky" title="Examples">💡</a> <a href="#ideas-stheodosius-sky" title="Ideas, Planning, & Feedback">🤔</a></td>
</tr> </tr>
</tbody> </tbody>
</table> </table>

View File

@ -1,54 +0,0 @@
/*
* Copyright (c) 2023 nosqlbench
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package io.nosqlbench.datamappers.functions.hdf_to_cql;
import org.junit.jupiter.api.Test;
import static org.junit.jupiter.api.Assertions.assertEquals;
public class DefaultDatasetParserTest {
String test1 = "{\"conditions\": {\"and\": [{\"a\": {\"match\": {\"value\": 53}}}]}}";
String test2 = "{\"conditions\": {\"and\": [{\"a\": {\"match\": {\"value\": \"thirteen\"}}}, {\"b\": {\"match\": {\"value\": \"fifty-four\"}}}]}}";
String test3 = "{\"conditions\": {\"and\": [{\"a\": {\"match\": {\"value\": 13}}}, {\"b\": {\"match\": {\"value\": 54}}}, {\"a\": {\"match\": {\"value\": 154}}}]}}";
String test4 = "{\"conditions\": {\"or\": [{\"a\": {\"match\": {\"value\": 9}}}, {\"a\": {\"match\": {\"value\": 71}}}]}}";
String test5 = "{\"conditions\": {\"or\": [{\"a\": {\"match\": {\"value\": 9}}}, {\"a\": {\"match\": {\"value\": 71}}}, {\"a\": {\"match\": {\"value\": 7}}}]}}";
String test6 = "{\"conditions\": {\"or\": [{\"b\": {\"match\": {\"value\": \"foo\"}}}, {\"b\": {\"match\": {\"value\": \"bar\"}}}]}}";
@Test
public void testParse() {
DefaultDatasetParser parser = new DefaultDatasetParser();
String parsed = parser.parse(test1);
assertEquals("WHERE a=53", parsed);
parsed = parser.parse(test2);
assertEquals("WHERE a='thirteen' and b='fifty-four'", parsed);
parsed = parser.parse(test3);
assertEquals("WHERE a=13 and b=54 and a=154", parsed);
parsed = parser.parse(test4);
assertEquals("WHERE a IN(9,71)", parsed);
parsed = parser.parse(test5);
assertEquals("WHERE a IN(9,71,7)", parsed);
parsed = parser.parse(test6);
assertEquals("WHERE b IN('foo','bar')", parsed);
}
}

View File

@ -1,66 +0,0 @@
package io.nosqlbench.adapter.http;
/*
* Copyright (c) 2022 nosqlbench
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
import com.google.gson.JsonArray;
import com.google.gson.JsonElement;
import com.google.gson.JsonObject;
import java.util.ArrayList;
import java.util.List;
public class JsonElementUtils {
/**
* <Pre>{@code
* "hits": {
* "hits": [
* {
* "_score": 1,
* "_id": "doGwOYsBv7KeAUqukb5D",
* "_source": {
* "key": 550,
* "value": [
* -0.34495,
* 1.0193,
* 0.87505,
* }</Pre>
* @param element
* @return
*/
public static int[] getIntArrayFromHits(JsonElement jsonElement) {
JsonObject json = jsonElement.getAsJsonObject();
if (!json.has("hits") || !json.getAsJsonObject("hits").has("hits")) {
return null;
}
JsonArray hits = json.getAsJsonObject("hits").getAsJsonArray("hits");
int count = hits.size();
int[] keys = new int[count];
int i = 0;
for (JsonElement element : hits) {
JsonObject hit = element.getAsJsonObject();
keys[i] = hit.getAsJsonObject("_source").get("key").getAsInt();
i++;
}
return keys;
}
}

View File

@ -44,7 +44,7 @@
</properties> </properties>
<name>${project.artifactId}</name> <name>${project.artifactId}</name>
<url>http://nosqlbench.io/</url> <url>https://nosqlbench.io/</url>
<description> <description>
nosqlbench is the core of a programmable workload simulation runtime. nosqlbench is the core of a programmable workload simulation runtime.
This module acts as the parent pom for nosqlbench Maven modules. This module acts as the parent pom for nosqlbench Maven modules.
@ -80,7 +80,7 @@
<dependency> <dependency>
<groupId>org.apache.groovy</groupId> <groupId>org.apache.groovy</groupId>
<artifactId>groovy</artifactId> <artifactId>groovy</artifactId>
<version>4.0.16</version> <version>4.0.20</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.snakeyaml</groupId> <groupId>org.snakeyaml</groupId>
@ -96,7 +96,7 @@
<dependency> <dependency>
<groupId>net.java.dev.jna</groupId> <groupId>net.java.dev.jna</groupId>
<artifactId>jna</artifactId> <artifactId>jna</artifactId>
<version>5.13.0</version> <version>5.14.0</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>net.java.dev.jna</groupId> <groupId>net.java.dev.jna</groupId>
@ -122,12 +122,12 @@
<dependency> <dependency>
<groupId>io.dropwizard.metrics</groupId> <groupId>io.dropwizard.metrics</groupId>
<artifactId>metrics-graphite</artifactId> <artifactId>metrics-graphite</artifactId>
<version>4.2.23</version> <version>4.2.25</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>io.dropwizard.metrics</groupId> <groupId>io.dropwizard.metrics</groupId>
<artifactId>metrics-core</artifactId> <artifactId>metrics-core</artifactId>
<version>4.2.23</version> <version>4.2.25</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.apache.commons</groupId> <groupId>org.apache.commons</groupId>
@ -188,7 +188,7 @@
<dependency> <dependency>
<groupId>io.netty</groupId> <groupId>io.netty</groupId>
<artifactId>netty-handler</artifactId> <artifactId>netty-handler</artifactId>
<version>4.1.101.Final</version> <version>4.1.107.Final</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>io.netty</groupId> <groupId>io.netty</groupId>
@ -280,7 +280,7 @@
<dependency> <dependency>
<groupId>com.github.oshi</groupId> <groupId>com.github.oshi</groupId>
<artifactId>oshi-core-java11</artifactId> <artifactId>oshi-core-java11</artifactId>
<version>6.4.8</version> <version>6.5.0</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>com.google.code.gson</groupId> <groupId>com.google.code.gson</groupId>
@ -290,7 +290,7 @@
<dependency> <dependency>
<groupId>com.amazonaws</groupId> <groupId>com.amazonaws</groupId>
<artifactId>aws-java-sdk-s3</artifactId> <artifactId>aws-java-sdk-s3</artifactId>
<version>1.12.598</version> <version>1.12.681</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>com.elega9t</groupId> <groupId>com.elega9t</groupId>
@ -315,7 +315,7 @@
<dependency> <dependency>
<groupId>joda-time</groupId> <groupId>joda-time</groupId>
<artifactId>joda-time</artifactId> <artifactId>joda-time</artifactId>
<version>2.12.5</version> <version>2.12.7</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.apache.commons</groupId> <groupId>org.apache.commons</groupId>
@ -325,12 +325,12 @@
<dependency> <dependency>
<groupId>commons-codec</groupId> <groupId>commons-codec</groupId>
<artifactId>commons-codec</artifactId> <artifactId>commons-codec</artifactId>
<version>1.16.0</version> <version>1.16.1</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.mvel</groupId> <groupId>org.mvel</groupId>
<artifactId>mvel2</artifactId> <artifactId>mvel2</artifactId>
<version>2.5.1.Final</version> <version>2.5.2.Final</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.antlr</groupId> <groupId>org.antlr</groupId>
@ -340,7 +340,7 @@
<dependency> <dependency>
<groupId>org.apache.commons</groupId> <groupId>org.apache.commons</groupId>
<artifactId>commons-compress</artifactId> <artifactId>commons-compress</artifactId>
<version>1.21</version> <version>1.26.0</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>com.fasterxml.jackson.jaxrs</groupId> <groupId>com.fasterxml.jackson.jaxrs</groupId>
@ -358,33 +358,22 @@
<version>2.4.0-b180830.0438</version> <version>2.4.0-b180830.0438</version>
</dependency> </dependency>
<!-- graalvm --> <!-- graalvm -->
<dependency> <dependency>
<groupId>org.graalvm.sdk</groupId> <groupId>org.graalvm.polyglot</groupId>
<artifactId>graal-sdk</artifactId> <artifactId>polyglot</artifactId>
<version>23.0.2</version> <version>23.1.2</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.graalvm.js</groupId> <groupId>org.graalvm.polyglot</groupId>
<artifactId>js</artifactId> <artifactId>js</artifactId>
<version>23.0.2</version> <version>23.1.2</version>
<scope>runtime</scope> <type>pom</type>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.graalvm.js</groupId> <groupId>org.graalvm.js</groupId>
<artifactId>js-scriptengine</artifactId> <artifactId>js-scriptengine</artifactId>
<version>23.0.1</version> <version>23.1.2</version>
</dependency>
<dependency>
<groupId>org.graalvm.tools</groupId>
<artifactId>profiler</artifactId>
<version>23.0.1</version>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.graalvm.tools</groupId>
<artifactId>chromeinspector</artifactId>
<version>23.0.1</version>
<scope>runtime</scope>
</dependency> </dependency>
</dependencies> </dependencies>
@ -397,30 +386,30 @@
<dependency> <dependency>
<groupId>org.apache.logging.log4j</groupId> <groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-api</artifactId> <artifactId>log4j-api</artifactId>
<version>2.22.0</version> <version>2.23.1</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.apache.logging.log4j</groupId> <groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-core</artifactId> <artifactId>log4j-core</artifactId>
<version>2.22.0</version> <version>2.23.1</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.apache.logging.log4j</groupId> <groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-slf4j-impl</artifactId> <artifactId>log4j-slf4j-impl</artifactId>
<version>2.22.0</version> <version>2.23.1</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.apache.logging.log4j</groupId> <groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-slf4j2-impl</artifactId> <artifactId>log4j-slf4j2-impl</artifactId>
<version>2.22.0</version> <version>2.23.1</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.apache.logging.log4j</groupId> <groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-jcl</artifactId> <artifactId>log4j-jcl</artifactId>
<version>2.22.0</version> <version>2.23.1</version>
</dependency> </dependency>
<dependency> <dependency>
@ -560,6 +549,7 @@
<plugin> <plugin>
<groupId>org.jacoco</groupId> <groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId> <artifactId>jacoco-maven-plugin</artifactId>
<version>0.8.10</version>
<executions> <executions>
<execution> <execution>
<id>prepare-agent</id> <id>prepare-agent</id>
@ -633,34 +623,6 @@
</configuration> </configuration>
</plugin> </plugin>
<!-- Javadoc -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<configuration>
<release>21</release>
<doctitle>${javadoc.name}</doctitle>
<windowtitle>${javadoc.name}</windowtitle>
<detectJavaApiLink>false</detectJavaApiLink>
<detectLinks>false</detectLinks>
<detectOfflineLinks>false</detectOfflineLinks>
<!-- <additionalparam>-Xdoclint:none</additionalparam>-->
<additionalOptions>
<additionalOption>-Xdoclint:none</additionalOption>
</additionalOptions>
<!-- <additionalJOption>-Xdoclint:none</additionalJOption>-->
<doclint>none</doclint>
</configuration>
<executions>
<execution>
<id>attach-javadoc</id>
<goals>
<goal>jar</goal>
</goals>
</execution>
</executions>
</plugin>
<!-- Sources --> <!-- Sources -->
<plugin> <plugin>
@ -713,6 +675,7 @@
<excludes> <excludes>
<exclude>**/generated/**</exclude> <exclude>**/generated/**</exclude>
<exclude>**/jmh_generated/**</exclude> <exclude>**/jmh_generated/**</exclude>
<exclude>**/generated-sources/**</exclude>
</excludes> </excludes>
<addLicenseHeaders>true</addLicenseHeaders> <addLicenseHeaders>true</addLicenseHeaders>
<copyrightMessage>Copyright (c) 2022 nosqlbench</copyrightMessage> <copyrightMessage>Copyright (c) 2022 nosqlbench</copyrightMessage>
@ -722,6 +685,7 @@
<plugin> <plugin>
<groupId>org.apache.maven.plugins</groupId> <groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-enforcer-plugin</artifactId> <artifactId>maven-enforcer-plugin</artifactId>
<version>3.2.1</version>
<executions> <executions>
<execution> <execution>
<id>enforce-java</id> <id>enforce-java</id>
@ -733,6 +697,7 @@
<requireJavaVersion> <requireJavaVersion>
<version>[21,)</version> <version>[21,)</version>
</requireJavaVersion> </requireJavaVersion>
<requireProfileIdsExist/>
</rules> </rules>
</configuration> </configuration>
</execution> </execution>
@ -843,13 +808,13 @@
<name>Jonathan Shook</name> <name>Jonathan Shook</name>
<email>jshook@gmail.com</email> <email>jshook@gmail.com</email>
<organization>nosqlbench.io</organization> <organization>nosqlbench.io</organization>
<organizationUrl>http://nosqlbench.io/</organizationUrl> <organizationUrl>https://nosqlbench.io/</organizationUrl>
</developer> </developer>
<developer> <developer>
<name>Sebastián Estévez</name> <name>Sebastián Estévez</name>
<email>estevezsebastian@gmail.com</email> <email>estevezsebastian@gmail.com</email>
<organization>nosqlbench.io</organization> <organization>nosqlbench.io</organization>
<organizationUrl>http://nosqlbench.io/</organizationUrl> <organizationUrl>https://nosqlbench.io/</organizationUrl>
</developer> </developer>
</developers> </developers>
@ -874,7 +839,7 @@
<plugin> <plugin>
<groupId>org.apache.maven.plugins</groupId> <groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-gpg-plugin</artifactId> <artifactId>maven-gpg-plugin</artifactId>
<version>1.6</version> <version>3.0.1</version>
<executions> <executions>
<execution> <execution>
<id>sign-artifacts</id> <id>sign-artifacts</id>
@ -896,5 +861,45 @@
</build> </build>
</profile> </profile>
<profile>
<id>build-javadoc</id>
<activation>
<activeByDefault>true</activeByDefault>
</activation>
<build>
<plugins>
<!-- Javadoc -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<configuration>
<release>21</release>
<doctitle>${javadoc.name}</doctitle>
<windowtitle>${javadoc.name}</windowtitle>
<detectJavaApiLink>false</detectJavaApiLink>
<detectLinks>false</detectLinks>
<detectOfflineLinks>false</detectOfflineLinks>
<!-- <additionalparam>-Xdoclint:none</additionalparam>-->
<additionalOptions>
<additionalOption>-Xdoclint:none</additionalOption>
</additionalOptions>
<!-- <additionalJOption>-Xdoclint:none</additionalJOption>-->
<doclint>none</doclint>
</configuration>
<executions>
<execution>
<id>attach-javadoc</id>
<goals>
<goal>jar</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
</profiles> </profiles>
</project> </project>

View File

@ -24,7 +24,7 @@
<artifactId>mvn-defaults</artifactId> <artifactId>mvn-defaults</artifactId>
<groupId>io.nosqlbench</groupId> <groupId>io.nosqlbench</groupId>
<version>${revision}</version> <version>${revision}</version>
<relativePath>../mvn-defaults</relativePath> <relativePath>../../mvn-defaults</relativePath>
</parent> </parent>
<name>${project.artifactId}</name> <name>${project.artifactId}</name>
@ -60,7 +60,7 @@
<dependency> <dependency>
<groupId>org.apache.commons</groupId> <groupId>org.apache.commons</groupId>
<artifactId>commons-configuration2</artifactId> <artifactId>commons-configuration2</artifactId>
<version>2.9.0</version> <version>2.10.1</version>
</dependency> </dependency>
<dependency> <dependency>

View File

@ -120,7 +120,7 @@ public class AmqpMsgRecvOpDispenser extends AmqpBaseOpDispenser {
@Override @Override
public AmqpTimeTrackOp apply(long cycle) { public AmqpTimeTrackOp getOp(long cycle) {
Channel channel = getAmqpChannelForReceiver(cycle); Channel channel = getAmqpChannelForReceiver(cycle);
if (channel == null) { if (channel == null) {
throw new AmqpAdapterUnexpectedException( throw new AmqpAdapterUnexpectedException(

View File

@ -175,7 +175,7 @@ public class AmqpMsgSendOpDispenser extends AmqpBaseOpDispenser {
} }
@Override @Override
public AmqpTimeTrackOp apply(long cycle) { public AmqpTimeTrackOp getOp(long cycle) {
String msgPayload = msgPayloadFunc.apply(cycle); String msgPayload = msgPayloadFunc.apply(cycle);
if (StringUtils.isBlank(msgPayload)) { if (StringUtils.isBlank(msgPayload)) {
throw new AmqpAdapterInvalidParamException("Message payload must be specified and can't be empty!"); throw new AmqpAdapterInvalidParamException("Message payload must be specified and can't be empty!");

View File

@ -0,0 +1,104 @@
<!--
~ Copyright (c) 2022-2023 nosqlbench
~
~ Licensed under the Apache License, Version 2.0 (the "License");
~ you may not use this file except in compliance with the License.
~ You may obtain a copy of the License at
~
~ http://www.apache.org/licenses/LICENSE-2.0
~
~ Unless required by applicable law or agreed to in writing, software
~ distributed under the License is distributed on an "AS IS" BASIS,
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
~ See the License for the specific language governing permissions and
~ limitations under the License.
-->
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<artifactId>adapter-aws-opensearch</artifactId>
<packaging>jar</packaging>
<parent>
<artifactId>mvn-defaults</artifactId>
<groupId>io.nosqlbench</groupId>
<version>${revision}</version>
<relativePath>../../mvn-defaults</relativePath>
</parent>
<name>${project.artifactId}</name>
<description>
A nosqlbench adapter for using AWS's SDK to manage opensearch services
</description>
<dependencies>
<dependency>
<groupId>io.nosqlbench</groupId>
<artifactId>adapters-api</artifactId>
<version>${revision}</version>
<scope>compile</scope>
</dependency>
<!-- For managing AWS Open Search Services-->
<!-- <dependency>-->
<!-- <groupId>software.amazon.awssdk</groupId>-->
<!-- <artifactId>opensearch</artifactId>-->
<!-- <version>2.23.18</version>-->
<!-- </dependency>-->
<dependency>
<groupId>io.nosqlbench</groupId>
<artifactId>nb-annotations</artifactId>
<version>${revision}</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.opensearch.client</groupId>
<artifactId>opensearch-java</artifactId>
<version>2.8.1</version>
</dependency>
<dependency>
<groupId>org.apache.httpcomponents.client5</groupId>
<artifactId>httpclient5</artifactId>
<version>5.2.1</version>
</dependency>
<!-- <dependency>-->
<!-- <groupId>software.amazon.awssdk</groupId>-->
<!-- <artifactId>http-client-spi</artifactId>-->
<!-- <version>2.23.18</version>-->
<!-- </dependency>-->
<!-- <dependency>-->
<!-- <groupId>software.amazon.awssdk</groupId>-->
<!-- <artifactId>aws-sdk-java-pom</artifactId>-->
<!-- <version>2.20.109</version>-->
<!-- </dependency>-->
<dependency>
<groupId>software.amazon.awssdk</groupId>
<artifactId>http-client-spi</artifactId>
<version>2.23.18</version>
</dependency>
<dependency>
<groupId>software.amazon.awssdk</groupId>
<artifactId>aws-crt-client</artifactId>
<version>2.20.109</version>
</dependency>
<dependency>
<groupId>software.amazon.awssdk</groupId>
<artifactId>regions</artifactId>
<version>2.23.18</version>
</dependency>
<dependency>
<groupId>software.amazon.awssdk</groupId>
<artifactId>auth</artifactId>
<version>2.23.19</version>
</dependency>
</dependencies>
</project>

View File

@ -0,0 +1,51 @@
/*
* Copyright (c) 2024 nosqlbench
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package io.nosqlbench.adapter.opensearch;
import io.nosqlbench.adapters.api.activityimpl.OpMapper;
import io.nosqlbench.adapters.api.activityimpl.uniform.BaseDriverAdapter;
import io.nosqlbench.adapters.api.activityimpl.uniform.DriverAdapter;
import io.nosqlbench.adapters.api.activityimpl.uniform.flowtypes.Op;
import io.nosqlbench.nb.annotations.Service;
import io.nosqlbench.nb.api.components.core.NBComponent;
import io.nosqlbench.nb.api.config.standard.NBConfigModel;
import io.nosqlbench.nb.api.config.standard.NBConfiguration;
import io.nosqlbench.nb.api.labels.NBLabels;
import java.util.function.Function;
@Service(value= DriverAdapter.class, selector = "opensearch")
public class AOSAdapter extends BaseDriverAdapter<Op, AOSSpace> {
public AOSAdapter(NBComponent parentComponent, NBLabels labels) {
super(parentComponent, labels);
}
@Override
public Function<String, ? extends AOSSpace> getSpaceInitializer(NBConfiguration cfg) {
return (String spaceName) -> new AOSSpace(cfg);
}
@Override
public OpMapper<Op> getOpMapper() {
return new AOSOpMapper(this);
}
@Override
public NBConfigModel getConfigModel() {
return super.getConfigModel().add(AOSSpace.getConfigModel());
}
}

View File

@ -0,0 +1,30 @@
/*
* Copyright (c) 2024 nosqlbench
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package io.nosqlbench.adapter.opensearch;
import io.nosqlbench.adapter.diag.DriverAdapterLoader;
import io.nosqlbench.nb.annotations.Service;
import io.nosqlbench.nb.api.components.core.NBComponent;
import io.nosqlbench.nb.api.labels.NBLabels;
@Service(value = DriverAdapterLoader.class,selector = "opensearch")
public class AOSAdapterLoader implements DriverAdapterLoader {
@Override
public AOSAdapter load(NBComponent parent, NBLabels childLabels) {
return new AOSAdapter(parent, childLabels);
}
}

View File

@ -0,0 +1,49 @@
/*
* Copyright (c) 2024 nosqlbench
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package io.nosqlbench.adapter.opensearch;
import io.nosqlbench.adapter.opensearch.dispensers.*;
import io.nosqlbench.adapters.api.activityimpl.OpDispenser;
import io.nosqlbench.adapters.api.activityimpl.OpMapper;
import io.nosqlbench.adapters.api.activityimpl.uniform.flowtypes.Op;
import io.nosqlbench.adapters.api.templating.ParsedOp;
import io.nosqlbench.engine.api.templating.TypeAndTarget;
public class AOSOpMapper implements OpMapper<Op> {
private final AOSAdapter adapter;
public AOSOpMapper(AOSAdapter AOSAdapter) {
this.adapter = AOSAdapter;
}
@Override
public OpDispenser<? extends Op> apply(ParsedOp op) {
TypeAndTarget<AOSOpTypes, String> typeAndTarget =
op.getTypeAndTarget(AOSOpTypes.class, String.class, "verb", "index");
return switch (typeAndTarget.enumId) {
case create_index -> new AOSCreateIndexOpDispenser(adapter, op, typeAndTarget.targetFunction);
case delete_index -> new AOSDeleteIndexOpDispenser(adapter, op, typeAndTarget.targetFunction);
case index -> new AOSIndexOpDispenser(adapter,op, typeAndTarget.targetFunction);
case update -> new AOSUpdateOpDispenser(adapter,op, typeAndTarget.targetFunction);
case delete -> new AOSDeleteOpDispenser(adapter,op, typeAndTarget.targetFunction);
case knn_search -> new AOSKnnSearchOpDispenser(adapter,op, typeAndTarget.targetFunction);
case bulk -> new AOSBulkOpDispenser(adapter, op, typeAndTarget.targetFunction);
default -> throw new RuntimeException("Unrecognized op type '" + typeAndTarget.enumId.name() + "' while " +
"mapping parsed op " + op);
};
}
}

View File

@ -0,0 +1,27 @@
/*
* Copyright (c) 2024 nosqlbench
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package io.nosqlbench.adapter.opensearch;
public enum AOSOpTypes {
create_index,
delete_index,
index,
update,
delete,
knn_search,
bulk
}

View File

@ -0,0 +1,22 @@
/*
* Copyright (c) 2024 nosqlbench
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package io.nosqlbench.adapter.opensearch;
public enum AOSServiceType {
aoss,
es
}

View File

@ -0,0 +1,121 @@
/*
* Copyright (c) 2024 nosqlbench
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package io.nosqlbench.adapter.opensearch;
import io.nosqlbench.nb.api.config.standard.ConfigModel;
import io.nosqlbench.nb.api.config.standard.NBConfigModel;
import io.nosqlbench.nb.api.config.standard.NBConfiguration;
import io.nosqlbench.nb.api.config.standard.Param;
import org.opensearch.client.opensearch.OpenSearchClient;
import org.opensearch.client.opensearch.core.InfoResponse;
import org.opensearch.client.transport.aws.AwsSdk2Transport;
import org.opensearch.client.transport.aws.AwsSdk2TransportOptions;
import software.amazon.awssdk.auth.credentials.*;
import software.amazon.awssdk.http.async.SdkAsyncHttpClient;
import software.amazon.awssdk.http.crt.AwsCrtAsyncHttpClient;
import software.amazon.awssdk.regions.Region;
import java.io.IOException;
public class AOSSpace implements AutoCloseable {
private final NBConfiguration cfg;
protected OpenSearchClient client;
public AOSSpace(NBConfiguration cfg) {
this.cfg = cfg;
}
public synchronized OpenSearchClient getClient() {
if (client == null) {
client = createClient();
}
return client;
}
private OpenSearchClient createClient() {
String region = cfg.get("region");
Region selectedRegion = Region.of(region);
String host = cfg.get("host");
SdkAsyncHttpClient httpClient =
AwsCrtAsyncHttpClient.builder()
.build();
AwsSdk2TransportOptions.Builder transportOptionsBuilder
= AwsSdk2TransportOptions.builder();
cfg.getOptional("profile").map(
p -> ProfileCredentialsProvider.builder()
.profileName(p)
.build())
.ifPresent(transportOptionsBuilder::setCredentials);
AwsSdk2TransportOptions transportOptions = transportOptionsBuilder.build();
AOSServiceType svctype = AOSServiceType.valueOf(cfg.get("svctype"));
AwsSdk2Transport awsSdk2Transport =
new AwsSdk2Transport(
httpClient,
host,
svctype.name(),
selectedRegion,
transportOptions
);
OpenSearchClient client = new OpenSearchClient(awsSdk2Transport);
if (cfg.get("getinfo").equals("true")) {
try {
InfoResponse info = client.info();
System.out.println(info.version().distribution() + ": " + info.version().number());
} catch (IOException e) {
throw new RuntimeException(e);
}
}
return client;
}
public static NBConfigModel getConfigModel() {
return ConfigModel.of(AOSSpace.class)
.add(Param.required("region", String.class).setDescription("The region to connect to"))
.add(Param.required("host", String.class).setDescription("The Open Search API endpoint host"))
.add(Param.optional("profile")
.setDescription("The AWS auth profile to use. Required to activate profile based auth"))
.add(Param.defaultTo("getinfo", "false").setDescription("whether to call info after connect or " +
"not, true|false"))
.add(Param.defaultTo("svctype", "es")
.setDescription("one of es or aoss, defaults to es for OpenSearch domains"))
.add(Param.defaultTo("diag", "false")
.setDescription("enable payload diagnostics or not"))
.asReadOnly();
}
@Override
public void close() throws Exception {
if (client != null) {
client.shutdown();
}
}
}

View File

@ -0,0 +1,33 @@
/*
* Copyright (c) 2024 nosqlbench
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package io.nosqlbench.adapter.opensearch;
import io.nosqlbench.adapter.opensearch.pojos.Doc;
import org.opensearch.client.opensearch.core.SearchResponse;
import org.opensearch.client.opensearch.core.search.Hit;
public class AOSUtils {
public static int[] DocHitsToIntIndicesArray(SearchResponse<Doc> response) {
int[] indices = response.hits().hits()
.stream()
.map(Hit::source)
.mapToInt(doc -> Integer.parseInt(doc.getKey()))
.toArray();
return indices;
}
}

View File

@ -0,0 +1,50 @@
/*
* Copyright (c) 2024 nosqlbench
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package io.nosqlbench.adapter.opensearch.dispensers;
import io.nosqlbench.adapter.opensearch.AOSAdapter;
import io.nosqlbench.adapter.opensearch.AOSSpace;
import io.nosqlbench.adapters.api.activityimpl.BaseOpDispenser;
import io.nosqlbench.adapters.api.activityimpl.uniform.flowtypes.Op;
import io.nosqlbench.adapters.api.templating.ParsedOp;
import org.opensearch.client.opensearch.OpenSearchClient;
import java.util.function.LongFunction;
public abstract class AOSBaseOpDispenser extends BaseOpDispenser<Op,Object> {
protected final LongFunction<AOSSpace> spaceF;
protected final LongFunction<OpenSearchClient> clientF;
private final LongFunction<? extends Op> opF;
protected AOSBaseOpDispenser(AOSAdapter adapter, ParsedOp op, LongFunction<String> targetF) {
super(adapter, op);
this.spaceF =adapter.getSpaceFunc(op);
this.clientF = (long l) -> this.spaceF.apply(l).getClient();
this.opF = createOpFunc(clientF, op, targetF);
}
public abstract LongFunction<? extends Op> createOpFunc(
LongFunction<OpenSearchClient> clientF,
ParsedOp op,
LongFunction<String> targetF
);
@Override
public Op getOp(long value) {
return opF.apply(value);
}
}

View File

@ -0,0 +1,47 @@
/*
* Copyright (c) 2024 nosqlbench
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package io.nosqlbench.adapter.opensearch.dispensers;
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
import io.nosqlbench.adapter.opensearch.AOSAdapter;
import io.nosqlbench.adapter.opensearch.ops.AOSBulkOp;
import io.nosqlbench.adapters.api.activityimpl.uniform.flowtypes.Op;
import io.nosqlbench.adapters.api.templating.ParsedOp;
import org.opensearch.client.opensearch.OpenSearchClient;
import org.opensearch.client.opensearch.core.BulkRequest;
import java.util.function.LongFunction;
public class AOSBulkOpDispenser extends AOSBaseOpDispenser {
private static Gson gson = new GsonBuilder().setPrettyPrinting().create();
public AOSBulkOpDispenser(AOSAdapter adapter, ParsedOp op, LongFunction<String> targetF) {
super(adapter, op, targetF);
}
@Override
public LongFunction<? extends Op> createOpFunc(
LongFunction<OpenSearchClient> clientF,
ParsedOp op,
LongFunction<String> targetF
) {
LongFunction<BulkRequest> func = AOSRequests.bulk(op,targetF);
return l -> new AOSBulkOp(clientF.apply(l), func.apply(l));
}
}

View File

@ -0,0 +1,24 @@
/*
* Copyright (c) 2024 nosqlbench
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package io.nosqlbench.adapter.opensearch.dispensers;
public enum AOSBulkOpTypes {
create,
index,
delete,
update
}

View File

@ -0,0 +1,93 @@
/*
* Copyright (c) 2024 nosqlbench
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package io.nosqlbench.adapter.opensearch.dispensers;
import io.nosqlbench.adapter.opensearch.AOSAdapter;
import io.nosqlbench.adapter.opensearch.ops.AOSCreateIndexOp;
import io.nosqlbench.adapters.api.templating.ParsedOp;
import org.opensearch.client.json.JsonData;
import org.opensearch.client.opensearch.OpenSearchClient;
import org.opensearch.client.opensearch._types.mapping.*;
import org.opensearch.client.opensearch.indices.CreateIndexRequest;
import java.util.Map;
import java.util.function.LongFunction;
public class AOSCreateIndexOpDispenser extends AOSBaseOpDispenser {
private final ParsedOp pop;
private final int dimensions;
private final int ef_construction;
private final int m;
public AOSCreateIndexOpDispenser(AOSAdapter adapter, ParsedOp op, LongFunction<String> targetF) {
super(adapter, op, targetF);
this.pop = op;
this.dimensions = pop.getStaticValue("dimensions",Integer.class).intValue();
this.ef_construction = pop.getStaticValue("ef_construction",Integer.class).intValue();
this.m = pop.getStaticValue("m",Integer.class).intValue();
}
@Override
public LongFunction<AOSCreateIndexOp> createOpFunc(LongFunction<OpenSearchClient> clientF, ParsedOp op,
LongFunction<String> targetF) {
CreateIndexRequest.Builder eb = new CreateIndexRequest.Builder();
LongFunction<CreateIndexRequest.Builder> bfunc =
l -> new CreateIndexRequest.Builder()
.settings(b -> b.knn(true))
.index(targetF.apply(1));
bfunc = op.enhanceFunc(bfunc, "mappings", Map.class, this::resolveTypeMapping);
LongFunction<CreateIndexRequest.Builder> finalBfunc = bfunc;
return (long l) -> new AOSCreateIndexOp(clientF.apply(l), finalBfunc.apply(l).build());
}
// https://opensearch.org/docs/latest/search-plugins/knn/knn-index/
private CreateIndexRequest.Builder resolveTypeMapping(CreateIndexRequest.Builder eb, Map<?, ?> mappings) {
TypeMapping.Builder builder = new TypeMapping.Builder().properties(
Map.of(
"key",
new Property.Builder()
.text(b -> b)
.build(),
"value",
new Property.Builder()
.knnVector(new KnnVectorProperty.Builder()
.dimension(dimensions)
.method(
new KnnVectorMethod.Builder()
.name("hnsw")
.engine("faiss")
.spaceType("l2")
.parameters(
Map.of(
"ef_construction", JsonData.of(ef_construction),
"m", JsonData.of(m)
)
)
.build()
).build()
).build()
))
.fieldNames(new FieldNamesField.Builder()
.enabled(true).build()
);
return eb.mappings(b -> builder);
}
}

View File

@ -0,0 +1,40 @@
/*
* Copyright (c) 2024 nosqlbench
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package io.nosqlbench.adapter.opensearch.dispensers;
import io.nosqlbench.adapter.opensearch.AOSAdapter;
import io.nosqlbench.adapter.opensearch.ops.AOSDeleteIndexOp;
import io.nosqlbench.adapters.api.templating.ParsedOp;
import org.opensearch.client.opensearch.OpenSearchClient;
import org.opensearch.client.opensearch.indices.DeleteIndexRequest;
import java.util.function.LongFunction;
public class AOSDeleteIndexOpDispenser extends AOSBaseOpDispenser {
public AOSDeleteIndexOpDispenser(AOSAdapter adapter, ParsedOp op, LongFunction<String> targetF) {
super(adapter, op, targetF);
}
@Override
public LongFunction<AOSDeleteIndexOp> createOpFunc(LongFunction<OpenSearchClient> clientF, ParsedOp op, LongFunction<String> targetF) {
DeleteIndexRequest.Builder eb = new DeleteIndexRequest.Builder();
LongFunction<DeleteIndexRequest.Builder> f =
l -> new DeleteIndexRequest.Builder().index(targetF.apply(l));
return l -> new AOSDeleteIndexOp(clientF.apply(l),f.apply(1).build());
}
}

View File

@ -0,0 +1,40 @@
/*
* Copyright (c) 2024 nosqlbench
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package io.nosqlbench.adapter.opensearch.dispensers;
import io.nosqlbench.adapter.opensearch.AOSAdapter;
import io.nosqlbench.adapter.opensearch.ops.AOSDeleteOp;
import io.nosqlbench.adapters.api.templating.ParsedOp;
import org.opensearch.client.opensearch.OpenSearchClient;
import org.opensearch.client.opensearch.core.DeleteRequest;
import java.util.function.LongFunction;
public class AOSDeleteOpDispenser extends AOSBaseOpDispenser {
public AOSDeleteOpDispenser(AOSAdapter adapter, ParsedOp op, LongFunction<String> targetF) {
super(adapter, op, targetF);
}
@Override
public LongFunction<AOSDeleteOp> createOpFunc(LongFunction<OpenSearchClient> clientF, ParsedOp op, LongFunction<String> targetF) {
DeleteRequest.Builder eb = new DeleteRequest.Builder();
LongFunction<DeleteRequest.Builder> bfunc = l -> new DeleteRequest.Builder().index(targetF.apply(l));
return (long l) -> new AOSDeleteOp(clientF.apply(l), bfunc.apply(l).build());
}
}

View File

@ -0,0 +1,48 @@
/*
* Copyright (c) 2024 nosqlbench
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package io.nosqlbench.adapter.opensearch.dispensers;
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
import io.nosqlbench.adapter.opensearch.AOSAdapter;
import io.nosqlbench.adapter.opensearch.ops.AOSIndexOp;
import io.nosqlbench.adapters.api.activityimpl.uniform.flowtypes.Op;
import io.nosqlbench.adapters.api.templating.ParsedOp;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.opensearch.client.opensearch.OpenSearchClient;
import org.opensearch.client.opensearch.core.IndexRequest;
import java.util.function.LongFunction;
public class AOSIndexOpDispenser extends AOSBaseOpDispenser {
private final static Logger logger = LogManager.getLogger(AOSIndexOpDispenser.class);
private static Gson gson = new GsonBuilder().setPrettyPrinting().create();
private final String diag;
public AOSIndexOpDispenser(AOSAdapter adapter, ParsedOp op, LongFunction<String> targetF) {
super(adapter, op, targetF);
this.diag = op.getStaticConfigOr("daig","false");
}
@Override
public LongFunction<? extends Op> createOpFunc(LongFunction<OpenSearchClient> clientF, ParsedOp op, LongFunction<String> targetF) {
LongFunction<IndexRequest> irqF = AOSRequests.index(op);
return l -> new AOSIndexOp(clientF.apply(l), irqF.apply(l));
}
}

View File

@ -0,0 +1,106 @@
/*
* Copyright (c) 2024 nosqlbench
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package io.nosqlbench.adapter.opensearch.dispensers;
import io.nosqlbench.adapter.opensearch.AOSAdapter;
import io.nosqlbench.adapter.opensearch.ops.AOSKnnSearchOp;
import io.nosqlbench.adapters.api.templating.ParsedOp;
import org.opensearch.client.json.JsonData;
import org.opensearch.client.opensearch.OpenSearchClient;
import org.opensearch.client.opensearch._types.FieldValue;
import org.opensearch.client.opensearch._types.query_dsl.KnnQuery;
import org.opensearch.client.opensearch._types.query_dsl.Query;
import org.opensearch.client.opensearch.core.SearchRequest;
import java.util.List;
import java.util.Map;
import java.util.Optional;
import java.util.function.LongFunction;
public class AOSKnnSearchOpDispenser extends AOSBaseOpDispenser {
private Class<?> schemaClass;
public AOSKnnSearchOpDispenser(AOSAdapter adapter, ParsedOp op, LongFunction<String> targetF) {
super(adapter, op, targetF);
String schemaClassStr = op.getStaticConfigOr("schema", "io.nosqlbench.adapter.opensearch.pojos.Doc");
try {
schemaClass = Class.forName(schemaClassStr);
} catch (Exception e) {
throw new RuntimeException("Unable to load schema class: " + schemaClassStr, e);
}
}
@Override
public LongFunction<AOSKnnSearchOp> createOpFunc(LongFunction<OpenSearchClient> clientF, ParsedOp op, LongFunction<String> targetF) {
LongFunction<KnnQuery.Builder> knnfunc = l -> new KnnQuery.Builder();
knnfunc = op.enhanceFuncOptionally(knnfunc, "k",Integer.class, KnnQuery.Builder::k);
knnfunc = op.enhanceFuncOptionally(knnfunc, "vector", List.class, this::convertVector);
knnfunc = op.enhanceFuncOptionally(knnfunc, "field",String.class, KnnQuery.Builder::field);
Optional<LongFunction<Map>> filterFunction = op.getAsOptionalFunction("filter", Map.class);
if (filterFunction.isPresent()) {
LongFunction<KnnQuery.Builder> finalFunc = knnfunc;
LongFunction<Query> builtFilter = buildFilterQuery(filterFunction.get());
knnfunc = l -> finalFunc.apply(l).filter(builtFilter.apply(l));
}
LongFunction<KnnQuery.Builder> finalKnnfunc = knnfunc;
LongFunction<SearchRequest.Builder> bfunc =
l -> new SearchRequest.Builder().size(op.getStaticValueOr("size", 100))
.index(targetF.apply(l))
.query(new Query.Builder().knn(finalKnnfunc.apply(l).build()).build());
return (long l) -> new AOSKnnSearchOp(clientF.apply(l), bfunc.apply(l).build(), schemaClass);
}
private LongFunction<Query> buildFilterQuery(LongFunction<Map> mapLongFunction) {
return l -> {
Map<String,String> filterFields = mapLongFunction.apply(l);
String field = filterFields.get("field");
String comparator = filterFields.get("comparator");
String value = filterFields.get("value");
return switch (comparator) {
case "gte" -> Query.of(f -> f
.bool(b -> b
.must(m -> m
.range(r -> r
.field(field)
.gte(JsonData.of(Integer.valueOf(value)))))));
case "lte" -> Query.of(f -> f
.bool(b -> b
.must(m -> m
.range(r -> r
.field(field)
.lte(JsonData.of(Integer.valueOf(value)))))));
case "eq" -> Query.of(f -> f
.bool(b -> b
.must(m -> m
.term(t -> t
.field(field)
.value(FieldValue.of(value))))));
default -> throw new RuntimeException("Invalid comparator specified");
};
};
}
private KnnQuery.Builder convertVector(KnnQuery.Builder builder, List list) {
float[] vector = new float[list.size()];
for (int i = 0; i < list.size(); i++) {
vector[i] = (float) list.get(i);
}
return builder.vector(vector);
}
}

View File

@ -0,0 +1,130 @@
/*
* Copyright (c) 2024 nosqlbench
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package io.nosqlbench.adapter.opensearch.dispensers;
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
import io.nosqlbench.adapters.api.templating.ParsedOp;
import io.nosqlbench.engine.api.templating.TypeAndTarget;
import io.nosqlbench.nb.api.errors.OpConfigError;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.opensearch.client.opensearch._types.OpType;
import org.opensearch.client.opensearch._types.Refresh;
import org.opensearch.client.opensearch._types.VersionType;
import org.opensearch.client.opensearch.core.BulkRequest;
import org.opensearch.client.opensearch.core.IndexRequest;
import org.opensearch.client.opensearch.core.bulk.BulkOperation;
import org.opensearch.client.opensearch.core.bulk.BulkOperationVariant;
import org.opensearch.client.opensearch.core.bulk.CreateOperation;
import org.opensearch.client.opensearch.core.bulk.IndexOperation;
import java.util.ArrayList;
import java.util.List;
import java.util.function.LongFunction;
public class AOSRequests {
private final static Logger logger = LogManager.getLogger(AOSIndexOpDispenser.class);
private static Gson gson = new GsonBuilder().setPrettyPrinting().create();
public static <T> LongFunction<BulkRequest> bulk(ParsedOp op, LongFunction<String> targetF) {
LongFunction<BulkRequest.Builder> func = l -> new BulkRequest.Builder();
LongFunction<BulkRequest.Builder> finalFunc2 = func;
func = l -> finalFunc2.apply(l).index(targetF.apply(l));
func = op.enhanceFuncOptionally(func, "pipeline", String.class, BulkRequest.Builder::pipeline);
func = op.enhanceEnumOptionally(func, "refresh", Refresh.class, BulkRequest.Builder::refresh);
func = op.enhanceFuncOptionally(func, "routing", String.class, BulkRequest.Builder::routing);
func = op.enhanceFuncOptionally(func, "requireAlias", boolean.class, BulkRequest.Builder::requireAlias);
func = op.enhanceFuncOptionally(func, "sourceExcludes", List.class, BulkRequest.Builder::sourceExcludes);
ParsedOp subop = op.getAsSubOp("op_template", ParsedOp.SubOpNaming.ParentAndSubKey);
int repeat = subop.getStaticConfigOr("repeat", 1);
TypeAndTarget<AOSBulkOpTypes, String> typeinfo =
subop.getTypeAndTarget(AOSBulkOpTypes.class, String.class);
LongFunction<BulkOperationVariant> bop = switch (typeinfo.enumId) {
case create -> AOSRequests.createOperation(subop);
case index -> AOSRequests.indexOperation(subop);
default -> throw new OpConfigError("Unsupported type in bulk operation: '" + typeinfo.enumId + "'");
};
LongFunction<List<BulkOperation>> bov =
l -> {
ArrayList<BulkOperation> variants = new ArrayList<>();
long floor = repeat * l;
for (long i = floor; i < floor + repeat; i++) {
variants.add(bop.apply(i)._toBulkOperation());
}
return variants;
};
LongFunction<BulkRequest.Builder> finalFunc = func;
func = l -> finalFunc.apply(l).operations(bov.apply(l));
// func = op.enhanceFuncOptionally(func, "source", Object.class, this::resolveSourceConfigParam);
// func = op.enhanceFuncOptionally(func, "waitForActiveShards", Object.class, this::resolveWaitForActiveShards);
// func = op.enhanceFuncOptionally(func, "timeout", Object.class, this::resolveTimeout);
LongFunction<BulkRequest.Builder> finalFunc1 = func;
return l -> finalFunc1.apply(l).build();
}
private static LongFunction<BulkOperationVariant> createOperation(ParsedOp op) {
LongFunction<CreateOperation.Builder> func = l -> new CreateOperation.Builder<>();
func = op.enhanceFuncOptionally(func, "index", String.class, (b, v) -> (CreateOperation.Builder) b.index(v));
func = op.enhanceFuncOptionally(func, "document", Object.class,
(b, v) -> (CreateOperation.Builder) b.document(v));
LongFunction<CreateOperation.Builder> finalFunc = func;
return l -> finalFunc.apply(l).build();
}
public static <T> LongFunction<BulkOperationVariant> indexOperation(ParsedOp op) {
LongFunction<IndexOperation.Builder> func = l -> new IndexOperation.Builder<>();
func = op.enhanceFuncOptionally(func, "index", String.class, (b, v) -> (IndexOperation.Builder) b.index(v));
func = op.enhanceFuncOptionally(func, "document", Object.class,
(b, v) -> (IndexOperation.Builder) b.document(v));
LongFunction<IndexOperation.Builder> finalFunc = func;
return l -> finalFunc.apply(l).build();
}
public static <T> LongFunction<IndexRequest> index(ParsedOp op) {
LongFunction<IndexRequest.Builder> func = l -> new IndexRequest.Builder<>();
func = op.enhanceFuncOptionally(func, "index", String.class, IndexRequest.Builder::index);
func = op.enhanceFuncOptionally(func, "id", String.class, IndexRequest.Builder::id);
func = op.enhanceFuncOptionally(func, "ifPrimaryTerm", long.class, IndexRequest.Builder::ifPrimaryTerm);
func = op.enhanceFuncOptionally(func, "ifSeqNo", long.class, IndexRequest.Builder::ifSeqNo);
func = op.enhanceFuncOptionally(func, "pipeline", String.class, IndexRequest.Builder::pipeline);
func = op.enhanceFuncOptionally(func, "routing", String.class, IndexRequest.Builder::routing);
func = op.enhanceFuncOptionally(func, "requireAlias", boolean.class, IndexRequest.Builder::requireAlias);
func = op.enhanceFuncOptionally(func, "version", long.class, IndexRequest.Builder::version);
func = op.enhanceEnumOptionally(func, "opType", OpType.class, IndexRequest.Builder::opType);
func = op.enhanceEnumOptionally(func, "versionType", VersionType.class, IndexRequest.Builder::versionType);
func = op.enhanceFuncPivot(func, "document", Object.class, AOSRequests::bindDocument);
LongFunction<IndexRequest.Builder> finalFunc1 = func;
return l -> finalFunc1.apply(l).build();
}
private static <T> IndexRequest.Builder<T> bindDocument(IndexRequest.Builder<T> builder, T docdata) {
String document = gson.toJson(docdata);
// if (diag.equals("true")) {
// logger.debug("index_op document:\n----\n" + document + "\n----\n");
// }
return builder.document(docdata);
}
}

View File

@ -0,0 +1,40 @@
/*
* Copyright (c) 2024 nosqlbench
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package io.nosqlbench.adapter.opensearch.dispensers;
import io.nosqlbench.adapter.opensearch.AOSAdapter;
import io.nosqlbench.adapter.opensearch.ops.AOSUpdateOp;
import io.nosqlbench.adapters.api.templating.ParsedOp;
import org.opensearch.client.opensearch.OpenSearchClient;
import org.opensearch.client.opensearch.core.UpdateRequest;
import java.util.function.LongFunction;
public class AOSUpdateOpDispenser extends AOSBaseOpDispenser {
public AOSUpdateOpDispenser(AOSAdapter adapter, ParsedOp op, LongFunction<String> targetF) {
super(adapter, op, targetF);
}
@Override
public LongFunction<AOSUpdateOp> createOpFunc(LongFunction<OpenSearchClient> clientF, ParsedOp op, LongFunction<String> targetF) {
LongFunction<UpdateRequest.Builder> bfunc = l -> new UpdateRequest.Builder().index(targetF.apply(l));
// TODO: add details here
return l -> new AOSUpdateOp(clientF.apply(l),bfunc.apply(l).build(),Object.class);
}
}

View File

@ -0,0 +1,44 @@
/*
* Copyright (c) 2024 nosqlbench
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package io.nosqlbench.adapter.opensearch.ops;
import io.nosqlbench.adapters.api.activityimpl.uniform.flowtypes.CycleOp;
import org.opensearch.client.opensearch.OpenSearchClient;
public abstract class AOSBaseOp implements CycleOp<Object> {
protected final OpenSearchClient client;
public AOSBaseOp(OpenSearchClient client) {
this.client = client;
}
@Override
public final Object apply(long value) {
try {
Object result = applyOp(value);
return result;
} catch (Exception e) {
if (e instanceof RuntimeException rte) {
throw rte;
} else {
throw new RuntimeException(e);
}
}
};
public abstract Object applyOp(long value) throws Exception;
}

View File

@ -0,0 +1,39 @@
/*
* Copyright (c) 2024 nosqlbench
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package io.nosqlbench.adapter.opensearch.ops;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.opensearch.client.opensearch.OpenSearchClient;
import org.opensearch.client.opensearch.core.BulkRequest;
import java.io.IOException;
public class AOSBulkOp extends AOSBaseOp {
private final static Logger logger = LogManager.getLogger(AOSBulkOp.class);
private final BulkRequest rq;
public AOSBulkOp(OpenSearchClient client, BulkRequest rq) {
super(client);
this.rq = rq;
}
public Object applyOp(long value) throws IOException {
return client.bulk(rq);
}
}

View File

@ -0,0 +1,37 @@
/*
* Copyright (c) 2024 nosqlbench
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package io.nosqlbench.adapter.opensearch.ops;
import org.opensearch.client.opensearch.OpenSearchClient;
import org.opensearch.client.opensearch.indices.CreateIndexRequest;
import org.opensearch.client.opensearch.indices.CreateIndexResponse;
public class AOSCreateIndexOp extends AOSBaseOp {
private final CreateIndexRequest rq;
public AOSCreateIndexOp(OpenSearchClient client, CreateIndexRequest rq) {
super(client);
this.rq = rq;
}
@Override
public Object applyOp(long value) throws Exception {
CreateIndexResponse response = client.indices().create(rq);
return response;
}
}

View File

@ -0,0 +1,36 @@
/*
* Copyright (c) 2024 nosqlbench
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package io.nosqlbench.adapter.opensearch.ops;
import org.opensearch.client.opensearch.OpenSearchClient;
import org.opensearch.client.opensearch.indices.DeleteIndexRequest;
import java.io.IOException;
public class AOSDeleteIndexOp extends AOSBaseOp {
private final DeleteIndexRequest rq;
public AOSDeleteIndexOp(OpenSearchClient client, DeleteIndexRequest rq) {
super(client);
this.rq = rq;
}
@Override
public Object applyOp(long value) throws IOException {
return client.indices().delete(rq);
}
}

View File

@ -0,0 +1,35 @@
/*
* Copyright (c) 2024 nosqlbench
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package io.nosqlbench.adapter.opensearch.ops;
import org.opensearch.client.opensearch.OpenSearchClient;
import org.opensearch.client.opensearch.core.DeleteRequest;
import java.io.IOException;
public class AOSDeleteOp extends AOSBaseOp {
private final DeleteRequest rq;
public AOSDeleteOp(OpenSearchClient client, DeleteRequest rq) {
super(client);
this.rq = rq;
}
public Object applyOp(long value) throws IOException {
return client.delete(rq);
}
}

View File

@ -0,0 +1,42 @@
/*
* Copyright (c) 2024 nosqlbench
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package io.nosqlbench.adapter.opensearch.ops;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.opensearch.client.opensearch.OpenSearchClient;
import org.opensearch.client.opensearch.core.IndexRequest;
import org.opensearch.client.opensearch.core.IndexResponse;
import java.io.IOException;
public class AOSIndexOp extends AOSBaseOp {
private final static Logger logger = LogManager.getLogger(AOSIndexOp.class);
private final IndexRequest<?> rq;
public AOSIndexOp(OpenSearchClient client, IndexRequest<?> rq) {
super(client);
this.rq = rq;
}
public Object applyOp(long value) throws IOException {
IndexResponse response = client.index(rq);
logger.debug("IndexResponse:" + response);
return response;
}
}

View File

@ -0,0 +1,39 @@
/*
* Copyright (c) 2024 nosqlbench
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package io.nosqlbench.adapter.opensearch.ops;
import org.opensearch.client.opensearch.OpenSearchClient;
import org.opensearch.client.opensearch.core.SearchRequest;
import org.opensearch.client.opensearch.core.SearchResponse;
public class AOSKnnSearchOp extends AOSBaseOp {
private final SearchRequest rq;
private final Class<?> doctype;
public AOSKnnSearchOp(OpenSearchClient client, SearchRequest rq, Class<?> doctype) {
super(client);
this.rq = rq;
this.doctype = doctype;
}
@Override
public Object applyOp(long value) throws Exception {
SearchResponse response = client.search(rq, doctype);
return response;
}
}

View File

@ -0,0 +1,38 @@
/*
* Copyright (c) 2024 nosqlbench
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package io.nosqlbench.adapter.opensearch.ops;
import org.opensearch.client.opensearch.OpenSearchClient;
import org.opensearch.client.opensearch.core.UpdateRequest;
import java.io.IOException;
public class AOSUpdateOp extends AOSBaseOp {
private final UpdateRequest rq;
private final Class<?> doctype;
public AOSUpdateOp(OpenSearchClient client, UpdateRequest rq, Class<?> doctype) {
super(client);
this.rq = rq;
this.doctype = doctype;
}
@Override
public Object applyOp(long value) throws IOException {
return client.update(rq, doctype);
}
}

View File

@ -0,0 +1,51 @@
/*
* Copyright (c) 2024 nosqlbench
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package io.nosqlbench.adapter.opensearch.pojos;
public class Doc {
private float[] value;
private String key;
public Doc() {
}
public Doc(float[] value, String key) {
this.value = value;
this.key = key;
}
public float[] getValue() {
return value;
}
public void setValue(float[] value) {
this.value = value;
}
@Override
public String toString() {
return "{" + "values=" + value + "}";
}
public String getKey() {
return key;
}
public void setKey(String key) {
this.key = key;
}
}

View File

@ -0,0 +1,61 @@
/*
* Copyright (c) 2024 nosqlbench
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package io.nosqlbench.adapter.opensearch.pojos;
public class UserDefinedSchema {
private float[] vectorValues;
private String recordKey;
private String type;
public String getType() {
return type;
}
public void setType(String type) {
this.type = type;
}
public UserDefinedSchema() {
}
public UserDefinedSchema(float[] value, String key, String type) {
this.vectorValues = value;
this.recordKey = key;
this.type = type;
}
public float[] getVectorValues() {
return vectorValues;
}
public void setVectorValues(float[] vectorValues) {
this.vectorValues = vectorValues;
}
@Override
public String toString() {
return "{" + "values=" + vectorValues + "}";
}
public String getRecordKey() {
return recordKey;
}
public void setRecordKey(String recordKey) {
this.recordKey = recordKey;
}
}

View File

@ -0,0 +1,130 @@
description: |
advanced options for knn search in open search
https://www.elastic.co/guide/en/elasticsearch/reference/current/rest-apis.html
template vars:
TEMPLATE(indexname,vectors_index)
TEMPLATE(dimensions,25)
TEMPLATE(search_cycles,1M)
TEMPLATE(rampup_cycles,TEMPLATE(trainsize))
TEMPLATE(size,100)
params:
driver: opensearch
instrument: true
scenarios:
vectors_brief:
bulkrampup: >-
run tags='block:bulkrampup' labels='target:opensearch'
threads=TEMPLATE(rampup_threads,10) cycles=TEMPLATE(trainsize)
errors=count,warn
# search: run tags='block:search' labels='target:opensearch' threads=TEMPLATE(search_threads,10) cycles=TEMPLATE(testsize)
#rampup: >-
# run tags='block:rampup' labels='target:opensearch'
# threads=TEMPLATE(rampup_threads,10) cycles=TEMPLATE(trainsize)
# errors=count,warn
## search: run tags='block:search' labels='target:opensearch' threads=TEMPLATE(search_threads,10) cycles=TEMPLATE(testsize)
search_and_verify: >-
run tags='block:search_and_verify' labels='target:opensearch'
threads=TEMPLATE(search_threads,10) cycles=TEMPLATE(testsize)
errors=count,warn
search_specify_schema: >-
run tags='block:search_specify_schema' labels='target:opensearch'
threads=TEMPLATE(search_threads,10) cycles=TEMPLATE(testsize)
errors=count,warn
vectors:
# drop: run tags='block:drop' labels='target:opensearch' threads===1 cycles===UNDEF
schema: run tags='block:schema' labels='target:opensearch' threads===1 cycles===UNDEF
rampup: >-
run tags='block:rampup' labels='target:opensearch'
threads=TEMPLATE(rampup_threads,10) cycles=TEMPLATE(trainsize)
errors=count,warn
# search: run tags='block:search' labels='target:opensearch' threads=TEMPLATE(search_threads,10) cycles=TEMPLATE(testsize)
search_and_verify: >-
run tags='block:search_and_verify' labels='target:opensearch'
threads=TEMPLATE(search_threads,10) cycles=TEMPLATE(testsize)
errors=count,warn
# errors=counter,warn,log
bindings:
id: ToString()
test_floatlist: HdfFileToFloatList("testdata/TEMPLATE(dataset).hdf5", "/test");
relevant_indices: HdfFileToIntArray("testdata/TEMPLATE(dataset).hdf5", "/neighbors")
distance_floatlist: HdfFileToFloatList("testdata/TEMPLATE(dataset).hdf5", "/distance")
train_floatlist: HdfFileToFloatList("testdata/TEMPLATE(dataset).hdf5", "/train");
blocks:
drop:
ops:
drop_index:
delete_index: TEMPLATE(indexname,vectors_index)
schema:
ops:
create_index:
create_index: TEMPLATE(indexname)
mappings:
m1: v1
search:
ops:
search:
knn_search: TEMPLATE(indexname,vectors_index)
k: 100
vector: "{test_floatlist}"
field: value
search_specify_schema:
ops:
search:
knn_search: TEMPLATE(indexname,vectors_index)
k: 100
vector: "{test_floatlist}"
field: value
schema: io.nosqlbench.adapter.opensearch.pojos.UserDefinedSchema
size: 100
filter:
field: "type"
comparator: "eq"
value: "experimental"
search_and_verify:
ops:
select_ann_limit_TEMPLATE(k,100):
knn_search: TEMPLATE(indexname,vectors_index)
k: 100
vector: "{test_floatlist}"
field: value
verifier-init: |
relevancy=new io.nosqlbench.nb.api.engine.metrics.wrappers.RelevancyMeasures(_parsed_op)
for (int k in List.of(100)) {
relevancy.addFunction(io.nosqlbench.engine.extensions.computefunctions.RelevancyFunctions.recall("recall",k));
relevancy.addFunction(io.nosqlbench.engine.extensions.computefunctions.RelevancyFunctions.precision("precision",k));
relevancy.addFunction(io.nosqlbench.engine.extensions.computefunctions.RelevancyFunctions.F1("F1",k));
relevancy.addFunction(io.nosqlbench.engine.extensions.computefunctions.RelevancyFunctions.reciprocal_rank("RR",k));
relevancy.addFunction(io.nosqlbench.engine.extensions.computefunctions.RelevancyFunctions.average_precision("AP",k));
}
verifier: |
// driver-specific function
actual_indices=io.nosqlbench.adapter.opensearch.Utils.DocHitsToIntIndicesArray(result)
// driver-agnostic function
relevancy.accept({relevant_indices},actual_indices);
return true;
bulkrampup:
ops:
bulk_index:
bulk: TEMPLATE(indexname)
op_template:
repeat: TEMPLATE(bulk_repeat,100)
index: TEMPLATE(indexname)
document:
key: "{id}"
value: "{train_floatlist}"
rampup:
ops:
index:
index: TEMPLATE(indexname)
document:
key: "{id}"
value: "{train_floatlist}"

View File

@ -0,0 +1,3 @@
# opensearch NB Adapter
Put docs here

View File

@ -21,7 +21,7 @@
<groupId>io.nosqlbench</groupId> <groupId>io.nosqlbench</groupId>
<artifactId>mvn-defaults</artifactId> <artifactId>mvn-defaults</artifactId>
<version>${revision}</version> <version>${revision}</version>
<relativePath>../mvn-defaults</relativePath> <relativePath>../../mvn-defaults</relativePath>
</parent> </parent>
<artifactId>adapter-cqld4</artifactId> <artifactId>adapter-cqld4</artifactId>
@ -29,7 +29,7 @@
<name>${project.artifactId}</name> <name>${project.artifactId}</name>
<description> <description>
A CQL ActivityType driver for http://nosqlbench.io/ A CQL ActivityType driver for https://nosqlbench.io/
</description> </description>
<dependencies> <dependencies>
@ -98,12 +98,12 @@
<dependency> <dependency>
<groupId>com.fasterxml.jackson.core</groupId> <groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId> <artifactId>jackson-databind</artifactId>
<version>2.16.0</version> <version>2.17.0</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>com.fasterxml.jackson.core</groupId> <groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-core</artifactId> <artifactId>jackson-core</artifactId>
<version>2.16.0</version> <version>2.17.0</version>
</dependency> </dependency>
</dependencies> </dependencies>

View File

@ -18,16 +18,18 @@ package io.nosqlbench.adapter.cqld4;
import com.datastax.oss.driver.api.core.CqlSession; import com.datastax.oss.driver.api.core.CqlSession;
import com.datastax.oss.driver.api.core.CqlSessionBuilder; import com.datastax.oss.driver.api.core.CqlSessionBuilder;
import com.datastax.oss.driver.api.core.config.DriverConfig; import com.datastax.oss.driver.api.core.config.*;
import com.datastax.oss.driver.api.core.config.DriverConfigLoader; import com.datastax.oss.driver.api.core.session.SessionBuilder;
import com.datastax.oss.driver.api.core.config.OptionsMap;
import com.datastax.oss.driver.api.core.config.TypedDriverOption;
import com.datastax.oss.driver.internal.core.config.composite.CompositeDriverConfigLoader; import com.datastax.oss.driver.internal.core.config.composite.CompositeDriverConfigLoader;
import com.datastax.oss.driver.internal.core.loadbalancing.helper.NodeFilterToDistanceEvaluatorAdapter; import com.datastax.oss.driver.internal.core.loadbalancing.helper.NodeFilterToDistanceEvaluatorAdapter;
import com.google.gson.Gson; import com.google.gson.Gson;
import com.google.gson.GsonBuilder; import com.google.gson.GsonBuilder;
import io.nosqlbench.adapter.cqld4.optionhelpers.OptionHelpers; import io.nosqlbench.adapter.cqld4.optionhelpers.OptionHelpers;
import io.nosqlbench.adapter.cqld4.wrapper.Cqld4LoadBalancerObserver;
import io.nosqlbench.adapter.cqld4.wrapper.Cqld4SessionBuilder;
import io.nosqlbench.adapter.cqld4.wrapper.NodeSummary;
import io.nosqlbench.nb.api.config.standard.*; import io.nosqlbench.nb.api.config.standard.*;
import io.nosqlbench.nb.api.errors.OpConfigError;
import io.nosqlbench.nb.api.nbio.Content; import io.nosqlbench.nb.api.nbio.Content;
import io.nosqlbench.nb.api.nbio.NBIO; import io.nosqlbench.nb.api.nbio.NBIO;
import io.nosqlbench.nb.api.engine.util.SSLKsFactory; import io.nosqlbench.nb.api.engine.util.SSLKsFactory;
@ -37,6 +39,7 @@ import org.apache.logging.log4j.Logger;
import javax.net.ssl.SSLContext; import javax.net.ssl.SSLContext;
import java.io.IOException; import java.io.IOException;
import java.io.InputStream;
import java.net.InetSocketAddress; import java.net.InetSocketAddress;
import java.nio.file.Files; import java.nio.file.Files;
import java.nio.file.Path; import java.nio.file.Path;
@ -67,7 +70,13 @@ public class Cqld4Space implements AutoCloseable {
} }
private CqlSession createSession(NBConfiguration cfg) { private CqlSession createSession(NBConfiguration cfg) {
CqlSessionBuilder builder = new CqlSessionBuilder();
NodeSummary diag = NodeSummary.valueOf(cfg.get("diag"));
CqlSessionBuilder builder = switch (diag) {
default -> new CqlSessionBuilder();
case NodeSummary.addr, NodeSummary.mid, NodeSummary.all -> new Cqld4SessionBuilder();
};
// stop insights for testing // stop insights for testing
OptionsMap defaults = new OptionsMap(); OptionsMap defaults = new OptionsMap();
@ -97,8 +106,18 @@ public class Cqld4Space implements AutoCloseable {
// int port = cfg.getOptional(int.class, "port").orElse(9042); // int port = cfg.getOptional(int.class, "port").orElse(9042);
Optional<String> scb = cfg.getOptional(String.class, "secureconnectbundle", "scb"); Optional<String> scb = cfg.getOptional(String.class, "secureconnectbundle", "scb");
scb.flatMap(s -> NBIO.all().pathname(s).first().map(Content::getInputStream))
.map(builder::withCloudSecureConnectBundle); if (scb.isPresent()) {
Optional<InputStream> stream =
scb.flatMap(s -> NBIO.all().pathname(s).first().map(Content::getInputStream));
if (stream.isPresent()) {
stream.map(builder::withCloudSecureConnectBundle);
} else {
String error = String.format("Unable to load Secure Connect Bundle from path %s", scb.get());
logger.error(error);
throw new RuntimeException(error);
}
}
Optional<List<InetSocketAddress>> contactPointsOption = cfg Optional<List<InetSocketAddress>> contactPointsOption = cfg
.getOptional("host", "hosts") .getOptional("host", "hosts")
@ -200,6 +219,19 @@ public class Cqld4Space implements AutoCloseable {
} }
builder.withConfigLoader(dcl); builder.withConfigLoader(dcl);
// for (String profileName : dcl.getInitialConfig().getProfiles().keySet()) {
// logger.info("Installing load balancer observer in profile '" + profileName);
// DriverExecutionProfile profile = dcl.getInitialConfig().getProfile(profileName);
// String string = profile.getString(TypedDriverOption.LOAD_BALANCING_POLICY_CLASS.getRawOption());
// dcl.getInitialConfig().getDefaultProfile(profileName).getp
// Cqld4LoadBalancerObserver observer = new Cqld4LoadBalancerObserver(string);
// }
//
//
// builder.withNodeFilter()
if (builder instanceof Cqld4SessionBuilder cqld4sb) {
cqld4sb.setNodeSummarizer(diag);
}
CqlSession session = builder.build(); CqlSession session = builder.build();
return session; return session;
} }
@ -292,11 +324,15 @@ public class Cqld4Space implements AutoCloseable {
.add(Param.optional("cloud_proxy_address", String.class, "Cloud Proxy Address")) .add(Param.optional("cloud_proxy_address", String.class, "Cloud Proxy Address"))
.add(Param.optional("maxpages", Integer.class, "Maximum number of pages allowed per CQL request")) .add(Param.optional("maxpages", Integer.class, "Maximum number of pages allowed per CQL request"))
.add(Param.optional("maxretryreplace", Integer.class, "Maximum number of retry replaces with LWT for a CQL request")) .add(Param.optional("maxretryreplace", Integer.class, "Maximum number of retry replaces with LWT for a CQL request"))
.add(Param.defaultTo("diag", "none").setDescription("What level of diagnostics to report"))
.add(SSLKsFactory.get().getConfigModel()) .add(SSLKsFactory.get().getConfigModel())
.add(getDriverOptionsModel()) .add(getDriverOptionsModel())
.add(new OptionHelpers(new OptionsMap()).getConfigModel()) .add(new OptionHelpers(new OptionsMap()).getConfigModel())
.asReadOnly(); .asReadOnly();
}
private static enum Diagnostics {
queryplan
} }
@Override @Override

Some files were not shown because too many files have changed in this diff Show More