Skip to content

Commit

Permalink
Refactor Insert Upsert Testing
Browse files Browse the repository at this point in the history
Signed-off-by: kpango <[email protected]>
  • Loading branch information
kpango committed Jan 2, 2023
1 parent b9447c8 commit 7c9c7d4
Show file tree
Hide file tree
Showing 9 changed files with 54 additions and 78 deletions.
1 change: 1 addition & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -367,6 +367,7 @@ tools/install: \
## update deps, license, and run golines, gofumpt, goimports
update: \
clean \
update/libs \
proto/all \
deps \
format \
Expand Down
22 changes: 11 additions & 11 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ replace (
github.com/armon/go-radix => github.com/armon/go-radix v1.0.0
github.com/armon/go-socks5 => github.com/armon/go-socks5 v0.0.0-20160902184237-e75332964ef5
github.com/asaskevich/govalidator => github.com/asaskevich/govalidator v0.0.0-20210307081110-f21760c49a8d
github.com/aws/aws-sdk-go => github.com/aws/aws-sdk-go v1.44.168
github.com/aws/aws-sdk-go => github.com/aws/aws-sdk-go v1.44.171
github.com/aws/aws-sdk-go-v2 => github.com/aws/aws-sdk-go-v2 v1.17.3
github.com/aws/aws-sdk-go-v2/aws/protocol/eventstream => github.com/aws/aws-sdk-go-v2/aws/protocol/eventstream v1.4.10
github.com/aws/aws-sdk-go-v2/config => github.com/aws/aws-sdk-go-v2/config v1.18.7
Expand All @@ -76,7 +76,7 @@ replace (
github.com/aws/aws-sdk-go-v2/service/internal/s3shared => github.com/aws/aws-sdk-go-v2/service/internal/s3shared v1.13.21
github.com/aws/aws-sdk-go-v2/service/kms => github.com/aws/aws-sdk-go-v2/service/kms v1.19.4
github.com/aws/aws-sdk-go-v2/service/s3 => github.com/aws/aws-sdk-go-v2/service/s3 v1.29.6
github.com/aws/aws-sdk-go-v2/service/secretsmanager => github.com/aws/aws-sdk-go-v2/service/secretsmanager v1.16.11
github.com/aws/aws-sdk-go-v2/service/secretsmanager => github.com/aws/aws-sdk-go-v2/service/secretsmanager v1.17.0
github.com/aws/aws-sdk-go-v2/service/sns => github.com/aws/aws-sdk-go-v2/service/sns v1.18.8
github.com/aws/aws-sdk-go-v2/service/sqs => github.com/aws/aws-sdk-go-v2/service/sqs v1.19.17
github.com/aws/aws-sdk-go-v2/service/ssm => github.com/aws/aws-sdk-go-v2/service/ssm v1.33.4
Expand Down Expand Up @@ -178,7 +178,7 @@ replace (
github.com/go-fonts/stix => github.com/go-fonts/stix v0.1.0
github.com/go-gl/gl => github.com/go-gl/gl v0.0.0-20211210172815-726fda9656d6
github.com/go-gl/glfw/v3.3/glfw => github.com/go-gl/glfw/v3.3/glfw v0.0.0-20221017161538-93cebf72946b
github.com/go-kit/kit => github.com/go-kit/kit v0.12.1-0.20220826005032-a7ba4fa4e289
github.com/go-kit/kit => github.com/go-kit/kit v0.12.1-0.20230102061018-e923d5df8514
github.com/go-kit/log => github.com/go-kit/log v0.2.1
github.com/go-latex/latex => github.com/go-latex/latex v0.0.0-20210823091927-c0d11ff05a81
github.com/go-logfmt/logfmt => github.com/go-logfmt/logfmt v0.5.1
Expand Down Expand Up @@ -279,7 +279,7 @@ replace (
github.com/hashicorp/mdns => github.com/hashicorp/mdns v1.0.5
github.com/hashicorp/memberlist => github.com/hashicorp/memberlist v0.5.0
github.com/hashicorp/serf => github.com/hashicorp/serf v0.10.1
github.com/hetznercloud/hcloud-go => github.com/hetznercloud/hcloud-go v1.38.0
github.com/hetznercloud/hcloud-go => github.com/hetznercloud/hcloud-go v1.39.0
github.com/iancoleman/strcase => github.com/iancoleman/strcase v0.2.0
github.com/ianlancetaylor/demangle => github.com/ianlancetaylor/demangle v0.0.0-20220517205856-0058ec4f073c
github.com/imdario/mergo => github.com/imdario/mergo v0.3.13
Expand Down Expand Up @@ -308,8 +308,8 @@ replace (
github.com/julienschmidt/httprouter => github.com/julienschmidt/httprouter v1.3.0
github.com/kisielk/errcheck => github.com/kisielk/errcheck v1.6.2
github.com/kisielk/gotool => github.com/kisielk/gotool v1.0.0
github.com/klauspost/compress => github.com/klauspost/compress v1.15.14-0.20221219154243-272fbc74c600
github.com/klauspost/cpuid/v2 => github.com/klauspost/cpuid/v2 v2.2.2
github.com/klauspost/compress => github.com/klauspost/compress v1.15.14-0.20230102085750-053e2a6cf2e6
github.com/klauspost/cpuid/v2 => github.com/klauspost/cpuid/v2 v2.2.3
github.com/kolo/xmlrpc => github.com/kolo/xmlrpc v0.0.0-20220921171641-a4b6fa1dd06b
github.com/kpango/fastime => github.com/kpango/fastime v1.1.6
github.com/kpango/fuid => github.com/kpango/fuid v0.0.0-20221203053508-503b5ad89aa1
Expand All @@ -329,7 +329,7 @@ replace (
github.com/lyft/protoc-gen-star => github.com/lyft/protoc-gen-star v0.6.2
github.com/mailru/easyjson => github.com/mailru/easyjson v0.7.7
github.com/mattn/go-colorable => github.com/mattn/go-colorable v0.1.13
github.com/mattn/go-isatty => github.com/mattn/go-isatty v0.0.16
github.com/mattn/go-isatty => github.com/mattn/go-isatty v0.0.17
github.com/mattn/go-shellwords => github.com/mattn/go-shellwords v1.0.12
github.com/mattn/go-sqlite3 => github.com/mattn/go-sqlite3 v1.14.16
github.com/matttproud/golang_protobuf_extensions => github.com/matttproud/golang_protobuf_extensions v1.0.4
Expand Down Expand Up @@ -394,7 +394,7 @@ replace (
github.com/prometheus/prometheus => github.com/prometheus/prometheus v1.99.0
github.com/prometheus/prometheus/v2 => github.com/prometheus/prometheus/v2 v2.35.0-retract
github.com/quasilyte/go-ruleguard => github.com/quasilyte/go-ruleguard v0.3.18
github.com/quasilyte/go-ruleguard/dsl => github.com/quasilyte/go-ruleguard/dsl v0.3.21
github.com/quasilyte/go-ruleguard/dsl => github.com/quasilyte/go-ruleguard/dsl v0.3.22
github.com/quasilyte/gogrep => github.com/quasilyte/gogrep v0.0.0-20221002170852-631b4cfd0c04
github.com/quasilyte/stdinfo => github.com/quasilyte/stdinfo v0.0.0-20220114132959-f7386bf02567
github.com/rogpeppe/fastuuid => github.com/rogpeppe/fastuuid v1.2.0
Expand Down Expand Up @@ -486,8 +486,8 @@ replace (
go4.org/unsafe/assume-no-moving-gc => go4.org/unsafe/assume-no-moving-gc v0.0.0-20220617031537-928513b29760
gocloud.dev => gocloud.dev v0.27.0
golang.org/x/crypto => golang.org/x/crypto v0.4.0
golang.org/x/exp => golang.org/x/exp v0.0.0-20221227203929-1b447090c38c
golang.org/x/exp/typeparams => golang.org/x/exp/typeparams v0.0.0-20221227203929-1b447090c38c
golang.org/x/exp => golang.org/x/exp v0.0.0-20221230185412-738e83a70c30
golang.org/x/exp/typeparams => golang.org/x/exp/typeparams v0.0.0-20221230185412-738e83a70c30
golang.org/x/image => golang.org/x/image v0.2.0
golang.org/x/lint => golang.org/x/lint v0.0.0-20210508222113-6edffad5e616
golang.org/x/mobile => golang.org/x/mobile v0.0.0-20221110043201-43a038452099
Expand Down Expand Up @@ -543,7 +543,7 @@ replace (
k8s.io/metrics => k8s.io/metrics v0.26.0
nhooyr.io/websocket => nhooyr.io/websocket v1.8.7
rsc.io/pdf => rsc.io/pdf v0.1.1
sigs.k8s.io/apiserver-network-proxy/konnectivity-client => sigs.k8s.io/apiserver-network-proxy/konnectivity-client v0.0.34
sigs.k8s.io/apiserver-network-proxy/konnectivity-client => sigs.k8s.io/apiserver-network-proxy/konnectivity-client v0.0.35
sigs.k8s.io/controller-runtime => sigs.k8s.io/controller-runtime v0.14.0
sigs.k8s.io/json => sigs.k8s.io/json v0.0.0-20221116044647-bc3834ca7abd
sigs.k8s.io/kustomize => sigs.k8s.io/kustomize v2.0.3+incompatible
Expand Down
28 changes: 14 additions & 14 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -183,8 +183,8 @@ github.com/ajstarks/svgo v0.0.0-20211024235047-1546f124cd8b/go.mod h1:1KcenG0jGW
github.com/akavel/rsrc v0.8.0/go.mod h1:uLoCtb9J+EyAqh+26kdrTgmzRBFPGOolLWKpdxkKq+c=
github.com/antihax/optional v1.0.0/go.mod h1:uupD/76wgC+ih3iEmQUL+0Ugr19nfwCT1kdvxnR2qWY=
github.com/armon/go-socks5 v0.0.0-20160902184237-e75332964ef5 h1:0CwZNZbxp69SHPdPJAN/hZIm0C4OItdklCFmMRWYpio=
github.com/aws/aws-sdk-go v1.44.168 h1:/NNDLkjcgW8UrvAUk7QvQS9yzo/CFu9Zp4BCiPHoV+E=
github.com/aws/aws-sdk-go v1.44.168/go.mod h1:aVsgQcEevwlmQ7qHE9I3h+dtQgpqhFB+i8Phjh7fkwI=
github.com/aws/aws-sdk-go v1.44.171 h1:maREiPAmibvuONMOEZIkCH2OTosLRnDelceTtH3SYfo=
github.com/aws/aws-sdk-go v1.44.171/go.mod h1:aVsgQcEevwlmQ7qHE9I3h+dtQgpqhFB+i8Phjh7fkwI=
github.com/aws/aws-sdk-go-v2 v1.17.3 h1:shN7NlnVzvDUgPQ+1rLMSxY8OWRNDRYtiqe0p/PgrhY=
github.com/aws/aws-sdk-go-v2 v1.17.3/go.mod h1:uzbQtefpm44goOPmdKyAlXSNcwlRgF3ePWVW6EtJvvw=
github.com/aws/aws-sdk-go-v2/aws/protocol/eventstream v1.4.10 h1:dK82zF6kkPeCo8J1e+tGx4JdvDIQzj7ygIoLg8WMuGs=
Expand Down Expand Up @@ -216,7 +216,7 @@ github.com/aws/aws-sdk-go-v2/service/internal/s3shared v1.13.21/go.mod h1:WZvNXT
github.com/aws/aws-sdk-go-v2/service/kms v1.19.4/go.mod h1:13sjgMH7Xu4e46+0BEDhSnNh+cImHSYS5PpBjV3oXcU=
github.com/aws/aws-sdk-go-v2/service/s3 v1.29.6 h1:W8pLcSn6Uy0eXgDBUUl8M8Kxv7JCoP68ZKTD04OXLEA=
github.com/aws/aws-sdk-go-v2/service/s3 v1.29.6/go.mod h1:L2l2/q76teehcW7YEsgsDjqdsDTERJeX3nOMIFlgGUE=
github.com/aws/aws-sdk-go-v2/service/secretsmanager v1.16.11/go.mod h1:jAeo/PdIJZuDSwsvxJS94G4d6h8tStj7WXVuKwLHWU8=
github.com/aws/aws-sdk-go-v2/service/secretsmanager v1.17.0/go.mod h1:jAeo/PdIJZuDSwsvxJS94G4d6h8tStj7WXVuKwLHWU8=
github.com/aws/aws-sdk-go-v2/service/sns v1.18.8/go.mod h1:iTh9DgwDnFqF5LfFHNXWAxLe9zV0/XcWaMCWXIRDqXA=
github.com/aws/aws-sdk-go-v2/service/sqs v1.19.17/go.mod h1:jQhN5f4p3PALMNlUtfb/0wGIFlV7vGtJlPDVfxfNfPY=
github.com/aws/aws-sdk-go-v2/service/ssm v1.33.4/go.mod h1:Hf7wSogKP1XCJ9GgW8erZDL6IZ1NLwLN7bYdV/Gn/LI=
Expand Down Expand Up @@ -437,10 +437,10 @@ github.com/json-iterator/go v1.1.12/go.mod h1:e30LSqwooZae/UwlEbR2852Gd8hjQvJoHm
github.com/jstemmer/go-junit-report v1.0.0/go.mod h1:Brl9GWCQeLvo8nXZwPNNblvFj/XSXhF0NWZEnDohbsk=
github.com/kisielk/errcheck v1.6.2/go.mod h1:nXw/i/MfnvRHqXa7XXmQMUB0oNFGuBrNI8d8NLy0LPw=
github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck=
github.com/klauspost/compress v1.15.14-0.20221219154243-272fbc74c600 h1:D8nziFSzb1WUvz6fxSccsNOJoQj94Gw4vF3e+6O84GQ=
github.com/klauspost/compress v1.15.14-0.20221219154243-272fbc74c600/go.mod h1:QPwzmACJjUTFsnSHH934V6woptycfrDDJnH7hvFVbGM=
github.com/klauspost/cpuid/v2 v2.2.2 h1:xPMwiykqNK9VK0NYC3+jTMYv9I6Vl3YdjZgPZKG3zO0=
github.com/klauspost/cpuid/v2 v2.2.2/go.mod h1:RVVoqg1df56z8g3pUjL/3lE5UfnlrJX8tyFgg4nqhuY=
github.com/klauspost/compress v1.15.14-0.20230102085750-053e2a6cf2e6 h1:MFYogW4zuQGMu0jm0Q2y03b+qojYDbh1i/H5OlPa/fs=
github.com/klauspost/compress v1.15.14-0.20230102085750-053e2a6cf2e6/go.mod h1:QPwzmACJjUTFsnSHH934V6woptycfrDDJnH7hvFVbGM=
github.com/klauspost/cpuid/v2 v2.2.3 h1:sxCkb+qR91z4vsqw4vGGZlDgPz3G7gjaLyK3V8y70BU=
github.com/klauspost/cpuid/v2 v2.2.3/go.mod h1:RVVoqg1df56z8g3pUjL/3lE5UfnlrJX8tyFgg4nqhuY=
github.com/kpango/fastime v1.1.6 h1:lAw1Tiwnlbsx1xZs6W9eM7/8niwabknewbmLkh/yTVo=
github.com/kpango/fastime v1.1.6/go.mod h1:tTNDbIo5qL6D7g5vh2YbkyUbOVP2kD/we3rSjN22PMY=
github.com/kpango/fuid v0.0.0-20221203053508-503b5ad89aa1 h1:rxyM+7uaZQ35P9fbixdnld/h4AgEhODoubuy6A4nDdk=
Expand Down Expand Up @@ -472,7 +472,7 @@ github.com/lyft/protoc-gen-star v0.6.2/go.mod h1:M0b1EfeJR3f8E3YHKFr9KXWjAB4mrKn
github.com/mailru/easyjson v0.7.7 h1:UGYAvKxe3sBsEDzO8ZeWOSlIQfWFlxbzLZe7hwFURr0=
github.com/mailru/easyjson v0.7.7/go.mod h1:xzfreul335JAWq5oZzymOObrkdz5UnU4kGfJJLY9Nlc=
github.com/mattn/go-colorable v0.1.13/go.mod h1:7S9/ev0klgBDR4GtXTXX8a3vIGJpMovkB8vQcUbaXHg=
github.com/mattn/go-isatty v0.0.16/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/yFXSvRLM=
github.com/mattn/go-isatty v0.0.17/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/yFXSvRLM=
github.com/mattn/go-sqlite3 v1.14.16 h1:yOQRA0RpS5PFz/oikGwBEqvAWhWg5ufRz4ETLjwpU1Y=
github.com/matttproud/golang_protobuf_extensions v1.0.4 h1:mmDVorXM7PCGKw94cs5zkfA9PSy5pEvNWRP0ET0TIVo=
github.com/matttproud/golang_protobuf_extensions v1.0.4/go.mod h1:BSXmuO+STAnVfrANrmjBb36TMTDstsz7MSK+HVaYKv4=
Expand Down Expand Up @@ -529,8 +529,8 @@ github.com/prometheus/procfs v0.9.0/go.mod h1:+pB4zwohETzFnmlpe6yd2lSc+0/46IYZRB
github.com/prometheus/prometheus v1.99.0/go.mod h1:Sw35iJlN8dvKz51BtqxhXpNLIfqNn9IFAo64r7XL9Bw=
github.com/quasilyte/go-ruleguard v0.3.18 h1:sd+abO1PEI9fkYennwzHn9kl3nqP6M5vE7FiOzZ+5CE=
github.com/quasilyte/go-ruleguard v0.3.18/go.mod h1:lOIzcYlgxrQ2sGJ735EHXmf/e9MJ516j16K/Ifcttvs=
github.com/quasilyte/go-ruleguard/dsl v0.3.21 h1:vNkC6fC6qMLzCOGbnIHOd5ixUGgTbp3Z4fGnUgULlDA=
github.com/quasilyte/go-ruleguard/dsl v0.3.21/go.mod h1:KeCP03KrjuSO0H1kTuZQCWlQPulDV6YMIXmpQss17rU=
github.com/quasilyte/go-ruleguard/dsl v0.3.22 h1:wd8zkOhSNr+I+8Qeciml08ivDt1pSXe60+5DqOpCjPE=
github.com/quasilyte/go-ruleguard/dsl v0.3.22/go.mod h1:KeCP03KrjuSO0H1kTuZQCWlQPulDV6YMIXmpQss17rU=
github.com/quasilyte/gogrep v0.0.0-20221002170852-631b4cfd0c04 h1:k0f646qmNmESZDZ8SG5gsc2g1Nl21Z+0Kk5kB4xkG/4=
github.com/quasilyte/gogrep v0.0.0-20221002170852-631b4cfd0c04/go.mod h1:Cm9lpz9NZjEoL1tgZ2OgeUKPIxL1meE7eo60Z6Sk+Ng=
github.com/quasilyte/stdinfo v0.0.0-20220114132959-f7386bf02567 h1:M8mH9eK4OUR4lu7Gd+PU1fV2/qnDNfzT635KRSObncs=
Expand Down Expand Up @@ -627,10 +627,10 @@ gocloud.dev v0.27.0 h1:j0WTUsnKTxCsWO7y8T+YCiBZUmLl9w/WIowqAY3yo0g=
gocloud.dev v0.27.0/go.mod h1:YlYKhYsY5/1JdHGWQDkAuqkezVKowu7qbe9aIeUF6p0=
golang.org/x/crypto v0.4.0 h1:UVQgzMY87xqpKNgb+kDsll2Igd33HszWHFLmpaRMq/8=
golang.org/x/crypto v0.4.0/go.mod h1:3quD/ATkf6oY+rnes5c3ExXTbLc8mueNue5/DoinL80=
golang.org/x/exp v0.0.0-20221227203929-1b447090c38c h1:Govq2W3bnHJimHT2ium65kXcI7ZzTniZHcFATnLJM0Q=
golang.org/x/exp v0.0.0-20221227203929-1b447090c38c/go.mod h1:CxIveKay+FTh1D0yPZemJVgC/95VzuuOLq5Qi4xnoYc=
golang.org/x/exp/typeparams v0.0.0-20221227203929-1b447090c38c h1:kI+OjQKHenpYTAI1sYImhjYX88h95/j/iebvjVkz/rY=
golang.org/x/exp/typeparams v0.0.0-20221227203929-1b447090c38c/go.mod h1:AbB0pIl9nAr9wVwH+Z2ZpaocVmF5I4GyWCDIsVjR0bk=
golang.org/x/exp v0.0.0-20221230185412-738e83a70c30 h1:m9O6OTJ627iFnN2JIWfdqlZCzneRO6EEBsHXI25P8ws=
golang.org/x/exp v0.0.0-20221230185412-738e83a70c30/go.mod h1:CxIveKay+FTh1D0yPZemJVgC/95VzuuOLq5Qi4xnoYc=
golang.org/x/exp/typeparams v0.0.0-20221230185412-738e83a70c30 h1:OOrxyXKPN1F8ptsIzrNVWcfjc4vW0WTaRxepDiNDlO8=
golang.org/x/exp/typeparams v0.0.0-20221230185412-738e83a70c30/go.mod h1:AbB0pIl9nAr9wVwH+Z2ZpaocVmF5I4GyWCDIsVjR0bk=
golang.org/x/image v0.2.0 h1:/DcQ0w3VHKCC5p0/P2B0JpAZ9Z++V2KOo2fyU89CXBQ=
golang.org/x/image v0.2.0/go.mod h1:la7oBXb9w3YFjBqaAwtynVioc1ZvOnNteUNrifGNmAI=
golang.org/x/lint v0.0.0-20210508222113-6edffad5e616 h1:VLliZ0d+/avPrXXH+OakdXhpJuEoBZuwh1m2j7U6Iug=
Expand Down
2 changes: 1 addition & 1 deletion k8s/discoverer/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ spec:
app.kubernetes.io/instance: release-name
app.kubernetes.io/component: discoverer
annotations:
checksum/configmap: febb14192dedc53a8a38b88b24a7a93654111e6cab2f489d8118ffb4d410e69f
checksum/configmap: 9ad0f3962a476c05865348d478d0b106337b5f2b18ed545c4cc5aedc890101eb
profefe.com/enable: "true"
profefe.com/port: "6060"
profefe.com/service: vald-discoverer
Expand Down
2 changes: 1 addition & 1 deletion k8s/gateway/lb/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ spec:
app.kubernetes.io/instance: release-name
app.kubernetes.io/component: gateway-lb
annotations:
checksum/configmap: c879a5db76b206022708d44df9b5c7a58492799b59e99d3758690adecb9fed8d
checksum/configmap: 715437214d24d49a8ce10982ec0a4710006ee8cce9e607e9506d55a4c33152c2
profefe.com/enable: "true"
profefe.com/port: "6060"
profefe.com/service: vald-lb-gateway
Expand Down
2 changes: 1 addition & 1 deletion k8s/manager/index/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ spec:
app.kubernetes.io/instance: release-name
app.kubernetes.io/component: manager-index
annotations:
checksum/configmap: 767c20f44a3e62f699601281d0b59d65ef0e1d6e38c85f1a1510705c9871d3d5
checksum/configmap: 4ad80adc7715c4f8ce0f4d8cc5bcb9d2aaab9781711b42b078172e0ca7e91d43
profefe.com/enable: "true"
profefe.com/port: "6060"
profefe.com/service: vald-manager-index
Expand Down
2 changes: 1 addition & 1 deletion pkg/agent/core/ngt/service/ngt.go
Original file line number Diff line number Diff line change
Expand Up @@ -907,7 +907,7 @@ func (n *ngt) CreateIndex(ctx context.Context, poolSize uint32) (err error) {
delete(n.fmap, uuid)
}
n.fmu.Unlock()
log.Debugf("inserted to ngt index and kvsdb id: %s, oid: %d", uuid, oid)
log.Debugf("finished to insert ngt index and kvsdb id: %s, oid: %d", uuid, oid)
return true
})
if poolSize <= 0 {
Expand Down
71 changes: 23 additions & 48 deletions pkg/agent/core/ngt/service/ngt_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -10676,28 +10676,31 @@ func Test_ngt_InsertUpsert(t *testing.T) {
vqueueCfg = &config.VQueue{}
)
tests := []test{
{
name: "insert & upsert 10000000 random and 11 digits added to each vector element",
args: args{
idxes: createRandomData(10000000, &createRandomDataConfig{
additionaldigits: 11,
}),
poolSize: 100000,
bulkSize: 100000,
},
fields: fields{
svcCfg: &config.NGT{
Dimension: 128,
DistanceType: core.Cosine.String(),
ObjectType: core.Uint8.String(),
KVSDB: kvsdbCfg,
VQueue: vqueueCfg,
func() test {
count := 10000000
return test{
name: fmt.Sprintf("insert & upsert %d random and 11 digits added to each vector element", count),
args: args{
idxes: createRandomData(count, &createRandomDataConfig{
additionaldigits: 11,
}),
poolSize: uint32(count / 10),
bulkSize: count / 10,
},
svcOpts: []Option{
WithEnableInMemoryMode(true),
fields: fields{
svcCfg: &config.NGT{
Dimension: 128,
DistanceType: core.Cosine.String(),
ObjectType: core.Uint8.String(),
KVSDB: kvsdbCfg,
VQueue: vqueueCfg,
},
svcOpts: []Option{
WithEnableInMemoryMode(true),
},
},
},
},
}
}(),
}
for _, tc := range tests {
test := tc
Expand All @@ -10724,29 +10727,13 @@ func Test_ngt_InsertUpsert(t *testing.T) {
if err != nil {
tt.Errorf("failed to init ngt service, error = %v", err)
}
var wg sync.WaitGroup
count := 0
for _, idx := range test.args.idxes {
count++
err = n.Insert(idx.uuid, idx.vec)
if err := checkFunc(test.want, err); err != nil {
tt.Errorf("error = %v", err)
}

if count >= test.args.bulkSize {
wg.Add(1)
eg.Go(func() error {
defer wg.Done()
err = n.CreateAndSaveIndex(ctx, test.args.poolSize)
if err != nil {
tt.Errorf("error creating index: %v", err)
}
return nil
})
count = 0
}
}
wg.Wait()

log.Warn("start create index operation")
err = n.CreateAndSaveIndex(ctx, test.args.poolSize)
Expand All @@ -10758,42 +10745,30 @@ func Test_ngt_InsertUpsert(t *testing.T) {
idx := i
eg.Go(func() error {
log.Warnf("started %d-1", idx)
var wgu sync.WaitGroup
count = 0
for _, idx := range test.args.idxes[:len(test.args.idxes)/3] {
count++
_ = n.Delete(idx.uuid)
_ = n.Insert(idx.uuid, idx.vec)
}
wgu.Wait()
log.Warnf("finished %d-1", idx)
return nil
})

eg.Go(func() error {
log.Warnf("started %d-2", idx)
var wgu sync.WaitGroup
count = 0
for _, idx := range test.args.idxes[len(test.args.idxes)/3 : 2*len(test.args.idxes)/3] {
count++
_ = n.Delete(idx.uuid)
_ = n.Insert(idx.uuid, idx.vec)
}
wgu.Wait()
log.Warnf("finished %d-2", idx)
return nil
})

eg.Go(func() error {
log.Warnf("started %d-3", idx)
var wgu sync.WaitGroup
count = 0
for _, idx := range test.args.idxes[2*len(test.args.idxes)/3:] {
count++
_ = n.Delete(idx.uuid)
_ = n.Insert(idx.uuid, idx.vec)
}
wgu.Wait()
log.Warnf("finished %d-3", idx)
return nil
})
Expand Down
2 changes: 1 addition & 1 deletion versions/PROMETHEUS_STACK_VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
43.2.0
43.2.1

0 comments on commit 7c9c7d4

Please sign in to comment.