Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUGFIX] index correction process #2564

Conversation

kpango
Copy link
Collaborator

@kpango kpango commented Aug 5, 2024

Description

  1. Internal Configuration:

    • Updated internal/config/corrector.go to include new fields KVSBackgroundSyncInterval and KVSBackgroundCompactionInterval.
    • Added a new Gateway configuration.
    • Updated the corresponding test file corrector_test.go to reflect these changes.
  2. Helm Charts:

    • Updated charts/vald-helm-operator/crds/valdrelease.yaml to include new configuration options for the gateway and KVS intervals.
    • Modified charts/vald/templates/index/job/correction/configmap.yaml to integrate the new configuration options.
    • Updated charts/vald/values.schema.json and charts/vald/values.yaml to support the new configuration settings.
  3. Dockerfiles:

    • Minor adjustments in dockers/agent/core/agent/Dockerfile and dockers/dev/Dockerfile to ensure consistency.
  4. Kubernetes Configurations:

    • Added and updated several Kubernetes configuration files for index correction, creation, and save jobs, as well as the index operator.
    • These changes ensure that the new configuration options are properly integrated and utilized.

These changes collectively address the bug fix related to the index correction process and ensure that the new configuration options are properly integrated across the system.

Related Issue

Versions

  • Vald Version: v1.7.12
  • Go Version: v1.22.5
  • Rust Version: v1.80.0
  • Docker Version: v27.1.1
  • Kubernetes Version: v1.30.3
  • Helm Version: v3.15.3
  • NGT Version: v2.2.4
  • Faiss Version: v1.8.0

Checklist

Special notes for your reviewer

Summary by CodeRabbit

Summary by CodeRabbit

  • New Features

    • Introduced a comprehensive configuration for the Vald indexing service, enhancing observability, server management, and connection handling.
    • Added configuration options for gateway behavior, including properties for connection management and error handling.
    • Implemented new Kubernetes ConfigMaps for the Vald indexing operator and correction service to streamline configuration management.
    • Introduced support for background synchronization and compaction intervals in the KVS configuration.
    • Added new functional options for the index corrector, improving error handling and concurrency configuration.
    • Added new Dockerfiles for managing multi-stage builds.
    • Updated Kubernetes deployment configurations to enhance modularity and flexibility.
  • Bug Fixes

    • Enhanced error handling for gateway client interactions and improved logic for managing vector corrections.
  • Documentation

    • Updated configuration files and README to reflect new features and parameters for the Vald indexing service.
  • Refactor

    • Simplified variable naming and structure across various components for better readability and maintainability.
    • Replaced hardcoded paths with dynamic variables in deployment scripts for improved flexibility.
  • Chores

    • Updated dependencies to their latest versions for improved performance and security.
    • Updated version numbers for several components, indicating minor revisions and enhancements.

Copy link
Contributor

coderabbitai bot commented Aug 5, 2024

Warning

Rate limit exceeded

@kpango has exceeded the limit for the number of commits or files that can be reviewed per hour. Please wait 23 minutes and 1 seconds before requesting another review.

How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

Commits

Files that changed from the base of the PR and between 9f8bc40 and ffd2754.

Walkthrough

Walkthrough

Recent updates enhance the modularity, maintainability, and functionality of the codebase across various components. Key improvements include restructuring variables in the Makefile for clarity, refining Kubernetes configurations for vald services, and updating the Corrector service to manage background synchronization and compaction more effectively. Additionally, tests have been revised to ensure comprehensive validation of the new functionalities introduced in the system.

Changes

Files Change Summary
Makefile, Makefile.d/* Restructured variable definitions for clarity; introduced new variables for enhanced modularity in build targets.
charts/... Added new gateway configuration options and modified existing properties for improved operational capabilities.
internal/config/corrector.go, internal/config/corrector_test.go Updated Corrector struct to manage new background synchronization and compaction intervals; refined associated tests.
Makefile.d/k8s.mk Introduced new Kubernetes configurations for various components, enhancing operational settings and health checks.
go.mod Updated versions of several Go modules to maintain currency and improve performance.
versions/* Incremented version numbers for various components, reflecting updates and minor improvements.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant Corrector
    participant Gateway
    participant Configurator

    User->>Configurator: Configure Corrector settings
    Configurator->>Corrector: Pass settings
    Corrector->>Gateway: Initialize with new settings
    Corrector->>Corrector: Start correction process
    Corrector->>Gateway: Fetch vector data
    Gateway-->>Corrector: Return vector data
    Corrector->>Corrector: Process and correct vectors
    Corrector-->>User: Return correction results
Loading

Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

Share
Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai generate interesting stats about this repository and render them as a table.
    • @coderabbitai show all the console.log statements in this repository.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (invoked as PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Additionally, you can add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@vdaas-ci
Copy link
Collaborator

vdaas-ci commented Aug 5, 2024

[WARNING:INTCFG] Changes in interal/config may require you to change Helm charts. Please check.

@vdaas-ci
Copy link
Collaborator

vdaas-ci commented Aug 5, 2024

[CHATOPS:HELP] ChatOps commands.

  • 🙆‍♀️ /approve - approve
  • 🍱 /format - format codes and add licenses
  • /gen-test - generate test codes
  • 🏷️ /label - add labels
  • 🔚 2️⃣ 🔚 /label actions/e2e-deploy - run E2E deploy & integration test

Copy link

cloudflare-workers-and-pages bot commented Aug 5, 2024

Deploying vald with  Cloudflare Pages  Cloudflare Pages

Latest commit: ffd2754
Status: ✅  Deploy successful!
Preview URL: https://1fc17638.vald.pages.dev
Branch Preview URL: https://bugfix-index-correction-refa.vald.pages.dev

View logs

@kpango kpango force-pushed the bugfix/index-correction/refactor-and-bugfix-index-correction branch from e0c1b58 to 5c11b80 Compare August 5, 2024 01:28
Copy link

codecov bot commented Aug 5, 2024

Codecov Report

Attention: Patch coverage is 1.25261% with 473 lines in your changes missing coverage. Please review.

Project coverage is 17.41%. Comparing base (ba5a9d5) to head (9f8bc40).
Report is 1 commits behind head on main.

Files Patch % Lines
pkg/index/job/correction/service/corrector.go 0.00% 432 Missing ⚠️
pkg/index/job/correction/service/options.go 7.40% 24 Missing and 1 partial ⚠️
pkg/index/job/correction/usecase/corrector.go 0.00% 11 Missing ⚠️
internal/config/corrector.go 0.00% 4 Missing ⚠️
internal/db/kvs/pogreb/options.go 50.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2564      +/-   ##
==========================================
- Coverage   17.56%   17.41%   -0.16%     
==========================================
  Files         566      566              
  Lines       68930    69043     +113     
==========================================
- Hits        12110    12023      -87     
- Misses      56003    56225     +222     
+ Partials      817      795      -22     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@kpango kpango force-pushed the bugfix/index-correction/refactor-and-bugfix-index-correction branch 3 times, most recently from 17608d5 to 6faa326 Compare August 5, 2024 04:57
deepsource-autofix bot added a commit that referenced this pull request Aug 5, 2024
This commit fixes the style issues introduced in 6faa326 according to the output
from Gofumpt and Prettier.

Details: #2564
@kpango kpango force-pushed the bugfix/index-correction/refactor-and-bugfix-index-correction branch from dfa647d to f0c17db Compare August 5, 2024 06:40
@kpango kpango force-pushed the bugfix/index-correction/refactor-and-bugfix-index-correction branch 2 times, most recently from 2b61f70 to 9322c54 Compare August 5, 2024 06:41
@kpango kpango changed the title WIP [BUGFIX] index correction process [BUGFIX] index correction process Aug 5, 2024
@kpango kpango force-pushed the bugfix/index-correction/refactor-and-bugfix-index-correction branch from 9322c54 to e5b414a Compare August 5, 2024 06:58
@kpango
Copy link
Collaborator Author

kpango commented Aug 5, 2024

@coderabbitai full-review and summary

Copy link
Contributor

coderabbitai bot commented Aug 5, 2024

@kpango: Here's a summary of the changes made in this PR:

Summary

  1. Internal Configuration:

    • Updated internal/config/corrector.go to include new fields KVSBackgroundSyncInterval and KVSBackgroundCompactionInterval.
    • Added a new Gateway configuration.
    • Updated the corresponding test file corrector_test.go to reflect these changes.
  2. Helm Charts:

    • Updated charts/vald-helm-operator/crds/valdrelease.yaml to include new configuration options for the gateway and KVS intervals.
    • Modified charts/vald/templates/index/job/correction/configmap.yaml to integrate the new configuration options.
    • Updated charts/vald/values.schema.json and charts/vald/values.yaml to support the new configuration settings.
  3. Dockerfiles:

    • Minor adjustments in dockers/agent/core/agent/Dockerfile and dockers/dev/Dockerfile to ensure consistency.
  4. Kubernetes Configurations:

    • Added and updated several Kubernetes configuration files for index correction, creation, and save jobs, as well as the index operator.
    • These changes ensure that the new configuration options are properly integrated and utilized.

These changes collectively address the bug fix related to the index correction process and ensure that the new configuration options are properly integrated across the system.

Analysis chain
Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# List the files changed in the PR
git diff --name-only origin/main

Length of output: 1388


Script:

#!/bin/bash
# Show diffs for the internal/config directory
git diff origin/main -- internal/config/corrector.go internal/config/corrector_test.go

# Show diffs for the Helm charts
git diff origin/main -- charts/vald-helm-operator/crds/valdrelease.yaml charts/vald/README.md charts/vald/templates/index/job/correction/configmap.yaml charts/vald/values.schema.json charts/vald/values.yaml

# Show diffs for the Dockerfiles
git diff origin/main -- dockers/agent/core/agent/Dockerfile dockers/dev/Dockerfile

# Show diffs for the Kubernetes configurations
git diff origin/main -- k8s/index/job/correction/configmap.yaml k8s/index/job/correction/cronjob.yaml k8s/index/job/creation/configmap.yaml k8s/index/job/creation/cronjob.yaml k8s/index/job/save/configmap.yaml k8s/index/job/save/cronjob.yaml k8s/index/operator/configmap.yaml k8s/index/operator/deployment.yaml k8s/index/operator/priorityclass.yaml k8s/operator/helm/crds/valdrelease.yaml

Length of output: 174593

Actions performed

Full review triggered.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 11

Outside diff range, codebase verification and nitpick comments (15)
charts/vald/README.md (1)

Line range hint 1-1:
File content missing.

The content of the file charts/vald/README.md is missing, making it impossible to review the changes.

Please provide the complete content of the file for a thorough review.

charts/vald/values.schema.json (1)

Line range hint 1-1:
File content missing.

The content of the file charts/vald/values.schema.json is missing, making it impossible to review the changes.

Please provide the complete content of the file for a thorough review.

internal/db/kvs/pogreb/pogreb_test.go (1)

125-126: Ensure consistency in the refactor from Pogreb to DB.

The following files still contain references to Pogreb and should be updated to DB:

  • pkg/index/job/correction/service/corrector_test.go
    • Lines containing checkedList pogreb.DB
  • pkg/index/job/correction/service/corrector.go
    • Lines containing checkedList pogreb.DB
    • Lines containing pogreb.New, pogreb.WithPath, pogreb.WithBackgroundCompactionInterval, pogreb.WithBackgroundSyncInterval
  • internal/db/kvs/pogreb/pogreb.go
    • Lines containing pogreb.DB, pogreb.Options, pogreb.Open, pogreb.ErrIterationDone
  • internal/db/kvs/pogreb/options.go
    • Lines containing pogreb.Options, WithPath("pogreb.db")

Please update these references to ensure consistency across the codebase.

Analysis chain

LGTM! Ensure consistency across the codebase.

The change from Pogreb to DB in the beforeFunc and afterFunc parameters is consistent with a refactor to standardize the database interface.

However, ensure that all references to Pogreb have been updated to DB across the codebase.

Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify all references to `Pogreb` have been updated to `DB`.

# Test: Search for the usage of `Pogreb`. Expect: No occurrences of `Pogreb`.
rg --type go 'Pogreb'

Length of output: 21


Script:

#!/bin/bash
# Description: Verify all references to `Pogreb` have been updated to `DB`.

# Test: Search for the usage of `Pogreb`. Expect: No occurrences of `Pogreb`.
rg 'Pogreb'

Length of output: 11


Script:

#!/bin/bash
# Description: Verify all references to `Pogreb` have been updated to `DB`.

# Test: Search for the usage of `Pogreb` and its variations. Expect: No occurrences of `Pogreb`.
rg -i 'Pogreb'

Length of output: 2919

pkg/index/job/correction/service/corrector_test.go (2)

366-376: Ensure proper initialization of new fields in correct struct.

The new fields in the correct struct are commented out and not being initialized in the active code. This needs to be addressed to avoid potential runtime errors.

  • Lines 366-376 in pkg/index/job/correction/service/corrector_test.go
Analysis chain

Ensure proper initialization of new fields in correct struct.

The new fields in the correct struct should be properly initialized in the implementation to avoid potential runtime errors.

Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the initialization of new fields in the `correct` struct.

# Test: Search for the initialization of the new fields. Expect: Proper initialization.
rg --type go 'correct\{'

Length of output: 458


Script:

#!/bin/bash
# Extract the context around the initialization of the `correct` struct to verify the proper initialization of its fields.
rg --type go 'c := &correct{' -A 20

Length of output: 129


Script:

#!/bin/bash
# Extract the context around the initialization of the `correct` struct to verify the proper initialization of its fields.
rg --type go 'c := &correct\{' -A 20

Length of output: 12066


112-119: Potential test coverage issue for discoverer.Client

The removal of the mockDiscovererClient struct and its methods, combined with the absence of active references or mock implementations for discoverer.Client in corrector_test.go, suggests that the test coverage for this client might be incomplete.

  • pkg/index/job/correction/service/corrector_test.go: Multiple commented-out references to discoverer.Client.

Please ensure that the new testing strategy provides equivalent or improved test coverage for discoverer.Client.

Analysis chain

Removed mockDiscovererClient struct and methods.

The removal of the mockDiscovererClient struct and its methods indicates a significant change in the testing strategy. Ensure that the new approach provides equivalent or improved test coverage.

Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify that the removal of mockDiscovererClient struct and methods are compensated by equivalent test coverage.

# Test: Search for the usage of mockDiscovererClient. Expect: No remaining references.
rg --type go 'mockDiscovererClient'

Length of output: 35


Script:

#!/bin/bash
# Description: Verify that the removal of mockDiscovererClient struct and methods are compensated by equivalent test coverage.

# Test: Search for test files in the `pkg/index/job/correction/service` directory.
fd --type f --extension go --exec rg --type go 'func Test' {}

# Test: Search for the usage of other mock structures or methods that might replace mockDiscovererClient.
rg --type go 'mock'

Length of output: 163757


Script:

#!/bin/bash
# Description: Verify that the removal of mockDiscovererClient struct and methods are compensated by equivalent test coverage.

# Test: Search for the usage of discoverer.Client in the test files.
rg --type go 'discoverer.Client' -g '*_test.go'

Length of output: 2947


Script:

#!/bin/bash
# Description: Verify that the removal of mockDiscovererClient struct and methods are compensated by equivalent test coverage.

# Test: Search for mock implementations or new test strategies for discoverer.Client in corrector_test.go and other relevant test files.
rg --type go 'discoverer.Client' -A 10 -g 'pkg/index/job/correction/service/corrector_test.go'

Length of output: 6245

charts/vald-helm-operator/crds/valdrelease.yaml (8)

7891-7897: Add documentation for the gateway.addrs property.

The addrs property is correctly defined as an array of strings. Ensure there is documentation explaining its usage and expected values.


7915-7917: Add documentation for the call_option property.

The call_option property is defined but lacks specific properties. Ensure there is documentation explaining its purpose and how it should be configured.


7932-7943: Add documentation for the connection_pool property.

The connection_pool property includes several nested properties. Ensure there is documentation explaining its usage, especially for properties like enable_dns_resolver, enable_rebalance, old_conn_close_duration, and rebalance_duration.


8044-8045: Add documentation for the health_check_duration property.

The health_check_duration property is correctly defined as a string. Ensure there is documentation explaining its usage and expected format.


8051-8064: Add documentation for the tls property.

The tls property includes several nested properties. Ensure there is documentation explaining its usage, especially for properties like ca, cert, enabled, insecure_skip_verify, and key.


8065-8065: Add documentation for the wait_for_ready property.

The wait_for_ready property is correctly defined as a boolean. Ensure there is documentation explaining its usage and expected values.


8084-8085: Add documentation for the kvs_background_compaction_interval property.

The kvs_background_compaction_interval property is correctly defined as a string. Ensure there is documentation explaining its usage and expected format.


8086-8087: Add documentation for the kvs_background_sync_interval property.

The kvs_background_sync_interval property is correctly defined as a string. Ensure there is documentation explaining its usage and expected format.

k8s/operator/helm/crds/valdrelease.yaml (2)

8086-8087: Incomplete replacement of kvs_async_write_concurrency with kvs_background_sync_interval.

The property kvs_async_write_concurrency is still present in cmd/index/job/correction/sample.yaml. Ensure that all instances of kvs_async_write_concurrency are replaced with kvs_background_sync_interval to maintain consistency.

  • cmd/index/job/correction/sample.yaml
Analysis chain

Property change: kvs_async_write_concurrency to kvs_background_sync_interval.

The property kvs_async_write_concurrency has been replaced with kvs_background_sync_interval. Verify the impact of this change on data handling and performance.

Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the impact of the change from `kvs_async_write_concurrency` to `kvs_background_sync_interval`.

# Test: Search for the usage of `kvs_background_sync_interval` and ensure it replaces `kvs_async_write_concurrency`.
rg --type yaml -A 5 'kvs_background_sync_interval:'

Length of output: 2863


Script:

#!/bin/bash
# Description: Verify if `kvs_async_write_concurrency` has been completely removed or replaced.

# Test: Search for any remaining instances of `kvs_async_write_concurrency`.
rg --type yaml -A 5 'kvs_async_write_concurrency:'

Length of output: 386


8084-8085: Inconsistency found: kvs_async_write_concurrency not fully replaced.

The property kvs_async_write_concurrency has not been fully replaced with kvs_background_compaction_interval. There is still an instance of kvs_async_write_concurrency in the file cmd/index/job/correction/sample.yaml. Please update this instance to ensure consistency across the codebase.

  • cmd/index/job/correction/sample.yaml
Analysis chain

Property change: kvs_async_write_concurrency to kvs_background_compaction_interval.

The property kvs_async_write_concurrency has been replaced with kvs_background_compaction_interval. Verify the impact of this change on data handling and performance.


Let's verify if kvs_async_write_concurrency has been completely removed from the codebase.

Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the impact of the change from `kvs_async_write_concurrency` to `kvs_background_compaction_interval`.

# Test: Search for the usage of `kvs_background_compaction_interval` and ensure it replaces `kvs_async_write_concurrency`.
rg --type yaml -A 5 'kvs_background_compaction_interval:'

Length of output: 2825


Script:

#!/bin/bash
# Description: Verify if `kvs_async_write_concurrency` has been completely removed from the codebase.

# Test: Search for any remaining instances of `kvs_async_write_concurrency`.
rg --type yaml 'kvs_async_write_concurrency'

Length of output: 117

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 70d9daa and e5b414a.

Files ignored due to path filters (2)
  • go.sum is excluded by !**/*.sum
  • rust/Cargo.lock is excluded by !**/*.lock
Files selected for processing (39)
  • Makefile (1 hunks)
  • Makefile.d/dependencies.mk (1 hunks)
  • Makefile.d/k8s.mk (2 hunks)
  • Makefile.d/proto.mk (2 hunks)
  • Makefile.d/test.mk (1 hunks)
  • charts/vald-helm-operator/crds/valdrelease.yaml (2 hunks)
  • charts/vald/README.md (1 hunks)
  • charts/vald/templates/index/job/correction/configmap.yaml (1 hunks)
  • charts/vald/values.schema.json (2 hunks)
  • charts/vald/values.yaml (1 hunks)
  • dockers/agent/core/agent/Dockerfile (1 hunks)
  • dockers/dev/Dockerfile (1 hunks)
  • go.mod (7 hunks)
  • internal/config/corrector.go (2 hunks)
  • internal/config/corrector_test.go (4 hunks)
  • internal/db/kvs/pogreb/options.go (2 hunks)
  • internal/db/kvs/pogreb/options_test.go (2 hunks)
  • internal/db/kvs/pogreb/pogreb.go (2 hunks)
  • internal/db/kvs/pogreb/pogreb_test.go (13 hunks)
  • k8s/index/job/correction/configmap.yaml (1 hunks)
  • k8s/index/job/correction/cronjob.yaml (1 hunks)
  • k8s/index/job/creation/configmap.yaml (1 hunks)
  • k8s/index/job/creation/cronjob.yaml (1 hunks)
  • k8s/index/job/save/configmap.yaml (1 hunks)
  • k8s/index/job/save/cronjob.yaml (1 hunks)
  • k8s/index/operator/configmap.yaml (1 hunks)
  • k8s/index/operator/deployment.yaml (1 hunks)
  • k8s/index/operator/priorityclass.yaml (1 hunks)
  • k8s/operator/helm/crds/valdrelease.yaml (2 hunks)
  • pkg/agent/core/ngt/service/ngt_test.go (3 hunks)
  • pkg/gateway/lb/handler/grpc/handler_test.go (3 hunks)
  • pkg/index/job/correction/service/corrector.go (3 hunks)
  • pkg/index/job/correction/service/corrector_test.go (26 hunks)
  • pkg/index/job/correction/service/options.go (3 hunks)
  • pkg/index/job/correction/service/options_test.go (6 hunks)
  • pkg/index/job/correction/usecase/corrector.go (4 hunks)
  • versions/CMAKE_VERSION (1 hunks)
  • versions/PROMETHEUS_STACK_VERSION (1 hunks)
  • versions/actions/ACTIONS_UPLOAD_ARTIFACT (1 hunks)
Files skipped from review due to trivial changes (5)
  • Makefile
  • dockers/agent/core/agent/Dockerfile
  • dockers/dev/Dockerfile
  • versions/CMAKE_VERSION
  • versions/actions/ACTIONS_UPLOAD_ARTIFACT
Additional context used
GitHub Check: codecov/patch
internal/config/corrector.go

[warning] 63-64: internal/config/corrector.go#L63-L64
Added lines #L63 - L64 were not covered by tests


[warning] 69-70: internal/config/corrector.go#L69-L70
Added lines #L69 - L70 were not covered by tests

pkg/index/job/correction/service/corrector.go

[warning] 86-89: pkg/index/job/correction/service/corrector.go#L86-L89
Added lines #L86 - L89 were not covered by tests


[warning] 92-98: pkg/index/job/correction/service/corrector.go#L92-L98
Added lines #L92 - L98 were not covered by tests


[warning] 100-100: pkg/index/job/correction/service/corrector.go#L100
Added line #L100 was not covered by tests


[warning] 104-106: pkg/index/job/correction/service/corrector.go#L104-L106
Added lines #L104 - L106 were not covered by tests


[warning] 108-108: pkg/index/job/correction/service/corrector.go#L108
Added line #L108 was not covered by tests


[warning] 110-110: pkg/index/job/correction/service/corrector.go#L110
Added line #L110 was not covered by tests


[warning] 112-112: pkg/index/job/correction/service/corrector.go#L112
Added line #L112 was not covered by tests


[warning] 114-121: pkg/index/job/correction/service/corrector.go#L114-L121
Added lines #L114 - L121 were not covered by tests


[warning] 123-127: pkg/index/job/correction/service/corrector.go#L123-L127
Added lines #L123 - L127 were not covered by tests


[warning] 132-132: pkg/index/job/correction/service/corrector.go#L132
Added line #L132 was not covered by tests


[warning] 135-137: pkg/index/job/correction/service/corrector.go#L135-L137
Added lines #L135 - L137 were not covered by tests


[warning] 140-144: pkg/index/job/correction/service/corrector.go#L140-L144
Added lines #L140 - L144 were not covered by tests


[warning] 146-148: pkg/index/job/correction/service/corrector.go#L146-L148
Added lines #L146 - L148 were not covered by tests


[warning] 150-150: pkg/index/job/correction/service/corrector.go#L150
Added line #L150 was not covered by tests


[warning] 152-152: pkg/index/job/correction/service/corrector.go#L152
Added line #L152 was not covered by tests


[warning] 154-154: pkg/index/job/correction/service/corrector.go#L154
Added line #L154 was not covered by tests


[warning] 156-156: pkg/index/job/correction/service/corrector.go#L156
Added line #L156 was not covered by tests


[warning] 158-158: pkg/index/job/correction/service/corrector.go#L158
Added line #L158 was not covered by tests


[warning] 160-166: pkg/index/job/correction/service/corrector.go#L160-L166
Added lines #L160 - L166 were not covered by tests


[warning] 168-168: pkg/index/job/correction/service/corrector.go#L168
Added line #L168 was not covered by tests


[warning] 171-176: pkg/index/job/correction/service/corrector.go#L171-L176
Added lines #L171 - L176 were not covered by tests


[warning] 178-178: pkg/index/job/correction/service/corrector.go#L178
Added line #L178 was not covered by tests


[warning] 181-185: pkg/index/job/correction/service/corrector.go#L181-L185
Added lines #L181 - L185 were not covered by tests


[warning] 187-188: pkg/index/job/correction/service/corrector.go#L187-L188
Added lines #L187 - L188 were not covered by tests


[warning] 190-192: pkg/index/job/correction/service/corrector.go#L190-L192
Added lines #L190 - L192 were not covered by tests


[warning] 194-200: pkg/index/job/correction/service/corrector.go#L194-L200
Added lines #L194 - L200 were not covered by tests


[warning] 202-202: pkg/index/job/correction/service/corrector.go#L202
Added line #L202 was not covered by tests


[warning] 204-205: pkg/index/job/correction/service/corrector.go#L204-L205
Added lines #L204 - L205 were not covered by tests

Additional comments not posted (119)
versions/PROMETHEUS_STACK_VERSION (1)

1-1: Update version number.

The version number has been updated from 61.6.1 to 61.7.0. Ensure that this version update is compatible with the rest of the system and that any necessary changes have been made to accommodate this new version.

Please confirm that this version update has been tested and is compatible with the rest of the system.

k8s/index/operator/priorityclass.yaml (1)

1-30: LGTM! Verify the priority value.

The Kubernetes manifest for the PriorityClass resource is well-structured and correctly set up.

Ensure that the priority value 1e+06 is appropriate for the Vald index operator's requirements.

Verification successful

The priority value 1e+06 is appropriate for the Vald index operator.

The documentation in docs/user-guides/capacity-planning.md confirms that the default priority value for the Index Manager component is 1000000, which aligns with the priority value used in the k8s/index/operator/priorityclass.yaml file.

  • docs/user-guides/capacity-planning.md
Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the appropriateness of the priority value for the Vald index operator.

# Test: Search for the usage of the priority class in the codebase. Expect: Ensure the priority value aligns with the intended use case.
rg --type yaml -A 5 $'default-vald-index-operator-priority'

Length of output: 633


Script:

#!/bin/bash
# Description: Inspect the deployment configuration for the Vald index operator.

# Display the relevant sections of the deployment.yaml file where the priority class is used.
rg --type yaml -A 10 -B 10 $'priorityClassName: default-vald-index-operator-priority' k8s/index/operator/deployment.yaml

Length of output: 506


Script:

#!/bin/bash
# Description: Search for documentation or comments explaining the priority value.

# Search for mentions of 'priority' or 'priorityClass' to find any relevant documentation or comments.
rg --type md --type yaml --type yml --type txt 'priority|priorityClass'

Length of output: 101


Script:

#!/bin/bash
# Description: Search for documentation or comments explaining the priority value.

# Search for mentions of 'priority' or 'priorityClass' to find any relevant documentation or comments.
rg --type md --type yaml --type txt 'priority|priorityClass'

Length of output: 9301


Script:

#!/bin/bash
# Description: Extract relevant sections from the capacity planning documentation.

# Display the relevant sections from the capacity planning documentation that mention pod priority.
rg --type md -A 10 -B 10 'priority' docs/user-guides/capacity-planning.md

Length of output: 2982

internal/db/kvs/pogreb/options.go (1)

24-24: LGTM! Verify the usage of the updated functions.

The changes to the WithBackgroundSyncInterval and WithBackgroundCompactionInterval functions improve type safety and simplify the code.

Ensure that all function calls to WithBackgroundSyncInterval and WithBackgroundCompactionInterval match the new signature.

Makefile.d/proto.mk (2)

50-50: LGTM! Verify the usage of the updated variable.

The changes to replace hardcoded package paths with $(GOPKG) improve maintainability and flexibility.

Ensure that the updated variable $(GOPKG) is correctly used throughout the codebase.

Verification successful

Verified: The updated variable $(GOPKG) is correctly used throughout the codebase.

The definition and usage of $(GOPKG) were found in multiple Makefile fragments, confirming that the update has been correctly propagated and is being used consistently.

  • Definition found in Makefile.
  • Usage found in Makefile, Makefile.d/proto.mk, Makefile.d/functions.mk, and Makefile.d/test.mk.
Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the usage of the updated variable `$(GOPKG)` in the codebase.

# Test: Search for the usage of the variable. Expect: Correct usage of `$(GOPKG)` throughout the codebase.
rg --type make -A 5 $'$(GOPKG)'

Length of output: 32


Script:

#!/bin/bash
# Description: Verify the definition and usage of the updated variable `$(GOPKG)` in the codebase.

# Search for the definition of the variable `GOPKG`.
rg 'GOPKG\s*:?='

# Search for the usage of the variable `$(GOPKG)` in the entire codebase.
rg '\$\(GOPKG\)'

Length of output: 2378


62-65: LGTM! Verify the usage of the updated sed commands.

The changes to the sed commands improve maintainability by centralizing the configuration of package paths.

Ensure that the updated sed commands correctly replace the package paths throughout the codebase.

Verification successful

The updated sed commands have been verified successfully.

The replacements for package paths have been correctly applied throughout the codebase, as evidenced by the extensive matches for the new internal paths.

  • The path internal/net/grpc/codes is present in multiple files.
  • The path internal/net/grpc/status is present in multiple files.
  • The path internal/io is present in multiple files.
  • The path internal/sync is present in multiple files.

These results confirm that the sed commands in Makefile.d/proto.mk are functioning as intended.

Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the usage of the updated sed commands in the codebase.

# Test: Search for the usage of the sed commands. Expect: Correct replacement of package paths throughout the codebase.
rg --type make -A 5 $'sed -i -E'

Length of output: 2516


Script:

#!/bin/bash
# Description: Verify the correctness of the updated sed commands by checking the replacements in the Go files.

# Search for the new internal paths in the Go files within the apis/grpc directory.
rg "$(GOPKG)/internal/net/grpc/codes" $(ROOTDIR)/apis/grpc
rg "$(GOPKG)/internal/net/grpc/status" $(ROOTDIR)/apis/grpc
rg "$(GOPKG)/internal/io" $(ROOTDIR)/apis/grpc
rg "$(GOPKG)/internal/sync" $(ROOTDIR)/apis/grpc

Length of output: 1018


Script:

#!/bin/bash
# Description: Verify the correctness of the updated sed commands by checking the replacements in the Go files.

# Find Go files in the apis/grpc directory and search for the new internal paths.
fd -e go -x rg 'internal/net/grpc/codes' {}
fd -e go -x rg 'internal/net/grpc/status' {}
fd -e go -x rg 'internal/io' {}
fd -e go -x rg 'internal/sync' {}

Length of output: 18737

internal/config/corrector.go (4)

41-45: Ensure proper validation for new interval fields.

The fields KVSBackgroundSyncInterval and KVSBackgroundCompactionInterval have been added to the Corrector struct. Ensure that these fields are validated to be proper duration strings.


53-54: Ensure proper initialization for the new Gateway field.

The Gateway field has been added to the Corrector struct. Ensure that this field is properly initialized and configured.


63-64: LGTM! Add tests for the new fields.

The Bind method has been updated to include the new fields KVSBackgroundCompactionInterval and KVSBackgroundSyncInterval. Ensure that tests cover these new fields.

Tools
GitHub Check: codecov/patch

[warning] 63-64: internal/config/corrector.go#L63-L64
Added lines #L63 - L64 were not covered by tests


69-71: LGTM! Add tests for the new Gateway field.

The Bind method has been updated to handle the new Gateway field. Ensure that tests cover this new field.

Tools
GitHub Check: codecov/patch

[warning] 69-70: internal/config/corrector.go#L69-L70
Added lines #L69 - L70 were not covered by tests

pkg/index/job/correction/service/options.go (4)

33-40: LGTM! Ensure proper usage of the WithErrGroup function.

The WithErrGroup function has been added to facilitate error group management. Ensure that this function is used correctly in the codebase.


65-74: LGTM! Ensure proper usage of the WithGateway function.

The WithGateway function has been added to set a discoverer client. Ensure that this function is used correctly in the codebase.


87-100: LGTM! Ensure proper validation for the WithKVSSyncInterval function.

The WithKVSSyncInterval function has been modified to set an interval for background file sync. Ensure that the duration string is properly validated.


102-112: LGTM! Ensure proper validation for the WithKVSCompactionInterval function.

The WithKVSCompactionInterval function has been added to set an interval for background file compaction. Ensure that the duration string is properly validated.

internal/db/kvs/pogreb/pogreb.go (2)

27-28: LGTM! The renaming of the Pogreb interface to DB improves clarity.

The Pogreb interface has been renamed to DB to reflect a more conventional naming that aligns with database terminology. Ensure that this change does not introduce any issues in the codebase.


46-46: LGTM! The modification of the New function's return type improves clarity.

The New function's return type has been changed from Pogreb to DB. Ensure that this change does not introduce any issues in the codebase.

charts/vald/templates/index/job/correction/configmap.yaml (3)

79-79: Verify the client reference update in the discoverer section.

Ensure that the update from $index to $corrector in the discoverer section is correct and consistent with the overall configuration.

Verification successful

Verify the client reference update in the discoverer section.

The reference to $corrector.discoverer.client in the charts/vald/templates/index/job/correction/configmap.yaml file is consistent with the intended update from $index to $corrector.

  • charts/vald/templates/index/job/correction/configmap.yaml: Verified usage of $corrector.discoverer.client.
Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the client reference update in the discoverer section.

# Test: Search for the usage of discoverer client reference. Expect: Consistent usage of `$corrector`.
rg --type yaml 'discoverer'

Length of output: 87712


54-55: LGTM! Verify the impact on deployment configurations.

The new settings kvs_background_sync_interval and kvs_background_compaction_interval are correctly integrated. Ensure that these changes do not negatively impact the deployment configurations.

Verification successful

LGTM! Verify the impact on deployment configurations.

The new settings kvs_background_sync_interval and kvs_background_compaction_interval are correctly integrated and consistently used across the configuration files. There are no apparent conflicts or negative impacts on deployment configurations.

  • k8s/operator/helm/crds/valdrelease.yaml: Defined as string types.
  • k8s/index/job/correction/configmap.yaml: Set to 5s.
  • charts/vald/values.yaml: Documented and set to 5s.
  • charts/vald-helm-operator/crds/valdrelease.yaml: Defined as string types.
  • charts/vald/templates/index/job/correction/configmap.yaml: Referenced with Helm template variables.
Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the impact of new settings on deployment configurations.

# Test: Search for the usage of new settings. Expect: No negative impact on deployment configurations.
rg --type yaml 'kvs_background_sync_interval|kvs_background_compaction_interval'

Length of output: 1608


Script:

#!/bin/bash
# Description: Gather detailed information about the usage and context of new settings in the identified files.

# Display the context around the new settings in the identified files.
rg --type yaml -A 5 -B 5 'kvs_background_sync_interval|kvs_background_compaction_interval' k8s/operator/helm/crds/valdrelease.yaml
rg --type yaml -A 5 -B 5 'kvs_background_sync_interval|kvs_background_compaction_interval' k8s/index/job/correction/configmap.yaml
rg --type yaml -A 5 -B 5 'kvs_background_sync_interval|kvs_background_compaction_interval' charts/vald/values.yaml
rg --type yaml -A 5 -B 5 'kvs_background_sync_interval|kvs_background_compaction_interval' charts/vald-helm-operator/crds/valdrelease.yaml
rg --type yaml -A 5 -B 5 'kvs_background_sync_interval|kvs_background_compaction_interval' charts/vald/templates/index/job/correction/configmap.yaml

Length of output: 4241


57-75: LGTM! Verify the impact on gateway configuration.

The enhanced gateway configuration is correctly integrated. Ensure that these changes do not negatively impact the gateway configuration.

Verification successful

Verification successful: No negative impact on gateway configuration.

The enhanced gateway configuration is correctly integrated and does not introduce any inconsistencies or errors in the existing configurations.

  • The gateway.enabled flag is used consistently to check if the gateway is enabled.
  • The gateway.server_config settings are correctly referenced and applied.
  • The gateway.name is used consistently across different templates.
  • The gateway_config settings are correctly applied and referenced.
Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the impact of enhanced gateway configuration.

# Test: Search for the usage of gateway configuration. Expect: No negative impact on gateway configuration.
rg --type yaml 'gateway'

Length of output: 122135


Script:

#!/bin/bash
# Searching for specific configurations and settings related to the gateway in the context of the provided code snippet.

# Search for occurrences of 'gateway.enabled' to check if the gateway is enabled correctly.
rg --type yaml 'gateway.enabled'

# Search for occurrences of 'gateway.server_config' to verify server configuration settings.
rg --type yaml 'gateway.server_config'

# Search for occurrences of 'gateway.name' to ensure the gateway name is used consistently.
rg --type yaml 'gateway.name'

# Search for occurrences of 'gateway_config' to check if the gateway configuration settings are correctly applied.
rg --type yaml 'gateway_config'

Length of output: 29803

k8s/index/job/save/cronjob.yaml (1)

1-144: LGTM! Verify the readiness checks and probes.

The new CronJob configuration for vald-index-save is correctly integrated. Ensure that the readiness checks and probes are correctly configured and functional.

Verification successful

LGTM! Verify the readiness checks and probes.

The new CronJob configuration for vald-index-save is correctly integrated. Ensure that the readiness checks and probes are correctly configured and functional.

  • k8s/index/job/save/cronjob.yaml: Readiness, liveness, and startup probes are present and configured.
Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the readiness checks and probes in the new CronJob configuration.

# Test: Search for the readiness checks and probes. Expect: Correct configuration and functionality.
rg --type yaml 'readinessProbe|livenessProbe|startupProbe'

Length of output: 70857

k8s/index/job/creation/cronjob.yaml (11)

1-15: License and Metadata

The license and metadata information is correctly included.


16-17: CronJob API Version and Kind

The apiVersion and kind fields are correctly set for a CronJob.


18-27: Metadata Configuration

The metadata configuration includes necessary labels for Helm and Kubernetes management. Ensure that the release-name placeholder is replaced with the actual release name during deployment.


28-32: CronJob Schedule and Policies

The schedule is set to run every minute, and the concurrency policy forbids concurrent executions. The suspend field is set to false, and the startingDeadlineSeconds is appropriately configured.


33-35: Job Template TTL

The ttlSecondsAfterFinished is set to 86400 seconds (24 hours), which is a reasonable duration for retaining completed jobs.


36-45: Pod Template Metadata

The pod template metadata includes necessary labels and annotations for monitoring. Ensure that the release-name placeholder is replaced with the actual release name during deployment.


46-51: Pyroscope Annotations

The Pyroscope annotations enable CPU and memory profiling, which is useful for performance monitoring.


52-75: Init Containers

The init containers wait-for-agent and wait-for-discoverer ensure that the main container starts only after the vald-agent and vald-discoverer services are ready. The readiness checks using wget are appropriate.


76-125: Main Container Configuration

The main container vald-index-creation is configured with appropriate probes for liveness, readiness, and startup. The container exposes multiple ports for different functionalities, including liveness checks, readiness checks, gRPC, and profiling.


126-138: Environment Variables

The environment variables capture the node name, pod name, and namespace dynamically, which enhances the container's awareness of its deployment context.


139-144: Restart Policy and Volumes

The restartPolicy is set to OnFailure, and the volume configuration is correctly set to use a ConfigMap.

k8s/index/job/correction/cronjob.yaml (11)

1-15: License and Metadata

The license and metadata information is correctly included.


16-17: CronJob API Version and Kind

The apiVersion and kind fields are correctly set for a CronJob.


18-27: Metadata Configuration

The metadata configuration includes necessary labels for Helm and Kubernetes management. Ensure that the release-name placeholder is replaced with the actual release name during deployment.


28-32: CronJob Schedule and Policies

The schedule is set to run at 3:06 AM daily, and the concurrency policy forbids concurrent executions. The suspend field is set to false, and the startingDeadlineSeconds is appropriately configured.


33-35: Job Template TTL

The ttlSecondsAfterFinished is set to 86400 seconds (24 hours), which is a reasonable duration for retaining completed jobs.


36-45: Pod Template Metadata

The pod template metadata includes necessary labels and annotations for monitoring. Ensure that the release-name placeholder is replaced with the actual release name during deployment.


46-51: Pyroscope Annotations

The Pyroscope annotations enable CPU and memory profiling, which is useful for performance monitoring.


52-75: Init Containers

The init containers wait-for-agent and wait-for-discoverer ensure that the main container starts only after the vald-agent and vald-discoverer services are ready. The readiness checks using wget are appropriate.


76-125: Main Container Configuration

The main container vald-index-correction is configured with appropriate probes for liveness, readiness, and startup. The container exposes multiple ports for different functionalities, including liveness checks, readiness checks, gRPC, and profiling.


126-138: Environment Variables

The environment variables capture the node name, pod name, and namespace dynamically, which enhances the container's awareness of its deployment context.


139-144: Restart Policy and Volumes

The restartPolicy is set to OnFailure, and the volume configuration is correctly set to use a ConfigMap.

pkg/index/job/correction/usecase/corrector.go (6)

Line range hint 1-15: License and Package Declaration

The license and package declaration are correctly included.


19-24: New Imports

The new imports for slices and vald are appropriate given the context of the changes.


52-58: Gateway Options and Error Handling

The code correctly retrieves gateway options from the configuration and appends the error group option. Proper error handling is implemented.


59-62: Gateway Client Initialization

The gateway client is correctly initialized using the vald.New function with the appropriate options.


90-90: Simplified Address Reversal

The slices.Reverse function simplifies the logic for reversing the order of addresses, improving readability and maintainability.


117-117: Corrector Service Initialization

The corrector service is now initialized with the new gateway parameter, which enhances its interaction with the gateway component.

k8s/index/operator/deployment.yaml (4)

18-27: LGTM! Metadata section is well-structured.

The metadata section correctly includes the deployment name, labels, and annotations for monitoring.


28-39: LGTM! Spec section is correctly configured.

The spec section includes a rolling update strategy with appropriate values for maxSurge and maxUnavailable.


40-172: LGTM! Template section is comprehensive and well-configured.

The template section includes necessary configurations for probes, ports, resource management, and security context.


173-173: LGTM! Status section is appropriately empty.

The status section is managed by Kubernetes and does not require manual configuration.

internal/db/kvs/pogreb/options_test.go (1)

Line range hint 17-93:
LGTM! TestWithPath function is well-structured and includes necessary checks.

The test function correctly tests the WithPath option for the pogreb package.

Makefile.d/dependencies.mk (2)

228-228: LGTM! update/vald command correctly uses the $(REPO) variable.

The modification enhances maintainability by using a variable for the repository name.


233-233: LGTM! update/valdcli command correctly uses the $(REPO) variable.

The modification enhances maintainability by using a variable for the repository name.

k8s/index/job/save/configmap.yaml (7)

16-26: Metadata section looks good.

The metadata section is correctly formatted and includes necessary labels for Kubernetes management.


36-78: Server configuration looks good.

The server configurations are comprehensive and follow best practices for gRPC and HTTP server settings.

Also applies to: 79-129, 130-155


156-165: Startup and shutdown strategies look good.

The strategies are well-defined and ensure controlled management of server states during deployment and maintenance.


167-172: TLS configuration looks good.

The TLS configuration is correctly specified, allowing for secure connections.


173-203: Observability configuration looks good.

The observability configurations are comprehensive and follow best practices for metrics and tracing.


204-292: Saver configuration looks good.

The saver configurations are detailed and follow best practices for managing connections and ensuring reliability.


293-370: Agent client options configuration looks good.

The agent client options are detailed and follow best practices for managing connections and ensuring reliability.

k8s/index/job/creation/configmap.yaml (7)

16-26: Metadata section looks good.

The metadata section is correctly formatted and includes necessary labels for Kubernetes management.


36-78: Server configuration looks good.

The server configurations are comprehensive and follow best practices for gRPC and HTTP server settings.

Also applies to: 79-129, 130-155


156-165: Startup and shutdown strategies look good.

The strategies are well-defined and ensure controlled management of server states during deployment and maintenance.


167-172: TLS configuration looks good.

The TLS configuration is correctly specified, allowing for secure connections.


173-203: Observability configuration looks good.

The observability configurations are comprehensive and follow best practices for metrics and tracing.


204-292: Creator configuration looks good.

The creator configurations are detailed and follow best practices for managing connections and ensuring reliability.


293-370: Agent client options configuration looks good.

The agent client options are detailed and follow best practices for managing connections and ensuring reliability.

Makefile.d/test.mk (2)

347-353: Updated sed commands look good.

The changes to use variables $(GOPKG) and $(REPO) instead of hardcoded paths improve the maintainability of the script.


Line range hint 355-361:
Updated sed commands look good.

The changes to use variables $(GOPKG) and $(REPO) instead of hardcoded paths improve the maintainability of the script.

k8s/index/job/correction/configmap.yaml (6)

1-26: LGTM!

The license header and metadata are correctly formatted.


27-78: Verify the use of empty string values in server configuration.

The configuration includes empty string values for connection_timeout, max_conn_age, max_conn_age_grace, max_conn_idle, and max_send_message_size. Ensure these values are intended and handled correctly in the application.


79-129: LGTM!

The health check servers for liveness and readiness are well-defined.


130-203: LGTM!

The observability settings are comprehensive and well-defined.


204-293: LGTM!

The corrector agent settings are well-defined and appropriate.


294-451: LGTM!

The connection management settings are comprehensive and well-defined.

pkg/index/job/correction/service/options_test.go (1)

Line range hint 443-526:
LGTM!

The changes to the TestWithKVSSyncInterval function are appropriate and align with the new functionality being tested.

pkg/index/job/correction/service/corrector.go (3)

452-453: LGTM!

The NumberOfCheckedIndex method is simple and well-implemented.


456-457: LGTM!

The NumberOfCorrectedOldIndex method is simple and well-implemented.


460-461: LGTM!

The NumberOfCorrectedReplication method is simple and well-implemented.

internal/db/kvs/pogreb/pogreb_test.go (3)

251-252: LGTM! Ensure consistency across the codebase.

The change from Pogreb to DB in the beforeFunc and afterFunc parameters is consistent with a refactor to standardize the database interface.

However, ensure that all references to Pogreb have been updated to DB across the codebase.


349-350: LGTM! Ensure consistency across the codebase.

The change from Pogreb to DB in the beforeFunc and afterFunc parameters is consistent with a refactor to standardize the database interface.

However, ensure that all references to Pogreb have been updated to DB across the codebase.


493-494: LGTM! Ensure consistency across the codebase.

The change from Pogreb to DB in the beforeFunc and afterFunc parameters is consistent with a refactor to standardize the database interface.

However, ensure that all references to Pogreb have been updated to DB across the codebase.

Makefile.d/k8s.mk (5)

40-43: LGTM! New Helm template options are correctly added.

The new Helm template options for enabling specific features of the manager index are correctly added and will be effective during the Helm chart rendering process.


543-543: LGTM! The repository path update enhances flexibility.

The update to use the $(REPO) variable for the agent-ngt repository path allows for more dynamic and flexible repository management.


548-548: LGTM! The repository path update enhances flexibility.

The update to use the $(REPO) variable for the agent-faiss repository path allows for more dynamic and flexible repository management.


553-553: LGTM! The repository path update enhances flexibility.

The update to use the $(REPO) variable for the discoverer repository path allows for more dynamic and flexible repository management.


558-563: LGTM! The repository path updates enhance flexibility.

The updates to use the $(REPO) variable for the manager-index and lb-gateway repository paths allow for more dynamic and flexible repository management.

k8s/index/operator/configmap.yaml (5)

18-26: LGTM! Metadata and labels are correctly defined.

The metadata and labels for the ConfigMap are consistent with the project's conventions.


28-28: LGTM! Server configuration is comprehensive and correctly defined.

The server configuration includes detailed settings for gRPC and HTTP servers, ensuring robust server management.


28-28: LGTM! Health check settings are correctly defined.

The health check settings include liveness and readiness probes, ensuring effective monitoring of the services.


28-28: LGTM! Observability settings are comprehensive and correctly defined.

The observability settings include metrics and tracing configurations, allowing for effective monitoring and tracing of the services.


28-28: LGTM! Job templates are comprehensive and correctly defined.

The job templates include detailed specifications for various operations, ensuring effective job management.

pkg/index/job/correction/service/corrector_test.go (2)

504-514: Ensure proper usage of new fields in correct struct.

The new fields in the correct struct should be properly used in the implementation to ensure the intended functionality.


254-264: Modified fields in the correct struct.

The correct struct now includes fields like eg, gateway, checkedList, backgroundSyncInterval, and backgroundCompactionInterval. Ensure that these fields are correctly initialized and used in the implementation.

Verification successful

Verified Initialization and Usage of New Fields in correct Struct

The new fields eg, gateway, checkedList, backgroundSyncInterval, and backgroundCompactionInterval in the correct struct are correctly initialized and used in the implementation.

  • Initialization:

    • eg: Initialized in corrector_test.go and used in corrector.go.
    • gateway: Initialized in corrector_test.go and used in corrector.go.
    • checkedList: Initialized in corrector_test.go and used in corrector.go.
    • backgroundSyncInterval: Initialized in corrector_test.go and used in corrector.go.
    • backgroundCompactionInterval: Initialized in corrector_test.go and used in corrector.go.
  • Usage:

    • eg: Used in various places in corrector.go for error handling and concurrency.
    • gateway: Used in corrector.go for gateway operations.
    • checkedList: Used in corrector.go for managing checked items.
    • backgroundSyncInterval: Used in corrector.go for setting sync intervals.
    • backgroundCompactionInterval: Used in corrector.go for setting compaction intervals.

No issues found with the initialization and usage of the new fields.

Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify that the new fields in the `correct` struct are correctly initialized and used.

# Test: Search for the initialization and usage of the new fields. Expect: Proper initialization and usage.
rg --type go 'correct\{'

Length of output: 458


Script:

#!/bin/bash
# Description: Verify the initialization and usage of specific fields in the `correct` struct.

# Test: Search for the initialization of the `eg` field in the `correct` struct.
rg --type go 'eg:'

# Test: Search for the initialization of the `gateway` field in the `correct` struct.
rg --type go 'gateway:'

# Test: Search for the initialization of the `checkedList` field in the `correct` struct.
rg --type go 'checkedList:'

# Test: Search for the initialization of the `backgroundSyncInterval` field in the `correct` struct.
rg --type go 'backgroundSyncInterval:'

# Test: Search for the initialization of the `backgroundCompactionInterval` field in the `correct` struct.
rg --type go 'backgroundCompactionInterval:'

Length of output: 179714


Script:

#!/bin/bash
# Description: Verify the usage of specific fields in the `correct` struct in the implementation files.

# Test: Search for the usage of the `eg` field in the `correct` struct.
rg --type go '\.eg'

# Test: Search for the usage of the `gateway` field in the `correct` struct.
rg --type go '\.gateway'

# Test: Search for the usage of the `checkedList` field in the `correct` struct.
rg --type go '\.checkedList'

# Test: Search for the usage of the `backgroundSyncInterval` field in the `correct` struct.
rg --type go '\.backgroundSyncInterval'

# Test: Search for the usage of the `backgroundCompactionInterval` field in the `correct` struct.
rg --type go '\.backgroundCompactionInterval'

Length of output: 107621

go.mod (9)

53-53: Upgraded github.com/aws/aws-sdk-go-v2/feature/s3/manager to v1.17.10.

Ensure that the new version is compatible with the existing codebase and does not introduce any breaking changes.

Verification successful

No usage found for github.com/aws/aws-sdk-go-v2/feature/s3/manager.

The search did not return any instances of the package being used in the codebase. Therefore, upgrading to version v1.17.10 does not introduce any compatibility issues.

Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify compatibility of github.com/aws/aws-sdk-go-v2/feature/s3/manager v1.17.10.

# Test: Search for the usage of github.com/aws/aws-sdk-go-v2/feature/s3/manager. Expect: No issues with the new version.
rg --type go 'github.com/aws/aws-sdk-go-v2/feature/s3/manager'

Length of output: 62


Script:

#!/bin/bash
# Description: Verify compatibility of github.com/aws/aws-sdk-go-v2/feature/s3/manager v1.17.10.

# Search for the usage of github.com/aws/aws-sdk-go-v2/feature/s3/manager in the codebase
rg 'github.com/aws/aws-sdk-go-v2/feature/s3/manager' --type go -A 10

Length of output: 68


303-303: Upgraded golang.org/x/mod to v0.20.0.

Ensure that the new version is compatible with the existing codebase and does not introduce any breaking changes.

Verification successful

Upgraded golang.org/x/mod to v0.20.0.

The golang.org/x/mod module is not directly used in the codebase, and its upgrade from v0.19.0 to v0.20.0 should not introduce any breaking changes affecting the codebase. The dependency management system will handle any indirect usages.

  • The upgrade is reflected in the go.mod and go.sum files.
  • No direct usages of golang.org/x/mod were found in the codebase.
Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify compatibility of golang.org/x/mod v0.20.0.

# Test: Search for the usage of golang.org/x/mod. Expect: No issues with the new version.
rg --type go 'golang.org/x/mod'

Length of output: 31


Script:

#!/bin/bash
# Re-run the search for the usage of golang.org/x/mod in the codebase.
rg 'golang.org/x/mod'

# Check for any go.mod files that might specify the version of golang.org/x/mod.
fd go.mod --exec cat {}

Length of output: 62811


305-305: Upgraded golang.org/x/oauth2 to v0.22.0.

Ensure that the new version is compatible with the existing codebase and does not introduce any breaking changes.


14-14: Upgraded cloud.google.com/go/pubsub to v1.41.0.

Ensure that the new version is compatible with the existing codebase and does not introduce any breaking changes.

Verification successful

The upgrade to cloud.google.com/go/pubsub v1.41.0 does not impact the codebase.

The search results indicate that pubsub references are only found in comments and not in actual code usage.

  • No instances of cloud.google.com/go/pubsub were found in the codebase.
Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify compatibility of cloud.google.com/go/pubsub v1.41.0.

# Test: Search for the usage of cloud.google.com/go/pubsub. Expect: No issues with the new version.
rg --type go 'cloud.google.com/go/pubsub'

Length of output: 41


Script:

#!/bin/bash
# Description: Verify compatibility of cloud.google.com/go/pubsub v1.41.0 by searching for usage of 'pubsub' in Go files.

# Test: Search for the usage of 'pubsub' in Go files.
ast-grep --lang go --pattern 'pubsub'

Length of output: 37


Script:

#!/bin/bash
# Description: Verify compatibility of cloud.google.com/go/pubsub v1.41.0 by searching for usage of 'cloud.google.com/go/pubsub' and 'pubsub' in Go files.

# Test: Search for the usage of 'cloud.google.com/go/pubsub' in Go files.
rg --type go 'cloud.google.com/go/pubsub'

# Test: Search for the usage of 'pubsub' in Go files.
rg --type go 'pubsub'

Length of output: 649


18-18: Upgraded code.cloudfoundry.org/bytefmt to v0.0.0-20240804182054-0a63f33a903d.

Ensure that the new version is compatible with the existing codebase and does not introduce any breaking changes.


383-383: Added github.com/vdaas/vald-client-go v1.7.12.

Ensure that the new dependency is correctly integrated and does not introduce any issues.

Verification successful

Integration of github.com/vdaas/vald-client-go v1.7.12 is correct and does not introduce any issues.

The functions and methods from the payload, vald, and agent/core packages are used appropriately in the code, indicating proper integration.

  • Files verified:
    • example/client/main.go
    • example/client/mirror/main.go
    • example/client/agent/main.go
Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the integration of github.com/vdaas/vald-client-go v1.7.12.

# Test: Search for the usage of github.com/vdaas/vald-client-go. Expect: Proper integration.
rg --type go 'github.com/vdaas/vald-client-go'

Length of output: 561


Script:

#!/bin/bash
# Description: Inspect the usage of github.com/vdaas/vald-client-go imports in the identified files.

# Check usage in example/client/main.go
echo "Usage in example/client/main.go:"
rg --type go --context 5 'github.com/vdaas/vald-client-go/v1/payload' example/client/main.go
rg --type go --context 5 'github.com/vdaas/vald-client-go/v1/vald' example/client/main.go

# Check usage in example/client/mirror/main.go
echo "Usage in example/client/mirror/main.go:"
rg --type go --context 5 'github.com/vdaas/vald-client-go/v1/payload' example/client/mirror/main.go
rg --type go --context 5 'github.com/vdaas/vald-client-go/v1/vald' example/client/mirror/main.go

# Check usage in example/client/agent/main.go
echo "Usage in example/client/agent/main.go:"
rg --type go --context 5 'github.com/vdaas/vald-client-go/v1/agent/core' example/client/agent/main.go
rg --type go --context 5 'github.com/vdaas/vald-client-go/v1/payload' example/client/agent/main.go
rg --type go --context 5 'github.com/vdaas/vald-client-go/v1/vald' example/client/agent/main.go

Length of output: 2742


Script:

#!/bin/bash
# Description: Inspect the usage of functions and methods from github.com/vdaas/vald-client-go in the identified files.

# Check function calls and usage in example/client/main.go
echo "Function calls and usage in example/client/main.go:"
rg --type go --context 5 'payload\.' example/client/main.go
rg --type go --context 5 'vald\.' example/client/main.go

# Check function calls and usage in example/client/mirror/main.go
echo "Function calls and usage in example/client/mirror/main.go:"
rg --type go --context 5 'payload\.' example/client/mirror/main.go
rg --type go --context 5 'vald\.' example/client/mirror/main.go

# Check function calls and usage in example/client/agent/main.go
echo "Function calls and usage in example/client/agent/main.go:"
rg --type go --context 5 'agent\.' example/client/agent/main.go
rg --type go --context 5 'payload\.' example/client/agent/main.go
rg --type go --context 5 'vald\.' example/client/agent/main.go

Length of output: 10241


306-306: Upgraded golang.org/x/sync to v0.8.0.

Ensure that the new version is compatible with the existing codebase and does not introduce any breaking changes.


310-310: Upgraded golang.org/x/time to v0.6.0.

Ensure that the new version is compatible with the existing codebase and does not introduce any breaking changes.


307-307: Upgraded golang.org/x/sys to v0.23.0.

Ensure that the new version is compatible with the existing codebase and does not introduce any breaking changes.

pkg/gateway/lb/handler/grpc/handler_test.go (3)

5663-5665: LGTM! The renaming improves clarity.

The renaming of variables from want to wantMerged and got to gotMerged enhances the readability and maintainability of the code by making the purpose of the variables more explicit.


5725-5726: LGTM! Ensure the function calls are updated.

The function call to mergeInfoIndexStatistics has been updated to reflect the new variable names. Ensure all related calls are updated accordingly.


5653-5653: LGTM! But verify the function usage in the codebase.

The code changes are approved.

However, ensure that all function calls to mergeInfoIndexStatistics match the new signature.

Verification successful

Verified: Function usage matches the new signature.

The function mergeInfoIndexStatistics is used correctly with the new signature in the codebase.

  • pkg/gateway/lb/handler/grpc/handler.go: The function call matches the new signature.
  • pkg/gateway/lb/handler/grpc/handler_test.go: The test code (commented out) also uses the new signature correctly.
Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify all function calls to `mergeInfoIndexStatistics` match the new signature.

# Test: Search for the function usage. Expect: Only occurrences of the new signature.
rg --type go -A 5 $'mergeInfoIndexStatistics'

Length of output: 1830

charts/vald/values.yaml (3)

3251-3253: LGTM! Verify the usage of kvs_background_sync_interval.

The addition of kvs_background_sync_interval looks good. Ensure it is correctly utilized in the codebase.

Verification successful

Verified: Correct usage of kvs_background_sync_interval

The parameter kvs_background_sync_interval is correctly defined and utilized across various configuration files in the codebase. The references found in the search results confirm its proper integration.

  • k8s/operator/helm/crds/valdrelease.yaml
  • k8s/index/job/correction/configmap.yaml
  • charts/vald/values.yaml
  • charts/vald/templates/index/job/correction/configmap.yaml
  • charts/vald-helm-operator/crds/valdrelease.yaml
Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the usage of `kvs_background_sync_interval` in the codebase.

# Test: Search for the parameter usage. Expect: Correct utilization in the codebase.
rg --type yaml -A 5 $'kvs_background_sync_interval'

Length of output: 3110


3263-3265: LGTM! Verify the usage of gateway.

The addition of the gateway object looks good. Ensure it is correctly utilized in the codebase.

Verification successful

Verify the detailed usage of gateway in the codebase.

The gateway parameter is found in multiple YAML files. To ensure it is correctly utilized, we need to gather more detailed information about its context and configuration.


The gateway parameter is correctly utilized in the codebase.

The detailed context around the gateway parameter across multiple files confirms its proper integration and usage in the system.

  • k8s/operator/helm/crds/valdrelease.yaml
  • k8s/gateway/gateway/lb/configmap.yaml
  • k8s/index/job/correction/configmap.yaml
  • example/helm/values.yaml
  • charts/vald/values.yaml
  • charts/vald/templates/index/job/correction/configmap.yaml
  • charts/vald/templates/gateway/mirror/configmap.yaml
  • charts/vald/templates/gateway/lb/configmap.yaml
Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the usage of `gateway` in the codebase.

# Test: Search for the parameter usage. Expect: Correct utilization in the codebase.
rg --type yaml -A 5 $'gateway:'

Length of output: 12332


Script:

#!/bin/bash
# Description: Gather detailed usage of `gateway` in the codebase.

# Extract detailed context around the `gateway` parameter in the identified YAML files.
rg --type yaml -A 10 -B 5 $'gateway:'

Length of output: 33325


3254-3256: LGTM! Verify the usage of kvs_background_compaction_interval.

The addition of kvs_background_compaction_interval looks good. Ensure it is correctly utilized in the codebase.

Verification successful

Let's gather more detailed information about the usage of kvs_background_compaction_interval in the identified files to ensure it is correctly utilized.


The usage of kvs_background_compaction_interval is correctly integrated into the codebase.

The parameter is consistently defined and utilized across multiple configuration files, ensuring proper functionality.

  • k8s/operator/helm/crds/valdrelease.yaml
  • k8s/index/job/correction/configmap.yaml
  • charts/vald/templates/index/job/correction/configmap.yaml
  • charts/vald-helm-operator/crds/valdrelease.yaml
Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the usage of `kvs_background_compaction_interval` in the codebase.

# Test: Search for the parameter usage. Expect: Correct utilization in the codebase.
rg --type yaml -A 5 $'kvs_background_compaction_interval'

Length of output: 3090


Script:

#!/bin/bash
# Description: Gather detailed information about the usage of `kvs_background_compaction_interval` in the identified files.

# Search for the parameter usage in k8s/operator/helm/crds/valdrelease.yaml
rg --type yaml -A 5 -B 5 'kvs_background_compaction_interval' k8s/operator/helm/crds/valdrelease.yaml

# Search for the parameter usage in k8s/index/job/correction/configmap.yaml
rg --type yaml -A 5 -B 5 'kvs_background_compaction_interval' k8s/index/job/correction/configmap.yaml

# Search for the parameter usage in charts/vald/templates/index/job/correction/configmap.yaml
rg --type yaml -A 5 -B 5 'kvs_background_compaction_interval' charts/vald/templates/index/job/correction/configmap.yaml

# Search for the parameter usage in charts/vald-helm-operator/crds/valdrelease.yaml
rg --type yaml -A 5 -B 5 'kvs_background_compaction_interval' charts/vald-helm-operator/crds/valdrelease.yaml

Length of output: 2572

pkg/agent/core/ngt/service/ngt_test.go (3)

16610-16611: Good renaming for clarity.

Renaming want to wantStats makes the purpose of the variable clearer.


16621-16626: Consistent renaming in the check function.

The renaming of got to gotStats and want to wantStats in the defaultCheckFunc improves readability.


16827-16828: Consistent renaming in the test case.

Renaming got to gotStats in the test case aligns with the improved naming convention.

charts/vald-helm-operator/crds/valdrelease.yaml (5)

7898-7914: Ensure backoff property values are validated.

The backoff property includes several nested properties. Ensure that values like backoff_factor, backoff_time_limit, initial_duration, jitter_limit, and maximum_duration are validated to prevent misconfiguration.


7918-7931: Ensure circuit_breaker property values are validated.

The circuit_breaker property includes several nested properties. Ensure that values like closed_error_rate, closed_refresh_timeout, half_open_error_rate, min_samples, and open_timeout are validated to prevent misconfiguration.


7944-7966: Ensure dial_option property values are validated.

The dial_option property includes several nested properties. Ensure that values like backoff_base_delay, backoff_jitter, backoff_max_delay, backoff_multiplier, initial_connection_window_size, and initial_window_size are validated to prevent misconfiguration.


8046-8050: Ensure max_recv_msg_size, max_retry_rpc_buffer_size, and max_send_msg_size property values are validated.

The properties max_recv_msg_size, max_retry_rpc_buffer_size, and max_send_msg_size are defined as integers. Ensure that these values are validated to prevent misconfiguration.


8084-8087: Verify the impact of removing kvs_async_write_concurrency.

The property kvs_async_write_concurrency has been removed. Ensure that this removal does not impact other parts of the configuration or the system's functionality.

k8s/operator/helm/crds/valdrelease.yaml (1)

7891-8065: New gateway section added.

The gateway section introduces various properties including addrs, backoff, call_option, circuit_breaker, and connection_pool. Ensure these configurations are correctly integrated and documented.

Verification successful

New gateway section added.

The gateway section has been referenced in multiple files, indicating its importance in the configuration. Ensure these configurations are correctly integrated and documented in the following files:

  • k8s/operator/helm/crds/valdrelease.yaml
  • k8s/index/job/correction/configmap.yaml
  • k8s/gateway/gateway/lb/configmap.yaml
  • example/helm/values-standalone-agent-ngt.yaml
  • example/helm/values.yaml
  • example/helm/values-with-pyroscope.yaml
  • charts/vald/values.yaml
  • charts/vald/values/vald-backup-via-pv.yaml
  • charts/vald/templates/index/job/correction/configmap.yaml
  • charts/vald/values/vald-in-memory-mode-no-backup.yaml
  • charts/vald/values/dev.yaml
  • charts/vald/values/multi-vald/dev-vald-with-mirror.yaml
  • charts/vald/values/multi-vald/dev-vald-03.yaml
  • charts/vald/values/multi-vald/dev-vald-02.yaml
  • charts/vald/values/vald-backup-via-s3.yaml
  • charts/vald/templates/gateway/mirror/configmap.yaml
  • charts/vald/templates/gateway/lb/configmap.yaml
  • charts/vald/values/dev-broken-index-backup.yaml
  • charts/vald/values/dev-observability.yaml
  • charts/vald/values/multi-vald/dev-vald-01.yaml
  • charts/vald/values/agent-ngt-standalone.yaml
  • charts/vald/values/vald-backup-via-pv-and-s3.yaml
  • cmd/gateway/mirror/sample.yaml
  • charts/vald-helm-operator/crds/valdrelease.yaml
  • cmd/gateway/lb/sample.yaml
Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the new `gateway` section configurations are correctly integrated and documented.

# Test: Search for the usage and documentation of the new `gateway` section.
rg --type yaml -A 5 'gateway:'

Length of output: 12332

Comment on lines 135 to 691

// udate the vector with the new one
log.Infof("timestamp inconsistency detected with vector(id: %s, timestamp: %v). updating with the latest vector(id: %s, timestamp: %v)",
replica.vec.GetId(),
replica.vec.GetTimestamp(),
latest.vec.GetId(),
latest.vec.GetTimestamp(),
)
c.correctedOldIndexCount.Add(1)
if err := c.updateObject(ctx, replica, latest); err != nil {
return err
}
}

return nil
}

// correctReplica corrects the number of replicas of the target vector.
// skipcq: GO-R1005
func (c *correct) correctReplica(
ctx context.Context, targetReplica *vectorReplica, foundReplicas []*vectorReplica,
) error {
// diff < 0 means there is less replica than the correct number
existReplica := len(foundReplicas) + 1
diff := existReplica - c.indexReplica
if diff == 0 {
// replica number is correct
return nil
}

// availableAddrs = c.agentAddrs - foundReplicas - targetReplica.addr
// here we use c.agentAddrs because we want to decide by memory usage order
// not the number of indexes
availableAddrs := make([]string, 0, len(c.agentAddrs))
for _, addr := range c.agentAddrs {
if addr == targetReplica.addr {
continue
}
if slices.ContainsFunc(foundReplicas, func(replica *vectorReplica) bool {
return replica.addr == addr
}) {
continue
}
availableAddrs = append(availableAddrs, addr)
errs = append(errs, err)
}

// when there are less replicas than the correct number, add the extra replicas
if diff < 0 {
log.Infof("replica shortage of vector %s. inserting to other agents...", targetReplica.vec.GetId())
c.correctedReplicationCount.Add(1)
if len(availableAddrs) == 0 {
return errors.ErrNoAvailableAgentToInsert
}

// inserting with the reverse order of availableAddrs since the last agent has the lowest memory usage
for i := len(availableAddrs) - 1; i >= 0 && diff < 0; i-- {
addr := availableAddrs[i]
log.Infof("inserting replica to %s", addr)
if err := c.insertObject(ctx, addr, targetReplica.vec); err != nil {
log.Errorf("failed to insert object to agent(%s): %v", addr, err)
continue
}
diff++
}

if diff < 0 {
return errors.ErrFailedToCorrectReplicaNum
}

return nil
}

// when there are more replicas than the correct number, delete the extra replicas
log.Infof("replica oversupply of vector %s. deleting...",
targetReplica.vec.GetId())
c.correctedReplicationCount.Add(1)
// delete from myself
if err := c.deleteObject(ctx, targetReplica.addr, targetReplica.vec); err != nil {
log.Errorf("failed to delete object from agent(%s): %v", targetReplica.addr, err)
} else {
diff--
}

// delte from others if there's more to delete
for _, replica := range foundReplicas {
if diff == 0 {
break
}
if err := c.deleteObject(ctx, replica.addr, replica.vec); err != nil {
log.Errorf("failed to delete object from agent(%s): %v", replica.addr, err)
continue
}
diff--
}

if diff > 0 {
return errors.ErrFailedToCorrectReplicaNum
if len(errs) != 0 {
return errors.Join(errs...)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add test coverage for the Start method.

Several lines in the method are not covered by tests.

Do you want me to implement the test cases for this method or open a GitHub issue to track this task?

Tools
GitHub Check: codecov/patch

[warning] 135-137: pkg/index/job/correction/service/corrector.go#L135-L137
Added lines #L135 - L137 were not covered by tests


[warning] 140-144: pkg/index/job/correction/service/corrector.go#L140-L144
Added lines #L140 - L144 were not covered by tests


[warning] 146-148: pkg/index/job/correction/service/corrector.go#L146-L148
Added lines #L146 - L148 were not covered by tests


[warning] 150-150: pkg/index/job/correction/service/corrector.go#L150
Added line #L150 was not covered by tests


[warning] 152-152: pkg/index/job/correction/service/corrector.go#L152
Added line #L152 was not covered by tests


[warning] 154-154: pkg/index/job/correction/service/corrector.go#L154
Added line #L154 was not covered by tests


[warning] 156-156: pkg/index/job/correction/service/corrector.go#L156
Added line #L156 was not covered by tests


[warning] 158-158: pkg/index/job/correction/service/corrector.go#L158
Added line #L158 was not covered by tests


[warning] 160-166: pkg/index/job/correction/service/corrector.go#L160-L166
Added lines #L160 - L166 were not covered by tests


[warning] 168-168: pkg/index/job/correction/service/corrector.go#L168
Added line #L168 was not covered by tests


[warning] 171-176: pkg/index/job/correction/service/corrector.go#L171-L176
Added lines #L171 - L176 were not covered by tests


[warning] 178-178: pkg/index/job/correction/service/corrector.go#L178
Added line #L178 was not covered by tests


[warning] 181-185: pkg/index/job/correction/service/corrector.go#L181-L185
Added lines #L181 - L185 were not covered by tests


[warning] 187-188: pkg/index/job/correction/service/corrector.go#L187-L188
Added lines #L187 - L188 were not covered by tests


[warning] 190-192: pkg/index/job/correction/service/corrector.go#L190-L192
Added lines #L190 - L192 were not covered by tests


[warning] 194-200: pkg/index/job/correction/service/corrector.go#L194-L200
Added lines #L194 - L200 were not covered by tests


[warning] 202-202: pkg/index/job/correction/service/corrector.go#L202
Added line #L202 was not covered by tests


[warning] 204-205: pkg/index/job/correction/service/corrector.go#L204-L205
Added lines #L204 - L205 were not covered by tests

Comment on lines +204 to +229
} else {
eg.Go(safety.RecoverFunc(func() (err error) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add test coverage for the correct method.

Several lines in the method are not covered by tests.

Do you want me to implement the test cases for this method or open a GitHub issue to track this task?

Tools
GitHub Check: codecov/patch

[warning] 204-205: pkg/index/job/correction/service/corrector.go#L204-L205
Added lines #L204 - L205 were not covered by tests

@kpango kpango force-pushed the bugfix/index-correction/refactor-and-bugfix-index-correction branch from e5b414a to dff4359 Compare August 5, 2024 07:20
@kpango kpango force-pushed the bugfix/index-correction/refactor-and-bugfix-index-correction branch 3 times, most recently from a2d8284 to f2dc942 Compare August 5, 2024 19:48
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 12

Outside diff range, codebase verification and nitpick comments (7)
pkg/index/job/correction/service/corrector_test.go (7)

Line range hint 1-112:
Reminder: Implement test cases for New.

The test cases for the New function are currently commented out and not implemented. Ensure that these test cases are added to verify the functionality.

Do you want me to help implement these test cases or open a GitHub issue to track this task?


Line range hint 112-238:
Reminder: Implement test cases for correct.StartClient.

The test cases for the correct.StartClient method are currently commented out and not implemented. Ensure that these test cases are added to verify the functionality.

Do you want me to help implement these test cases or open a GitHub issue to track this task?


Line range hint 254-376:
Reminder: Implement test cases for correct.Start.

The test cases for the correct.Start method are currently commented out and not implemented. Ensure that these test cases are added to verify the functionality.

Do you want me to help implement these test cases or open a GitHub issue to track this task?


Line range hint 392-514:
Reminder: Implement test cases for correct.PreStop.

The test cases for the correct.PreStop method are currently commented out and not implemented. Ensure that these test cases are added to verify the functionality.

Do you want me to help implement these test cases or open a GitHub issue to track this task?


Line range hint 527-642:
Reminder: Implement test cases for correct.NumberOfCheckedIndex.

The test cases for the correct.NumberOfCheckedIndex method are currently commented out and not implemented. Ensure that these test cases are added to verify the functionality.

Do you want me to help implement these test cases or open a GitHub issue to track this task?


Line range hint 655-770:
Reminder: Implement test cases for correct.NumberOfCorrectedOldIndex.

The test cases for the correct.NumberOfCorrectedOldIndex method are currently commented out and not implemented. Ensure that these test cases are added to verify the functionality.

Do you want me to help implement these test cases or open a GitHub issue to track this task?


Line range hint 783-898:
Reminder: Implement test cases for correct.NumberOfCorrectedReplication.

The test cases for the correct.NumberOfCorrectedReplication method are currently commented out and not implemented. Ensure that these test cases are added to verify the functionality.

Do you want me to help implement these test cases or open a GitHub issue to track this task?

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between abb6301 and f2dc942.

Files ignored due to path filters (2)
  • go.sum is excluded by !**/*.sum
  • rust/Cargo.lock is excluded by !**/*.lock
Files selected for processing (52)
  • .gitfiles (3 hunks)
  • .github/helm/values/values-correction.yaml (1 hunks)
  • .github/workflows/dockers-binfmt-image.yaml (1 hunks)
  • .github/workflows/dockers-buildkit-image.yaml (1 hunks)
  • Makefile (2 hunks)
  • Makefile.d/dependencies.mk (1 hunks)
  • Makefile.d/docker.mk (2 hunks)
  • Makefile.d/e2e.mk (1 hunks)
  • Makefile.d/functions.mk (1 hunks)
  • Makefile.d/k8s.mk (2 hunks)
  • Makefile.d/proto.mk (2 hunks)
  • Makefile.d/test.mk (1 hunks)
  • charts/vald-helm-operator/crds/valdrelease.yaml (2 hunks)
  • charts/vald/README.md (1 hunks)
  • charts/vald/templates/gateway/lb/networkpolicy.yaml (2 hunks)
  • charts/vald/templates/index/job/correction/configmap.yaml (1 hunks)
  • charts/vald/templates/index/job/correction/networkpolicy.yaml (2 hunks)
  • charts/vald/values.schema.json (2 hunks)
  • charts/vald/values.yaml (1 hunks)
  • dockers/binfmt/Dockerfile (1 hunks)
  • dockers/buildkit/Dockerfile (1 hunks)
  • example/client/go.mod (1 hunks)
  • go.mod (8 hunks)
  • internal/config/corrector.go (2 hunks)
  • internal/config/corrector_test.go (4 hunks)
  • internal/db/kvs/pogreb/options.go (2 hunks)
  • internal/db/kvs/pogreb/options_test.go (2 hunks)
  • internal/db/kvs/pogreb/pogreb.go (2 hunks)
  • internal/db/kvs/pogreb/pogreb_test.go (16 hunks)
  • internal/errors/corrector.go (1 hunks)
  • k8s/index/job/correction/configmap.yaml (1 hunks)
  • k8s/index/job/correction/cronjob.yaml (1 hunks)
  • k8s/index/job/creation/configmap.yaml (1 hunks)
  • k8s/index/job/creation/cronjob.yaml (1 hunks)
  • k8s/index/job/save/configmap.yaml (1 hunks)
  • k8s/index/job/save/cronjob.yaml (1 hunks)
  • k8s/index/operator/configmap.yaml (1 hunks)
  • k8s/index/operator/deployment.yaml (1 hunks)
  • k8s/index/operator/priorityclass.yaml (1 hunks)
  • k8s/operator/helm/crds/valdrelease.yaml (2 hunks)
  • pkg/agent/core/ngt/service/ngt_test.go (3 hunks)
  • pkg/gateway/lb/handler/grpc/handler_test.go (3 hunks)
  • pkg/index/job/correction/service/corrector.go (3 hunks)
  • pkg/index/job/correction/service/corrector_test.go (26 hunks)
  • pkg/index/job/correction/service/options.go (3 hunks)
  • pkg/index/job/correction/service/options_test.go (6 hunks)
  • pkg/index/job/correction/usecase/corrector.go (5 hunks)
  • tests/e2e/crud/crud_test.go (1 hunks)
  • versions/CMAKE_VERSION (1 hunks)
  • versions/PROMETHEUS_STACK_VERSION (1 hunks)
  • versions/YQ_VERSION (1 hunks)
  • versions/actions/ACTIONS_UPLOAD_ARTIFACT (1 hunks)
Files skipped from review due to trivial changes (13)
  • .gitfiles
  • Makefile.d/test.mk
  • charts/vald/templates/gateway/lb/networkpolicy.yaml
  • dockers/binfmt/Dockerfile
  • dockers/buildkit/Dockerfile
  • internal/errors/corrector.go
  • k8s/index/job/correction/configmap.yaml
  • k8s/index/job/creation/configmap.yaml
  • k8s/index/operator/configmap.yaml
  • k8s/index/operator/deployment.yaml
  • k8s/index/operator/priorityclass.yaml
  • pkg/gateway/lb/handler/grpc/handler_test.go
  • versions/CMAKE_VERSION
Files skipped from review as they are similar to previous changes (30)
  • .github/helm/values/values-correction.yaml
  • .github/workflows/dockers-binfmt-image.yaml
  • .github/workflows/dockers-buildkit-image.yaml
  • Makefile
  • Makefile.d/dependencies.mk
  • Makefile.d/docker.mk
  • Makefile.d/e2e.mk
  • Makefile.d/functions.mk
  • Makefile.d/proto.mk
  • charts/vald/README.md
  • charts/vald/templates/index/job/correction/networkpolicy.yaml
  • charts/vald/values.schema.json
  • charts/vald/values.yaml
  • example/client/go.mod
  • go.mod
  • internal/config/corrector.go
  • internal/config/corrector_test.go
  • internal/db/kvs/pogreb/pogreb.go
  • k8s/index/job/correction/cronjob.yaml
  • k8s/index/job/creation/cronjob.yaml
  • k8s/index/job/save/configmap.yaml
  • k8s/index/job/save/cronjob.yaml
  • k8s/operator/helm/crds/valdrelease.yaml
  • pkg/agent/core/ngt/service/ngt_test.go
  • pkg/index/job/correction/service/options.go
  • pkg/index/job/correction/usecase/corrector.go
  • tests/e2e/crud/crud_test.go
  • versions/PROMETHEUS_STACK_VERSION
  • versions/YQ_VERSION
  • versions/actions/ACTIONS_UPLOAD_ARTIFACT
Additional context used
Learnings (1)
charts/vald-helm-operator/crds/valdrelease.yaml (1)
Learnt from: kpango
PR: vdaas/vald#2564
File: charts/vald-helm-operator/crds/valdrelease.yaml:8084-8085
Timestamp: 2024-08-05T14:46:41.089Z
Learning: The `kvs_background_compaction_interval` property in the `valdrelease.yaml` file should use the pattern `^[0-9]+(ns|us|ms|s|m|h|d)$` to validate durations specified in nanoseconds, microseconds, milliseconds, seconds, minutes, hours, and days.
Additional comments not posted (24)
internal/db/kvs/pogreb/options.go (2)

43-49: LGTM! Simplified parameter type for WithBackgroundSyncInterval.

The change to accept time.Duration instead of string enhances type safety and reduces potential runtime errors.


55-61: LGTM! Simplified parameter type for WithBackgroundCompactionInterval.

The change to accept time.Duration instead of string enhances type safety and reduces potential runtime errors.

charts/vald/templates/index/job/correction/configmap.yaml (3)

54-55: LGTM! Added new configuration parameters.

The new parameters kvs_background_sync_interval and kvs_background_compaction_interval enhance the configurability of background synchronization and compaction intervals.


57-75: LGTM! Enhanced gateway configuration.

The new logic for conditional settings based on the gateway's enabled status allows for greater flexibility in server connection setups.


79-79: LGTM! Updated client reference in discoverer section.

The update from $index to $corrector ensures that the correct client configuration is utilized for consistency.

pkg/index/job/correction/service/options_test.go (1)

Line range hint 443-526:
LGTM! But verify the function usage in the codebase.

The code changes are approved.

However, ensure that all function calls to TestWithKVSSyncInterval match the new signature.

internal/db/kvs/pogreb/pogreb_test.go (4)

493-494: LGTM! But verify the function usage in the codebase.

The code changes are approved.

However, ensure that all function calls to beforeFunc and afterFunc in Test_db_Len match the new signature.

Verification successful

LGTM! The function usage has been verified and matches the new signature.

All instances of beforeFunc and afterFunc in Test_db_Len and related tests have been updated to use the new signature (func(*testing.T, DB, args)) consistently.

Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify all function calls to `beforeFunc` and `afterFunc` in `Test_db_Len` match the new signature.

# Test: Search for the function usage. Expect: Only occurrences of the new signature.
rg --type go -A 5 $'beforeFunc.*DB'
rg --type go -A 5 $'afterFunc.*DB'

Length of output: 8813


125-126: LGTM! But verify the function usage in the codebase.

The code changes are approved.

However, ensure that all function calls to beforeFunc and afterFunc in Test_db_Get match the new signature.

Verification successful

Verification successful.

All instances of beforeFunc and afterFunc in internal/db/kvs/pogreb/pogreb_test.go match the new signature with DB.

  • beforeFunc: func(*testing.T, DB, args)
  • afterFunc: func(*testing.T, DB, args)
Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify all function calls to `beforeFunc` and `afterFunc` in `Test_db_Get` match the new signature.

# Test: Search for the function usage. Expect: Only occurrences of the new signature.
rg --type go -A 5 $'beforeFunc.*DB'
rg --type go -A 5 $'afterFunc.*DB'

Length of output: 8813


349-350: LGTM! But verify the function usage in the codebase.

The code changes are approved.

However, ensure that all function calls to beforeFunc and afterFunc in Test_db_Range match the new signature.

Verification successful

Verification successful!

All instances of beforeFunc and afterFunc in Test_db_Range match the new signature func(*testing.T, DB, args).

  • internal/db/kvs/pogreb/pogreb_test.go
Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify all function calls to `beforeFunc` and `afterFunc` in `Test_db_Range` match the new signature.

# Test: Search for the function usage. Expect: Only occurrences of the new signature.
rg --type go -A 5 $'beforeFunc.*DB'
rg --type go -A 5 $'afterFunc.*DB'

Length of output: 8813


251-252: LGTM! But verify the function usage in the codebase.

The code changes are approved.

However, ensure that all function calls to beforeFunc and afterFunc in Test_db_Delete match the new signature.

Verification successful

All function calls to beforeFunc and afterFunc in Test_db_Delete match the new signature.

The code changes are verified and approved.

Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify all function calls to `beforeFunc` and `afterFunc` in `Test_db_Delete` match the new signature.

# Test: Search for the function usage. Expect: Only occurrences of the new signature.
rg --type go -A 5 $'beforeFunc.*DB'
rg --type go -A 5 $'afterFunc.*DB'

Length of output: 8813

Makefile.d/k8s.mk (2)

40-43: Approved: New Helm template options added.

The changes enhance configurability and maintainability of the deployment process for the Kubernetes environment.


543-563: Approved: Updated telepresence commands.

The changes allow for more dynamic and flexible repository management, enabling easier adjustments based on the repository context.

charts/vald-helm-operator/crds/valdrelease.yaml (12)

7891-7897: Add validation constraints for addrs.

Ensure that the addrs array contains valid URLs or IP addresses.

addrs:
  type: array
  items:
    type: string
    format: uri

7898-7914: Add default values for backoff properties.

Consider adding default values for backoff properties to ensure consistent behavior.

backoff:
  type: object
  properties:
    backoff_factor:
      type: number
      default: 2.0
    backoff_time_limit:
      type: string
      default: "10s"
    enable_error_log:
      type: boolean
      default: true
    initial_duration:
      type: string
      default: "1s"
    jitter_limit:
      type: string
      default: "1s"
    maximum_duration:
      type: string
      default: "30s"
    retry_count:
      type: integer
      default: 5

7918-7930: Add default values for circuit_breaker properties.

Consider adding default values for circuit_breaker properties to ensure consistent behavior.

circuit_breaker:
  type: object
  properties:
    closed_error_rate:
      type: number
      default: 0.1
    closed_refresh_timeout:
      type: string
      default: "10s"
    half_open_error_rate:
      type: number
      default: 0.5
    min_samples:
      type: integer
      default: 10
    open_timeout:
      type: string
      default: "30s"

7931-7943: Add default values for connection_pool properties.

Consider adding default values for connection_pool properties to ensure consistent behavior.

connection_pool:
  type: object
  properties:
    enable_dns_resolver:
      type: boolean
      default: true
    enable_rebalance:
      type: boolean
      default: true
    old_conn_close_duration:
      type: string
      default: "1m"
    rebalance_duration:
      type: string
      default: "5m"
    size:
      type: integer
      default: 10

7944-7967: Add default values for dial_option properties.

Consider adding default values for dial_option properties to ensure consistent behavior.

dial_option:
  type: object
  properties:
    backoff_base_delay:
      type: string
      default: "1s"
    backoff_jitter:
      type: number
      default: 0.2
    backoff_max_delay:
      type: string
      default: "10s"
    backoff_multiplier:
      type: number
      default: 1.5
    enable_backoff:
      type: boolean
      default: true
    initial_connection_window_size:
      type: integer
      default: 65536
    initial_window_size:
      type: integer
      default: 65536
    insecure:
      type: boolean
      default: false
    interceptors:
      type: array
      items:
        type: string
        enum:
          - TraceInterceptor
    keepalive:
      type: object
      properties:
        permit_without_stream:
          type: boolean
          default: true
        time:
          type: string
          default: "30s"
        timeout:
          type: string
          default: "20s"
    max_msg_size:
      type: integer
      default: 4194304
    min_connection_timeout:
      type: string
      default: "20s"
    net:
      type: object
      properties:
        dialer:
          type: object
          properties:
            dual_stack_enabled:
              type: boolean
              default: true
            keepalive:
              type: string
              default: "30s"
            timeout:
              type: string
              default: "30s"
        dns:
          type: object
          properties:
            cache_enabled:
              type: boolean
              default: true
            cache_expiration:
              type: string
              default: "5m"
            refresh_duration:
              type: string
              default: "10m"
        socket_option:
          type: object
          properties:
            ip_recover_destination_addr:
              type: boolean
              default: true
            ip_transparent:
              type: boolean
              default: false
            reuse_addr:
              type: boolean
              default: true
            reuse_port:
              type: boolean
              default: true
            tcp_cork:
              type: boolean
              default: false
            tcp_defer_accept:
              type: boolean
              default: true
            tcp_fast_open:
              type: boolean
              default: true
            tcp_no_delay:
              type: boolean
              default: true
            tcp_quick_ack:
              type: boolean
              default: true
    read_buffer_size:
      type: integer
      default: 4096
    timeout:
      type: string
      default: "30s"
    write_buffer_size:
      type: integer
      default: 4096

8045-8050: Add default values for message size properties.

Consider adding default values for max_recv_msg_size, max_retry_rpc_buffer_size, and max_send_msg_size to ensure consistent behavior.

max_recv_msg_size:
  type: integer
  default: 4194304
max_retry_rpc_buffer_size:
  type: integer
  default: 8388608
max_send_msg_size:
  type: integer
  default: 4194304

8051-8065: Add default values for tls properties.

Consider adding default values for tls properties to ensure consistent behavior.

tls:
  type: object
  properties:
    ca:
      type: string
      default: "/path/to/ca.crt"
    cert:
      type: string
      default: "/path/to/cert.crt"
    enabled:
      type: boolean
      default: true
    insecure_skip_verify:
      type: boolean
      default: false
    key:
      type: string
      default: "/path/to/key.key"

8084-8085: Add validation constraints for kvs_background_compaction_interval.

Ensure the kvs_background_compaction_interval property has a valid duration format.

kvs_background_compaction_interval:
  type: string
  pattern: ^[0-9]+(ns|us|ms|s|m|h|d)$

8086-8087: Add validation constraints for kvs_background_sync_interval.

Ensure the kvs_background_sync_interval property has a valid duration format.

kvs_background_sync_interval:
  type: string
  pattern: ^[0-9]+(ns|us|ms|s|m|h|d)$

8084-8087: Add validation constraints for kvs_background_compaction_interval and kvs_background_sync_interval.

Ensure the kvs_background_compaction_interval and kvs_background_sync_interval properties have a valid duration format.

kvs_background_compaction_interval:
  type: string
  pattern: ^[0-9]+(ns|us|ms|s|m|h|d)$
kvs_background_sync_interval:
  type: string
  pattern: ^[0-9]+(ns|us|ms|s|m|h|d)$

8045-8050: Add default values for message size properties.

Consider adding default values for max_recv_msg_size, max_retry_rpc_buffer_size, and max_send_msg_size to ensure consistent behavior.

max_recv_msg_size:
  type: integer
  default: 4194304
max_retry_rpc_buffer_size:
  type: integer
  default: 8388608
max_send_msg_size:
  type: integer
  default: 4194304

8051-8065: Add default values for tls properties.

Consider adding default values for tls properties to ensure consistent behavior.

tls:
  type: object
  properties:
    ca:
      type: string
      default: "/path/to/ca.crt"
    cert:
      type: string
      default: "/path/to/cert.crt"
    enabled:
      type: boolean
      default: true
    insecure_skip_verify:
      type: boolean
      default: false
    key:
      type: string
      default: "/path/to/key.key"

pkg/index/job/correction/service/corrector.go Outdated Show resolved Hide resolved
pkg/index/job/correction/service/corrector.go Show resolved Hide resolved
pkg/index/job/correction/service/corrector.go Show resolved Hide resolved
pkg/index/job/correction/service/corrector.go Show resolved Hide resolved
pkg/index/job/correction/service/corrector.go Show resolved Hide resolved
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 10

Outside diff range, codebase verification and nitpick comments (9)
charts/vald/README.md (1)

Ensure proper documentation for new configuration options.

The new configuration options manager.index.corrector.gateway, manager.index.corrector.kvs_background_compaction_interval, and manager.index.corrector.kvs_background_sync_interval are documented but lack examples. Please add detailed explanations and examples to ensure users understand their usage.

  • manager.index.corrector.gateway: gRPC client for gateway (overrides defaults.grpc.client)
  • manager.index.corrector.kvs_background_compaction_interval: interval of checked id list kvs compaction
  • manager.index.corrector.kvs_background_sync_interval: interval of checked id list kvs sync
Analysis chain

Line range hint 1-1:
Ensure proper documentation for new configuration options.

The new configuration options should be clearly documented with examples and explanations to ensure users understand their usage.

Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the new configuration options are properly documented in the README.

# Test: Search for the new configuration options. Expect: Proper documentation with examples and explanations.
rg --type markdown 'manager.index.corrector.gateway|manager.index.corrector.kvs_background_compaction_interval|manager.index.corrector.kvs_background_sync_interval'

Length of output: 8203


Script:

#!/bin/bash
# Description: Verify if examples are provided for the new configuration options in the README.

# Test: Search for examples of the new configuration options. Expect: Examples should be present.
rg --type markdown 'example' -A 5

Length of output: 88095

charts/vald/templates/index/job/correction/configmap.yaml (1)

54-55: Ensure new configuration parameters are documented.

The new parameters kvs_background_sync_interval and kvs_background_compaction_interval should be documented to ensure users understand their purpose and usage.

pkg/index/job/correction/service/corrector_test.go (7)

Line range hint 1-1:
Implement test cases for the New function.

The test cases for the New function are currently not implemented.

Do you want me to implement the test cases for this function or open a GitHub issue to track this task?


Line range hint 112-165:
Implement test cases for the StartClient function.

The test cases for the StartClient function are currently not implemented.

Do you want me to implement the test cases for this function or open a GitHub issue to track this task?


Line range hint 254-303:
Implement test cases for the Start function.

The test cases for the Start function are currently not implemented.

Do you want me to implement the test cases for this function or open a GitHub issue to track this task?


Line range hint 392-441:
Implement test cases for the PreStop function.

The test cases for the PreStop function are currently not implemented.

Do you want me to implement the test cases for this function or open a GitHub issue to track this task?


Line range hint 527-572:
Implement test cases for the NumberOfCheckedIndex function.

The test cases for the NumberOfCheckedIndex function are currently not implemented.

Do you want me to implement the test cases for this function or open a GitHub issue to track this task?


Line range hint 655-700:
Implement test cases for the NumberOfCorrectedOldIndex function.

The test cases for the NumberOfCorrectedOldIndex function are currently not implemented.

Do you want me to implement the test cases for this function or open a GitHub issue to track this task?


Line range hint 783-828:
Implement test cases for the NumberOfCorrectedReplication function.

The test cases for the NumberOfCorrectedReplication function are currently not implemented.

Do you want me to implement the test cases for this function or open a GitHub issue to track this task?

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between abb6301 and f2dc942.

Files ignored due to path filters (2)
  • go.sum is excluded by !**/*.sum
  • rust/Cargo.lock is excluded by !**/*.lock
Files selected for processing (52)
  • .gitfiles (3 hunks)
  • .github/helm/values/values-correction.yaml (1 hunks)
  • .github/workflows/dockers-binfmt-image.yaml (1 hunks)
  • .github/workflows/dockers-buildkit-image.yaml (1 hunks)
  • Makefile (2 hunks)
  • Makefile.d/dependencies.mk (1 hunks)
  • Makefile.d/docker.mk (2 hunks)
  • Makefile.d/e2e.mk (1 hunks)
  • Makefile.d/functions.mk (1 hunks)
  • Makefile.d/k8s.mk (2 hunks)
  • Makefile.d/proto.mk (2 hunks)
  • Makefile.d/test.mk (1 hunks)
  • charts/vald-helm-operator/crds/valdrelease.yaml (2 hunks)
  • charts/vald/README.md (1 hunks)
  • charts/vald/templates/gateway/lb/networkpolicy.yaml (2 hunks)
  • charts/vald/templates/index/job/correction/configmap.yaml (1 hunks)
  • charts/vald/templates/index/job/correction/networkpolicy.yaml (2 hunks)
  • charts/vald/values.schema.json (2 hunks)
  • charts/vald/values.yaml (1 hunks)
  • dockers/binfmt/Dockerfile (1 hunks)
  • dockers/buildkit/Dockerfile (1 hunks)
  • example/client/go.mod (1 hunks)
  • go.mod (8 hunks)
  • internal/config/corrector.go (2 hunks)
  • internal/config/corrector_test.go (4 hunks)
  • internal/db/kvs/pogreb/options.go (2 hunks)
  • internal/db/kvs/pogreb/options_test.go (2 hunks)
  • internal/db/kvs/pogreb/pogreb.go (2 hunks)
  • internal/db/kvs/pogreb/pogreb_test.go (16 hunks)
  • internal/errors/corrector.go (1 hunks)
  • k8s/index/job/correction/configmap.yaml (1 hunks)
  • k8s/index/job/correction/cronjob.yaml (1 hunks)
  • k8s/index/job/creation/configmap.yaml (1 hunks)
  • k8s/index/job/creation/cronjob.yaml (1 hunks)
  • k8s/index/job/save/configmap.yaml (1 hunks)
  • k8s/index/job/save/cronjob.yaml (1 hunks)
  • k8s/index/operator/configmap.yaml (1 hunks)
  • k8s/index/operator/deployment.yaml (1 hunks)
  • k8s/index/operator/priorityclass.yaml (1 hunks)
  • k8s/operator/helm/crds/valdrelease.yaml (2 hunks)
  • pkg/agent/core/ngt/service/ngt_test.go (3 hunks)
  • pkg/gateway/lb/handler/grpc/handler_test.go (3 hunks)
  • pkg/index/job/correction/service/corrector.go (3 hunks)
  • pkg/index/job/correction/service/corrector_test.go (26 hunks)
  • pkg/index/job/correction/service/options.go (3 hunks)
  • pkg/index/job/correction/service/options_test.go (6 hunks)
  • pkg/index/job/correction/usecase/corrector.go (5 hunks)
  • tests/e2e/crud/crud_test.go (1 hunks)
  • versions/CMAKE_VERSION (1 hunks)
  • versions/PROMETHEUS_STACK_VERSION (1 hunks)
  • versions/YQ_VERSION (1 hunks)
  • versions/actions/ACTIONS_UPLOAD_ARTIFACT (1 hunks)
Files skipped from review due to trivial changes (6)
  • .gitfiles
  • Makefile.d/test.mk
  • dockers/binfmt/Dockerfile
  • dockers/buildkit/Dockerfile
  • internal/errors/corrector.go
  • versions/CMAKE_VERSION
Files skipped from review as they are similar to previous changes (34)
  • .github/helm/values/values-correction.yaml
  • .github/workflows/dockers-binfmt-image.yaml
  • .github/workflows/dockers-buildkit-image.yaml
  • Makefile
  • Makefile.d/dependencies.mk
  • Makefile.d/e2e.mk
  • Makefile.d/functions.mk
  • Makefile.d/proto.mk
  • charts/vald/templates/gateway/lb/networkpolicy.yaml
  • charts/vald/templates/index/job/correction/networkpolicy.yaml
  • charts/vald/values.yaml
  • example/client/go.mod
  • go.mod
  • internal/config/corrector_test.go
  • internal/db/kvs/pogreb/options_test.go
  • internal/db/kvs/pogreb/pogreb.go
  • internal/db/kvs/pogreb/pogreb_test.go
  • k8s/index/job/correction/configmap.yaml
  • k8s/index/job/correction/cronjob.yaml
  • k8s/index/job/creation/configmap.yaml
  • k8s/index/job/creation/cronjob.yaml
  • k8s/index/job/save/configmap.yaml
  • k8s/index/job/save/cronjob.yaml
  • k8s/index/operator/deployment.yaml
  • k8s/index/operator/priorityclass.yaml
  • k8s/operator/helm/crds/valdrelease.yaml
  • pkg/agent/core/ngt/service/ngt_test.go
  • pkg/gateway/lb/handler/grpc/handler_test.go
  • pkg/index/job/correction/service/options.go
  • pkg/index/job/correction/usecase/corrector.go
  • tests/e2e/crud/crud_test.go
  • versions/PROMETHEUS_STACK_VERSION
  • versions/YQ_VERSION
  • versions/actions/ACTIONS_UPLOAD_ARTIFACT
Additional context used
Learnings (1)
charts/vald-helm-operator/crds/valdrelease.yaml (1)
Learnt from: kpango
PR: vdaas/vald#2564
File: charts/vald-helm-operator/crds/valdrelease.yaml:8084-8085
Timestamp: 2024-08-05T14:46:41.089Z
Learning: The `kvs_background_compaction_interval` property in the `valdrelease.yaml` file should use the pattern `^[0-9]+(ns|us|ms|s|m|h|d)$` to validate durations specified in nanoseconds, microseconds, milliseconds, seconds, minutes, hours, and days.
GitHub Check: codecov/patch
internal/db/kvs/pogreb/options.go

[warning] 55-55: internal/db/kvs/pogreb/options.go#L55
Added line #L55 was not covered by tests

internal/config/corrector.go

[warning] 63-64: internal/config/corrector.go#L63-L64
Added lines #L63 - L64 were not covered by tests


[warning] 69-70: internal/config/corrector.go#L69-L70
Added lines #L69 - L70 were not covered by tests

pkg/index/job/correction/service/corrector.go

[warning] 84-87: pkg/index/job/correction/service/corrector.go#L84-L87
Added lines #L84 - L87 were not covered by tests


[warning] 90-96: pkg/index/job/correction/service/corrector.go#L90-L96
Added lines #L90 - L96 were not covered by tests


[warning] 98-98: pkg/index/job/correction/service/corrector.go#L98
Added line #L98 was not covered by tests


[warning] 102-104: pkg/index/job/correction/service/corrector.go#L102-L104
Added lines #L102 - L104 were not covered by tests


[warning] 106-106: pkg/index/job/correction/service/corrector.go#L106
Added line #L106 was not covered by tests


[warning] 108-108: pkg/index/job/correction/service/corrector.go#L108
Added line #L108 was not covered by tests


[warning] 110-110: pkg/index/job/correction/service/corrector.go#L110
Added line #L110 was not covered by tests


[warning] 112-119: pkg/index/job/correction/service/corrector.go#L112-L119
Added lines #L112 - L119 were not covered by tests


[warning] 121-125: pkg/index/job/correction/service/corrector.go#L121-L125
Added lines #L121 - L125 were not covered by tests


[warning] 130-130: pkg/index/job/correction/service/corrector.go#L130
Added line #L130 was not covered by tests


[warning] 133-135: pkg/index/job/correction/service/corrector.go#L133-L135
Added lines #L133 - L135 were not covered by tests


[warning] 138-142: pkg/index/job/correction/service/corrector.go#L138-L142
Added lines #L138 - L142 were not covered by tests


[warning] 144-146: pkg/index/job/correction/service/corrector.go#L144-L146
Added lines #L144 - L146 were not covered by tests


[warning] 148-148: pkg/index/job/correction/service/corrector.go#L148
Added line #L148 was not covered by tests


[warning] 150-150: pkg/index/job/correction/service/corrector.go#L150
Added line #L150 was not covered by tests


[warning] 152-152: pkg/index/job/correction/service/corrector.go#L152
Added line #L152 was not covered by tests


[warning] 154-154: pkg/index/job/correction/service/corrector.go#L154
Added line #L154 was not covered by tests


[warning] 156-156: pkg/index/job/correction/service/corrector.go#L156
Added line #L156 was not covered by tests


[warning] 158-159: pkg/index/job/correction/service/corrector.go#L158-L159
Added lines #L158 - L159 were not covered by tests


[warning] 161-167: pkg/index/job/correction/service/corrector.go#L161-L167
Added lines #L161 - L167 were not covered by tests


[warning] 169-169: pkg/index/job/correction/service/corrector.go#L169
Added line #L169 was not covered by tests


[warning] 172-173: pkg/index/job/correction/service/corrector.go#L172-L173
Added lines #L172 - L173 were not covered by tests


[warning] 175-180: pkg/index/job/correction/service/corrector.go#L175-L180
Added lines #L175 - L180 were not covered by tests


[warning] 182-182: pkg/index/job/correction/service/corrector.go#L182
Added line #L182 was not covered by tests


[warning] 185-189: pkg/index/job/correction/service/corrector.go#L185-L189
Added lines #L185 - L189 were not covered by tests


[warning] 191-192: pkg/index/job/correction/service/corrector.go#L191-L192
Added lines #L191 - L192 were not covered by tests


[warning] 194-197: pkg/index/job/correction/service/corrector.go#L194-L197
Added lines #L194 - L197 were not covered by tests

Additional comments not posted (31)
charts/vald/README.md (1)

Line range hint 1-1:
Verify the removal of manager.index.corrector.kvs_async_write_concurrency.

Ensure that the removal of this option is consistent across the documentation and codebase.

Verification successful

Verification successful: The manager.index.corrector.kvs_async_write_concurrency option has been removed consistently across the documentation and codebase.

  • No occurrences found in markdown files.
  • No occurrences found in general files.
  • No occurrences found in comments or documentation strings within code files.
Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the removal of the `manager.index.corrector.kvs_async_write_concurrency` option.

# Test: Search for any remaining references to the removed option. Expect: No occurrences of the removed option.
rg --type markdown 'manager.index.corrector.kvs_async_write_concurrency'

Length of output: 72


Script:

#!/bin/bash
# Description: Verify the removal of the `manager.index.corrector.kvs_async_write_concurrency` option across the entire codebase.

# Test: Search for any remaining references to the removed option in all file types. Expect: No occurrences of the removed option.
rg 'manager.index.corrector.kvs_async_write_concurrency'

Length of output: 56


Script:

#!/bin/bash
# Description: Verify the removal of the `manager.index.corrector.kvs_async_write_concurrency` option in comments and documentation strings within code files.

# Test: Search for any remaining references to the removed option in comments and documentation strings. Expect: No occurrences of the removed option.
rg 'manager.index.corrector.kvs_async_write_concurrency' --type-add 'code:*.{js,ts,py,go,java,rb}' --type code --pcre2 -g '!*.md'

Length of output: 129

charts/vald/values.schema.json (2)

Line range hint 1-1:
Verify the removal of kvs_async_write_concurrency.

Ensure that the removal of this property is consistent across the schema and codebase.


Line range hint 1-1:
Ensure proper definition and documentation for new properties.

The new properties should be clearly defined with types and descriptions to ensure users understand their usage.

Verification successful

The new properties are properly defined and documented.

The properties gateway, kvs_background_compaction_interval, and kvs_background_sync_interval are correctly defined with appropriate types and descriptions.

  • gateway: An object with nested properties, each well-defined.
  • kvs_background_compaction_interval: A string with a description.
  • kvs_background_sync_interval: A string with a description.
Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the new properties are properly defined and documented in the schema.

# Test: Search for the new properties. Expect: Proper definitions with types and descriptions.
rg --type json 'gateway|kvs_background_compaction_interval|kvs_background_sync_interval'

Length of output: 5895


Script:

#!/bin/bash
# Description: Verify the complete definition of new properties in the schema, including types and other attributes.

# Test: Search for the new properties and include context lines to capture their full definitions.
rg --type json 'gateway|kvs_background_compaction_interval|kvs_background_sync_interval' -A 5

Length of output: 23111

internal/db/kvs/pogreb/options.go (2)

55-61: Verify the correctness of the WithBackgroundCompactionInterval implementation.

The new implementation should be checked to ensure it correctly handles the time.Duration type.

Verification successful

The implementation of the WithBackgroundCompactionInterval function correctly handles the time.Duration type.

The function sets the BackgroundCompactionInterval field of the pogreb.Options struct to the provided time.Duration value.

  • internal/db/kvs/pogreb/options.go:55-63
Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the correctness of the `WithBackgroundCompactionInterval` implementation.

# Test: Search for the function implementation. Expect: Proper handling of the `time.Duration` type.
ast-grep --lang go --pattern $'func WithBackgroundCompactionInterval(dur time.Duration) Option {
  return func(d *db) error {
    if d.opts == nil {
      d.opts = new(pogreb.Options)
    }
    d.opts.BackgroundCompactionInterval = dur
    return nil
  }
}'

Length of output: 804

Tools
GitHub Check: codecov/patch

[warning] 55-55: internal/db/kvs/pogreb/options.go#L55
Added line #L55 was not covered by tests


43-49: Verify the correctness of the WithBackgroundSyncInterval implementation.

The new implementation should be checked to ensure it correctly handles the time.Duration type.

Verification successful

The WithBackgroundSyncInterval implementation correctly handles the time.Duration type.

  • The function checks if d.opts is nil and initializes it if necessary.
  • The dur parameter is correctly assigned to d.opts.BackgroundSyncInterval.
Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the correctness of the `WithBackgroundSyncInterval` implementation.

# Test: Search for the function implementation. Expect: Proper handling of the `time.Duration` type.
ast-grep --lang go --pattern $'func WithBackgroundSyncInterval(dur time.Duration) Option {
  return func(d *db) error {
    if d.opts == nil {
      d.opts = new(pogreb.Options)
    }
    d.opts.BackgroundSyncInterval = dur
    return nil
  }
}'

Length of output: 780

internal/config/corrector.go (3)

53-54: Add tests for Gateway field in Bind method.

The new Gateway field should be covered by tests to ensure its correctness.


63-64: Add tests for new fields in Bind method.

The new fields KVSBackgroundCompactionInterval and KVSBackgroundSyncInterval should be covered by tests to ensure their correctness.

Tools
GitHub Check: codecov/patch

[warning] 63-64: internal/config/corrector.go#L63-L64
Added lines #L63 - L64 were not covered by tests


69-70: Add tests for Gateway field in Bind method.

The new Gateway field should be covered by tests to ensure its correctness.

Tools
GitHub Check: codecov/patch

[warning] 69-70: internal/config/corrector.go#L69-L70
Added lines #L69 - L70 were not covered by tests

charts/vald/templates/index/job/correction/configmap.yaml (1)

57-75: Verify gateway configuration logic.

Ensure that the gateway configuration logic correctly handles the enabled status and constructs server addresses dynamically.

Verification successful

The provided code snippet in charts/vald/templates/index/job/correction/configmap.yaml appears to handle the gateway configuration logic by checking if the gateway is enabled and then constructing the server addresses dynamically. The if condition checks if the gateway is enabled, and based on that, it sets the appropriate server addresses.

However, to ensure that this logic is correctly implemented and used across the codebase, I will search for the usage of the gateway.enabled and related configurations in the Helm chart templates.


Verification successful: Gateway configuration logic

The gateway configuration logic correctly handles the enabled status and constructs server addresses dynamically as intended.

  • The if condition checks if the gateway is enabled.
  • Constructs server addresses dynamically based on the gateway's enabled status.
Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the gateway configuration logic in the Helm charts.

# Test: Search for the usage of the gateway configuration logic. Expect: Correct handling of enabled status and dynamic server addresses.
rg --type yaml -A 10 $'gateway:'

Length of output: 22388


Script:

#!/bin/bash
# Description: Verify the gateway configuration logic in the Helm charts.

# Search for the usage of `gateway.enabled` in the Helm chart templates to ensure correct handling.
rg --type yaml 'gateway\.enabled' -A 10

# Search for the usage of `gateway` in the Helm chart templates to see how the server addresses are constructed dynamically.
rg --type yaml 'gateway' -A 10

Length of output: 304345

Makefile.d/docker.mk (2)

19-41: Ensure new Docker build targets are correctly integrated.

The new Docker build targets should be correctly integrated into the build process to ensure they are built as expected.

Verification successful

New Docker build targets are correctly integrated.

The new Docker build targets have been successfully integrated into the build process, as evidenced by the .PHONY targets and their corresponding rules in the Makefile.d/docker.mk file.

  • Makefile.d/docker.mk: Integration of new Docker build targets.
Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the integration of new Docker build targets.

# Test: Search for the usage of new Docker build targets. Expect: Correct integration into the build process.
rg --type makefile -A 5 $'docker/build/'

Length of output: 72


Script:

#!/bin/bash
# Description: Verify the integration of new Docker build targets.

# Find all Makefiles and search for the usage of new Docker build targets.
fd -e mk -e Makefile | xargs rg 'docker/build/'

Length of output: 4616


200-221: Ensure new Docker build targets are correctly defined.

The new Docker build targets should be correctly defined with appropriate Dockerfiles and build arguments.

Verification successful

Verification successful: New Docker build targets are correctly defined.

The Docker build targets docker/build/buildkit and docker/build/binfmt are correctly defined with appropriate Dockerfiles and build arguments.

  • docker/build/buildkit uses $(ROOTDIR)/dockers/buildkit/Dockerfile
  • docker/build/binfmt uses $(ROOTDIR)/dockers/binfmt/Dockerfile
Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the definition of new Docker build targets.

# Test: Search for the definition of new Docker build targets. Expect: Correct Dockerfiles and build arguments.
rg --type makefile -A 5 $'docker/build/'

Length of output: 72


Script:

#!/bin/bash
# Description: Verify the definition of new Docker build targets.

# Find all Makefiles and search for the definition of new Docker build targets.
fd -e mk -e Makefile | xargs rg -A 5 $'docker/build/'

Length of output: 14435

pkg/index/job/correction/service/options_test.go (1)

Line range hint 443-526:
Verify the changes in TestWithKVSSyncInterval.

Ensure that the changes in the function name and argument type align with the new functionality being tested.

Makefile.d/k8s.mk (2)

40-43: LGTM!

The new Helm template options enable specific features of the manager index during the Helm chart rendering process.


543-563: LGTM!

Replacing hardcoded repository paths with a variable $(REPO) allows for more dynamic and flexible repository management.

k8s/index/operator/configmap.yaml (1)

18-27: LGTM!

The metadata for the ConfigMap includes the name and various labels for application identification.

pkg/index/job/correction/service/corrector.go (7)

106-130: LGTM!

The code changes are approved.

Tools
GitHub Check: codecov/patch

[warning] 106-106: pkg/index/job/correction/service/corrector.go#L106
Added line #L106 was not covered by tests


[warning] 108-108: pkg/index/job/correction/service/corrector.go#L108
Added line #L108 was not covered by tests


[warning] 110-110: pkg/index/job/correction/service/corrector.go#L110
Added line #L110 was not covered by tests


[warning] 112-119: pkg/index/job/correction/service/corrector.go#L112-L119
Added lines #L112 - L119 were not covered by tests


[warning] 121-125: pkg/index/job/correction/service/corrector.go#L121-L125
Added lines #L121 - L125 were not covered by tests


[warning] 130-130: pkg/index/job/correction/service/corrector.go#L130
Added line #L130 was not covered by tests


684-685: LGTM!

The code changes are approved.


692-693: LGTM!

The code changes are approved.


692-693: LGTM!

The code changes are approved.


692-693: LGTM!

The code changes are approved.


138-142: Verify the correctness of the agent processing logic.

Ensure that the agents are processed correctly based on the index details.

Verification successful

Verification successful: The agent processing logic is correct.

The agents are processed in a sorted order based on their stored counts, and the processing includes robust error handling and logging.

  • The agents are appended to the list and then sorted.
  • The sorted list is used in the OrderedRange method to process each agent.
Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the correctness of the agent processing logic.

# Test: Search for the agent processing logic. Expect: Correct processing based on index details.
rg --type go -A 5 'agents = append'

Length of output: 484


Script:

#!/bin/bash
# Description: Verify the correctness of the agent processing logic by examining the usage of the `agents` list after sorting.

# Search for the usage of the `agents` list in the corrector.go file to understand how it is processed after sorting.
rg --type go 'agents' -A 10 -B 10 pkg/index/job/correction/service/corrector.go

Length of output: 5545

Tools
GitHub Check: codecov/patch

[warning] 138-142: pkg/index/job/correction/service/corrector.go#L138-L142
Added lines #L138 - L142 were not covered by tests


90-98: Verify the correctness of the pogreb database initialization.

Ensure that the pogreb database is initialized correctly with the provided configuration options.

Tools
GitHub Check: codecov/patch

[warning] 90-96: pkg/index/job/correction/service/corrector.go#L90-L96
Added lines #L90 - L96 were not covered by tests


[warning] 98-98: pkg/index/job/correction/service/corrector.go#L98
Added line #L98 was not covered by tests

charts/vald-helm-operator/crds/valdrelease.yaml (9)

7891-7891: Add validation constraints for addrs.

Ensure that the addrs array contains valid URLs or IP addresses.

addrs:
  type: array
  items:
    type: string
    format: uri

7898-7914: Add default values for backoff properties.

Consider adding default values for backoff properties to ensure consistent behavior.

backoff:
  type: object
  properties:
    backoff_factor:
      type: number
      default: 2.0
    backoff_time_limit:
      type: string
      default: "10s"
    enable_error_log:
      type: boolean
      default: true
    initial_duration:
      type: string
      default: "1s"
    jitter_limit:
      type: string
      default: "1s"
    maximum_duration:
      type: string
      default: "30s"
    retry_count:
      type: integer
      default: 5

7918-7930: Add default values for circuit_breaker properties.

Consider adding default values for circuit_breaker properties to ensure consistent behavior.

circuit_breaker:
  type: object
  properties:
    closed_error_rate:
      type: number
      default: 0.1
    closed_refresh_timeout:
      type: string
      default: "10s"
    half_open_error_rate:
      type: number
      default: 0.5
    min_samples:
      type: integer
      default: 10
    open_timeout:
      type: string
      default: "30s"

7931-7943: Add default values for connection_pool properties.

Consider adding default values for connection_pool properties to ensure consistent behavior.

connection_pool:
  type: object
  properties:
    enable_dns_resolver:
      type: boolean
      default: true
    enable_rebalance:
      type: boolean
      default: true
    old_conn_close_duration:
      type: string
      default: "1m"
    rebalance_duration:
      type: string
      default: "5m"
    size:
      type: integer
      default: 10

7944-7967: Add default values for dial_option properties.

Consider adding default values for dial_option properties to ensure consistent behavior.

dial_option:
  type: object
  properties:
    backoff_base_delay:
      type: string
      default: "1s"
    backoff_jitter:
      type: number
      default: 0.2
    backoff_max_delay:
      type: string
      default: "10s"
    backoff_multiplier:
      type: number
      default: 1.5
    enable_backoff:
      type: boolean
      default: true
    initial_connection_window_size:
      type: integer
      default: 65536
    initial_window_size:
      type: integer
      default: 65536
    insecure:
      type: boolean
      default: false
    interceptors:
      type: array
      items:
        type: string
        enum:
          - TraceInterceptor
    keepalive:
      type: object
      properties:
        permit_without_stream:
          type: boolean
          default: true
        time:
          type: string
          default: "30s"
        timeout:
          type: string
          default: "20s"
    max_msg_size:
      type: integer
      default: 4194304
    min_connection_timeout:
      type: string
      default: "20s"
    net:
      type: object
      properties:
        dialer:
          type: object
          properties:
            dual_stack_enabled:
              type: boolean
              default: true
            keepalive:
              type: string
              default: "30s"
            timeout:
              type: string
              default: "30s"
        dns:
          type: object
          properties:
            cache_enabled:
              type: boolean
              default: true
            cache_expiration:
              type: string
              default: "5m"
            refresh_duration:
              type: string
              default: "10m"
        socket_option:
          type: object
          properties:
            ip_recover_destination_addr:
              type: boolean
              default: true
            ip_transparent:
              type: boolean
              default: false
            reuse_addr:
              type: boolean
              default: true
            reuse_port:
              type: boolean
              default: true
            tcp_cork:
              type: boolean
              default: false
            tcp_defer_accept:
              type: boolean
              default: true
            tcp_fast_open:
              type: boolean
              default: true
            tcp_no_delay:
              type: boolean
              default: true
            tcp_quick_ack:
              type: boolean
              default: true
    read_buffer_size:
      type: integer
      default: 4096
    timeout:
      type: string
      default: "30s"
    write_buffer_size:
      type: integer
      default: 4096

8045-8050: Add default values for message size properties.

Consider adding default values for max_recv_msg_size, max_retry_rpc_buffer_size, and max_send_msg_size to ensure consistent behavior.

max_recv_msg_size:
  type: integer
  default: 4194304
max_retry_rpc_buffer_size:
  type: integer
  default: 8388608
max_send_msg_size:
  type: integer
  default: 4194304

8051-8065: Add default values for tls properties.

Consider adding default values for tls properties to ensure consistent behavior.

tls:
  type: object
  properties:
    ca:
      type: string
      default: "/path/to/ca.crt"
    cert:
      type: string
      default: "/path/to/cert.crt"
    enabled:
      type: boolean
      default: true
    insecure_skip_verify:
      type: boolean
      default: false
    key:
      type: string
      default: "/path/to/key.key"

8084-8085: Add validation constraints for kvs_background_compaction_interval.

Ensure the kvs_background_compaction_interval property has a valid duration format.

kvs_background_compaction_interval:
  type: string
  pattern: ^[0-9]+(ns|us|ms|s|m|h|d)$

8086-8087: Add validation constraints for kvs_background_sync_interval.

Ensure the kvs_background_sync_interval property has a valid duration format.

kvs_background_sync_interval:
  type: string
  pattern: ^[0-9]+(ns|us|ms|s|m|h|d)$

@kpango kpango force-pushed the bugfix/index-correction/refactor-and-bugfix-index-correction branch 4 times, most recently from 3829cfb to 31556bd Compare August 5, 2024 20:56
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 6

Outside diff range, codebase verification and nitpick comments (15)
charts/vald/templates/index/job/correction/configmap.yaml (1)

54-55: Issues Found: Parameters Not Utilized in Application Logic

The new parameters kvs_background_sync_interval and kvs_background_compaction_interval are defined in the configuration (internal/config/corrector.go) but are not utilized in the application logic.

  • internal/config/corrector.go: Parameters are defined but not used elsewhere in the Go codebase.

Please ensure these parameters are properly integrated and utilized in the application logic.

Analysis chain

LGTM! Verify the integration of new parameters.

The new parameters kvs_background_sync_interval and kvs_background_compaction_interval are correctly added.

Ensure these parameters are properly integrated and utilized across the system.


Verify the integration of new parameters.

The new parameters kvs_background_sync_interval and kvs_background_compaction_interval are found in multiple configuration files. Ensure these parameters are properly utilized in the application logic or referenced in other configurations.


Verify the integration of new parameters.

The new parameters kvs_background_sync_interval and kvs_background_compaction_interval are found in multiple configuration files and in the application's configuration structure (internal/config/corrector.go). Ensure these parameters are properly utilized in the application logic.

Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the integration of new parameters.

# Test: Search for the usage of new parameters. Expect: Occurrences of the new parameters.
rg --type yaml 'kvs_background_sync_interval|kvs_background_compaction_interval'

Length of output: 1608


Script:

#!/bin/bash
# Description: Verify the usage of new parameters in the application logic or other configurations.

# Test: Search for the usage of new parameters in the codebase. Expect: Occurrences of the new parameters.
rg 'kvs_background_sync_interval|kvs_background_compaction_interval'

Length of output: 7414


Script:

#!/bin/bash
# Description: Verify the usage of new parameters in the application logic.

# Test: Search for the usage of new parameters in the application logic. Expect: Occurrences of the new parameters in Go files.
rg 'kvs_background_sync_interval|kvs_background_compaction_interval' --type go

Length of output: 372

Makefile.d/docker.mk (3)

200-210: The new buildkit targets are defined but not utilized elsewhere.

The targets docker/name/buildkit and docker/build/buildkit are correctly defined in Makefile.d/docker.mk, but there are no occurrences of their usage elsewhere in the codebase. Ensure these new targets are properly integrated into the build process.

  • Makefile.d/docker.mk
    • Lines defining docker/name/buildkit
    • Lines defining docker/build/buildkit
Analysis chain

LGTM! Verify the new buildkit targets.

The docker/name/buildkit and docker/build/buildkit targets are correctly added to enhance the build process for the buildkit image.

Ensure these new targets are properly utilized across the build process.

Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the new buildkit targets.

# Test: Search for the usage of new buildkit targets. Expect: Occurrences of the new buildkit targets.
rg --type makefile 'docker/name/buildkit|docker/build/buildkit'

Length of output: 98


Script:

#!/bin/bash
# Description: Verify the new buildkit targets.

# Test: Search for the usage of new buildkit targets. Expect: Occurrences of the new buildkit targets.
rg 'docker/name/buildkit|docker/build/buildkit'

Length of output: 283


211-221: Issue Found: Unused binfmt targets

The docker/name/binfmt and docker/build/binfmt targets are defined in the Makefile.d/docker.mk file but are not invoked or used anywhere in the codebase. This means they will not have any effect on the build process.

  • Makefile.d/docker.mk
    • docker/name/binfmt
    • docker/build/binfmt

Please ensure these new targets are properly integrated into the build process.

Analysis chain

LGTM! Verify the new binfmt targets.

The docker/name/binfmt and docker/build/binfmt targets are correctly added to enhance the build process for the binfmt image.

Ensure these new targets are properly utilized across the build process.

Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the new binfmt targets.

# Test: Search for the usage of new binfmt targets. Expect: Occurrences of the new binfmt targets.
rg --type makefile 'docker/name/binfmt|docker/build/binfmt'

Length of output: 94


Script:

#!/bin/bash
# Description: Verify the new binfmt targets.

# Test: Search for the usage of new binfmt targets. Expect: Occurrences of the new binfmt targets.
rg 'docker/name/binfmt|docker/build/binfmt'

Length of output: 269


Script:

#!/bin/bash
# Description: Verify the usage of the new binfmt targets.

# Test: Search for invocations of the new binfmt targets across the entire codebase. Expect: Occurrences of the new binfmt targets being used.
rg 'docker/name/binfmt|docker/build/binfmt'

Length of output: 269


19-41: Integration Issue Found: New Docker Build Targets Not Fully Referenced

The new Docker build targets docker/build/benchmark-job, docker/build/benchmark-operator, and docker/build/binfmt are defined in the Makefile.d/docker.mk file but are not referenced or used elsewhere in the codebase. This suggests that they might not be fully integrated into the build process.

  • Ensure these new targets are properly utilized across the build process.
  • Verify if additional references or integrations are needed for these targets.
Analysis chain

LGTM! Verify the new Docker build targets.

Several new Docker build targets are correctly added to enhance the build capabilities.

Ensure these new targets are properly utilized across the build process.

Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the new Docker build targets.

# Test: Search for the usage of new Docker build targets. Expect: Occurrences of the new Docker build targets.
rg --type makefile 'docker/build/benchmark-job|docker/build/benchmark-operator|docker/build/binfmt'

Length of output: 134


Script:

#!/bin/bash
# Description: Verify the new Docker build targets.

# Test: Search for the usage of new Docker build targets. Expect: Occurrences of the new Docker build targets.
rg 'docker/build/benchmark-job|docker/build/benchmark-operator|docker/build/binfmt' Makefile.d/docker.mk

Length of output: 379


Script:

#!/bin/bash
# Description: Verify the references of new Docker build targets.

# Test: Search for the references of new Docker build targets across the entire codebase.
rg 'docker/build/benchmark-job|docker/build/benchmark-operator|docker/build/binfmt'

Length of output: 547

pkg/index/job/correction/service/options_test.go (4)

Line range hint 102-172:
Implement the TestWithIndexReplica function.

The function is not implemented and contains TODO comments for test cases.

Do you want me to implement the test cases for this function or open a GitHub issue to track this task?


Line range hint 173-272:
Implement the TestWithDiscoverer function.

The function is not implemented and contains TODO comments for test cases.

Do you want me to implement the test cases for this function or open a GitHub issue to track this task?


Line range hint 443-526:
Implement the TestWithKVSSyncInterval function.

The function is not implemented and contains TODO comments for test cases.

Do you want me to implement the test cases for this function or open a GitHub issue to track this task?


Line range hint 528-605:
Implement the TestWithKVSCompactionInterval function.

The function is not implemented and contains TODO comments for test cases.

Do you want me to implement the test cases for this function or open a GitHub issue to track this task?

pkg/index/job/correction/service/corrector_test.go (7)

Line range hint 1-111:
Restore or replace the removed test case for New.

The test case for the New method has been removed. Ensure that equivalent test coverage is provided to validate the initialization logic.

Do you want me to help implement the test cases for this method or open a GitHub issue to track this task?


Line range hint 112-252:
Restore or replace the removed test case for StartClient.

The test case for the StartClient method has been removed. Ensure that equivalent test coverage is provided to validate the client start logic.

Do you want me to help implement the test cases for this method or open a GitHub issue to track this task?


Line range hint 254-390:
Restore or replace the removed test case for Start.

The test case for the Start method has been removed. Ensure that equivalent test coverage is provided to validate the start logic.

Do you want me to help implement the test cases for this method or open a GitHub issue to track this task?


Line range hint 392-526:
Restore or replace the removed test case for PreStop.

The test case for the PreStop method has been removed. Ensure that equivalent test coverage is provided to validate the cleanup logic.

Do you want me to help implement the test cases for this method or open a GitHub issue to track this task?


Line range hint 527-654:
Restore or replace the removed test case for NumberOfCheckedIndex.

The test case for the NumberOfCheckedIndex method has been removed. Ensure that equivalent test coverage is provided to validate the count logic.

Do you want me to help implement the test cases for this method or open a GitHub issue to track this task?


Line range hint 655-782:
Restore or replace the removed test case for NumberOfCorrectedOldIndex.

The test case for the NumberOfCorrectedOldIndex method has been removed. Ensure that equivalent test coverage is provided to validate the count logic.

Do you want me to help implement the test cases for this method or open a GitHub issue to track this task?


Line range hint 783-900:
Restore or replace the removed test case for NumberOfCorrectedReplication.

The test case for the NumberOfCorrectedReplication method has been removed. Ensure that equivalent test coverage is provided to validate the count logic.

Do you want me to help implement the test cases for this method or open a GitHub issue to track this task?

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between f2dc942 and 31556bd.

Files ignored due to path filters (2)
  • go.sum is excluded by !**/*.sum
  • rust/Cargo.lock is excluded by !**/*.lock
Files selected for processing (53)
  • .gitfiles (3 hunks)
  • .github/helm/values/values-correction.yaml (1 hunks)
  • .github/workflows/dockers-binfmt-image.yaml (1 hunks)
  • .github/workflows/dockers-buildkit-image.yaml (1 hunks)
  • Makefile (2 hunks)
  • Makefile.d/dependencies.mk (1 hunks)
  • Makefile.d/docker.mk (2 hunks)
  • Makefile.d/e2e.mk (1 hunks)
  • Makefile.d/functions.mk (1 hunks)
  • Makefile.d/k8s.mk (2 hunks)
  • Makefile.d/proto.mk (2 hunks)
  • Makefile.d/test.mk (1 hunks)
  • charts/vald-helm-operator/crds/valdrelease.yaml (2 hunks)
  • charts/vald/README.md (1 hunks)
  • charts/vald/templates/gateway/lb/networkpolicy.yaml (2 hunks)
  • charts/vald/templates/index/job/correction/configmap.yaml (1 hunks)
  • charts/vald/templates/index/job/correction/networkpolicy.yaml (2 hunks)
  • charts/vald/values.schema.json (2 hunks)
  • charts/vald/values.yaml (1 hunks)
  • dockers/binfmt/Dockerfile (1 hunks)
  • dockers/buildkit/Dockerfile (1 hunks)
  • example/client/go.mod (1 hunks)
  • go.mod (8 hunks)
  • internal/config/corrector.go (2 hunks)
  • internal/config/corrector_test.go (4 hunks)
  • internal/db/kvs/pogreb/options.go (2 hunks)
  • internal/db/kvs/pogreb/options_test.go (2 hunks)
  • internal/db/kvs/pogreb/pogreb.go (2 hunks)
  • internal/db/kvs/pogreb/pogreb_test.go (16 hunks)
  • internal/errors/corrector.go (1 hunks)
  • internal/servers/servers.go (2 hunks)
  • k8s/index/job/correction/configmap.yaml (1 hunks)
  • k8s/index/job/correction/cronjob.yaml (1 hunks)
  • k8s/index/job/creation/configmap.yaml (1 hunks)
  • k8s/index/job/creation/cronjob.yaml (1 hunks)
  • k8s/index/job/save/configmap.yaml (1 hunks)
  • k8s/index/job/save/cronjob.yaml (1 hunks)
  • k8s/index/operator/configmap.yaml (1 hunks)
  • k8s/index/operator/deployment.yaml (1 hunks)
  • k8s/index/operator/priorityclass.yaml (1 hunks)
  • k8s/operator/helm/crds/valdrelease.yaml (2 hunks)
  • pkg/agent/core/ngt/service/ngt_test.go (3 hunks)
  • pkg/gateway/lb/handler/grpc/handler_test.go (3 hunks)
  • pkg/index/job/correction/service/corrector.go (3 hunks)
  • pkg/index/job/correction/service/corrector_test.go (26 hunks)
  • pkg/index/job/correction/service/options.go (3 hunks)
  • pkg/index/job/correction/service/options_test.go (6 hunks)
  • pkg/index/job/correction/usecase/corrector.go (5 hunks)
  • tests/e2e/crud/crud_test.go (1 hunks)
  • versions/CMAKE_VERSION (1 hunks)
  • versions/PROMETHEUS_STACK_VERSION (1 hunks)
  • versions/YQ_VERSION (1 hunks)
  • versions/actions/ACTIONS_UPLOAD_ARTIFACT (1 hunks)
Files skipped from review due to trivial changes (12)
  • .gitfiles
  • .github/helm/values/values-correction.yaml
  • .github/workflows/dockers-binfmt-image.yaml
  • Makefile.d/test.mk
  • charts/vald/templates/gateway/lb/networkpolicy.yaml
  • charts/vald/values.yaml
  • dockers/binfmt/Dockerfile
  • dockers/buildkit/Dockerfile
  • internal/errors/corrector.go
  • k8s/index/operator/priorityclass.yaml
  • pkg/agent/core/ngt/service/ngt_test.go
  • versions/CMAKE_VERSION
Files skipped from review as they are similar to previous changes (28)
  • .github/workflows/dockers-buildkit-image.yaml
  • Makefile
  • Makefile.d/dependencies.mk
  • Makefile.d/e2e.mk
  • Makefile.d/functions.mk
  • Makefile.d/proto.mk
  • charts/vald/README.md
  • charts/vald/templates/index/job/correction/networkpolicy.yaml
  • example/client/go.mod
  • internal/config/corrector.go
  • internal/config/corrector_test.go
  • internal/db/kvs/pogreb/pogreb.go
  • internal/db/kvs/pogreb/pogreb_test.go
  • k8s/index/job/correction/configmap.yaml
  • k8s/index/job/correction/cronjob.yaml
  • k8s/index/job/creation/cronjob.yaml
  • k8s/index/job/save/configmap.yaml
  • k8s/index/job/save/cronjob.yaml
  • k8s/index/operator/configmap.yaml
  • k8s/index/operator/deployment.yaml
  • k8s/operator/helm/crds/valdrelease.yaml
  • pkg/gateway/lb/handler/grpc/handler_test.go
  • pkg/index/job/correction/service/options.go
  • pkg/index/job/correction/usecase/corrector.go
  • tests/e2e/crud/crud_test.go
  • versions/PROMETHEUS_STACK_VERSION
  • versions/YQ_VERSION
  • versions/actions/ACTIONS_UPLOAD_ARTIFACT
Additional context used
Learnings (1)
charts/vald-helm-operator/crds/valdrelease.yaml (1)
Learnt from: kpango
PR: vdaas/vald#2564
File: charts/vald-helm-operator/crds/valdrelease.yaml:8084-8085
Timestamp: 2024-08-05T14:46:41.089Z
Learning: The `kvs_background_compaction_interval` property in the `valdrelease.yaml` file should use the pattern `^[0-9]+(ns|us|ms|s|m|h|d)$` to validate durations specified in nanoseconds, microseconds, milliseconds, seconds, minutes, hours, and days.
Additional comments not posted (43)
charts/vald/values.schema.json (2)

Line range hint 1-1:
LGTM! The addition of the gateway property is well-structured.

The new gateway property and its sub-properties provide comprehensive configuration options for the gRPC client, enhancing clarity and usability.


Line range hint 2-2:
LGTM! The replacement of kvs_async_write_concurrency with interval-based properties is a positive change.

The new kvs_background_compaction_interval and kvs_background_sync_interval properties provide clearer guidelines for background operations, potentially enhancing data consistency and performance.

internal/db/kvs/pogreb/options.go (3)

24-24: LGTM! The update of deafultOpts to use time.Duration improves type safety.

Replacing the string representation with time.Second * 5 ensures consistency with the new parameter type for the WithBackgroundSyncInterval function.


43-49: LGTM! The modification of WithBackgroundSyncInterval to accept time.Duration enhances type safety.

By accepting time.Duration directly, the function becomes more intuitive and less error-prone, eliminating the need for string parsing.


55-61: LGTM! The modification of WithBackgroundCompactionInterval to accept time.Duration enhances type safety.

By accepting time.Duration directly, the function becomes more intuitive and less error-prone, eliminating the need for string parsing.

internal/servers/servers.go (1)

53-54: LGTM! The replacement of the sort package with the slices package enhances code readability and efficiency.

Utilizing built-in functions from the slices package simplifies the logic and reduces boilerplate code.

charts/vald/templates/index/job/correction/configmap.yaml (4)

Line range hint 1-93:
LGTM! The overall structure and consistency are maintained.

The configuration file has significant modifications and enhancements, and the overall structure and consistency are maintained.


Line range hint 90-90:
LGTM! Verify the inclusion of agent client options.

The agent client options are correctly included in the discoverer section.

Ensure the agent client options are properly utilized across the system.

Verification successful

LGTM!

The agent client options are correctly included and utilized in the discoverer section.

  • charts/vald/templates/index/job/correction/configmap.yaml:
    • {{- include "vald.grpc.client" (dict "Values" $corrector.discoverer.agent_client_options "default" .Values.defaults.grpc.client) | nindent 10 }}
Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the inclusion of agent client options.

# Test: Search for the usage of agent client options. Expect: Occurrences of the agent client options.
rg --type yaml 'agent_client_options'

Length of output: 5738


57-75: LGTM! Verify the dynamic address construction.

The enhanced gateway configuration with dynamic address construction is correctly implemented.

Ensure the dynamic address construction is properly utilized across the system.

Verification successful

LGTM! Verify the dynamic address construction.

The enhanced gateway configuration with dynamic address construction is correctly implemented.

  • The dynamic address construction is consistently utilized across the system, as evidenced by the multiple occurrences of similar patterns in the search results.
Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the dynamic address construction.

# Test: Search for the usage of dynamic address construction. Expect: Occurrences of the dynamic address construction.
rg --type yaml 'printf|dict'

Length of output: 29200


Line range hint 79-89:
LGTM! Verify the client reference update.

The client reference in the discoverer section is correctly updated from $index to $corrector.

Ensure the updated client reference is properly utilized across the system.

Verification successful

Let's expand the search to include other file types and adjust the search pattern to ensure we capture all possible usages of $corrector.


Verification successful!

The client reference in the discoverer section has been correctly updated from $index to $corrector and is consistently utilized across the system.

  • Files and lines confirmed:
    • charts/vald/templates/index/job/correction/configmap.yaml
    • charts/vald/templates/index/job/correction/cronjob.yaml
    • charts/vald/templates/index/job/correction/networkpolicy.yaml
    • charts/vald/templates/index/operator/configmap.yaml
    • Other related files as listed in the search results.
Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the client reference update.

# Test: Search for the usage of the updated client reference. Expect: Occurrences of the updated client reference.
rg --type yaml '$corrector'

Length of output: 29


Script:

#!/bin/bash
# Description: Verify the client reference update.

# Test: Search for the usage of the updated client reference in all file types.
rg '\$corrector'

Length of output: 4952

Makefile.d/docker.mk (1)

Line range hint 1-221:
LGTM! The overall structure and consistency are maintained.

The Makefile has significant reorganization and expansion of Docker build targets, and the overall structure and consistency are maintained.

k8s/index/job/creation/configmap.yaml (7)

18-26: LGTM!

The metadata section is correctly formatted and includes necessary labels.


36-62: Verify the connection_timeout field for gRPC.

The connection_timeout field is currently an empty string. Ensure this is intentional and will not cause issues.


79-129: LGTM!

The health_check_servers section is comprehensive and correctly configured.


130-155: LGTM!

The metrics_servers section is comprehensive and correctly configured.


167-172: LGTM!

The TLS section is comprehensive and correctly configured.


173-204: LGTM!

The observability section is comprehensive and correctly configured.


205-292: LGTM!

The creator section is comprehensive and correctly configured.

Makefile.d/k8s.mk (3)

40-43: LGTM!

The new Helm template options for manager index functionalities are correctly added.


543-563: LGTM!

The changes to telepresence commands improve flexibility and maintainability by using the $(REPO) variable.


40-43: LGTM!

The Helm template commands for deploying the Vald sample cluster are comprehensive and correctly configured.

pkg/index/job/correction/service/corrector.go (5)

683-684: LGTM!

The NumberOfCheckedIndex method looks good and is correctly implemented.


687-688: LGTM!

The NumberOfCorrectedOldIndex method looks good and is correctly implemented.


691-692: LGTM!

The NumberOfCorrectedReplication method looks good and is correctly implemented.


55-67: Ensure proper initialization of new fields.

The correct struct has new fields: checkedList, backgroundSyncInterval, and backgroundCompactionInterval. Ensure these fields are properly initialized and used throughout the code.

Verification successful

Initialization and usage of new fields are verified.

The fields checkedList, backgroundSyncInterval, and backgroundCompactionInterval are properly initialized and used throughout the codebase.

  • checkedList is set and used in pkg/index/job/correction/service/corrector.go.
  • backgroundSyncInterval and backgroundCompactionInterval are set in pkg/index/job/correction/service/options.go and used in pkg/index/job/correction/service/corrector.go.
Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the initialization and usage of new fields in the `correct` struct.

# Test: Search for the initialization and usage of `checkedList`, `backgroundSyncInterval`, and `backgroundCompactionInterval`. Expect: Proper initialization and usage.
rg --type go 'checkedList|backgroundSyncInterval|backgroundCompactionInterval'

Length of output: 8355


102-130: Ensure proper error handling for client start failures.

The StartClient method initializes the gateway and discoverer clients. Ensure that errors from these initializations are handled properly to avoid partial failures.

Verification successful

Proper error handling for client start failures is implemented correctly.

The StartClient method ensures that errors from gateway and discoverer client initializations are handled properly by returning immediately with the error if either initialization fails.

  • pkg/index/job/correction/service/corrector.go: Lines 105-107, 109-111
Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the error handling for client start failures in the `StartClient` method.

# Test: Search for error handling related to `gateway` and `discoverer` client initialization. Expect: Proper error handling.
rg --type go 'c.gateway.Start|c.discoverer.Start'

Length of output: 214


Script:

#!/bin/bash
# Extract the complete `StartClient` method to verify error handling comprehensively.
ast-grep --lang go --pattern $'func (c *correct) StartClient(ctx context.Context) ($_ <-chan error, err error) {
  $$$
}' 

Length of output: 2193

go.mod (8)

310-310: Verify compatibility for golang.org/x/time v0.6.0.

Ensure that the new version does not introduce breaking changes and is compatible with the existing codebase.


303-303: Verify compatibility for golang.org/x/mod v0.20.0.

Ensure that the new version does not introduce breaking changes and is compatible with the existing codebase.


307-307: Verify compatibility for golang.org/x/sys v0.23.0.

Ensure that the new version does not introduce breaking changes and is compatible with the existing codebase.


14-14: Verify compatibility for cloud.google.com/go/pubsub v1.41.0.

Ensure that the new version does not introduce breaking changes and is compatible with the existing codebase.

Verification successful

No direct usage of the cloud.google.com/go/pubsub package found.

The search results did not indicate any import statements or direct usage of the cloud.google.com/go/pubsub package within the codebase. Therefore, the version update to v1.41.0 should not introduce any breaking changes or compatibility issues.

Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify compatibility for `cloud.google.com/go/pubsub` v1.41.0.

# Test: Search for the usage of `pubsub` package. Expect: No breaking changes.
rg --type go 'pubsub' -A 5

Length of output: 2706


Script:

#!/bin/bash
# Description: Verify compatibility for `cloud.google.com/go/pubsub` v1.41.0.

# Test: Search for import statements of `cloud.google.com/go/pubsub` package.
rg --type go 'import "cloud.google.com/go/pubsub"' -A 5

# Test: Search for usage of `pubsub` package from `cloud.google.com/go/pubsub`.
rg --type go 'pubsub\.' -A 5

Length of output: 2768


53-53: Verify compatibility for github.com/aws/aws-sdk-go-v2/feature/s3/manager v1.17.10.

Ensure that the new version does not introduce breaking changes and is compatible with the existing codebase.

Verification successful

No issues found with the update to github.com/aws/aws-sdk-go-v2/feature/s3/manager v1.17.10.

  • The package s3/manager is not directly used in the codebase.
  • The go.mod file shows compatible updates for related dependencies.
Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify compatibility for `github.com/aws/aws-sdk-go-v2/feature/s3/manager` v1.17.10.

# Test: Search for the usage of `s3/manager` package. Expect: No breaking changes.
rg --type go 's3/manager' -A 5

Length of output: 30


Script:

#!/bin/bash
# Description: Verify compatibility for `github.com/aws/aws-sdk-go-v2/feature/s3/manager` v1.17.10.

# Test 1: Search for the usage of `s3/manager` package in Go files. Expect: No breaking changes.
rg 'github.com/aws/aws-sdk-go-v2/feature/s3/manager' --type go -A 5

# Test 2: Inspect the `go.mod` file for any other related dependencies or directives.
rg 'github.com/aws/aws-sdk-go-v2/feature/s3/manager' go.mod -A 5

Length of output: 824


306-306: Verify compatibility for golang.org/x/sync v0.8.0.

Ensure that the new version does not introduce breaking changes and is compatible with the existing codebase.

Verification successful

The update to golang.org/x/sync v0.8.0 is safe.

The diff between versions v0.7.0 and v0.8.0 shows only changes to the LICENSE file, with no modifications to the actual codebase. Therefore, there are no breaking changes or deprecations introduced in this update.

  • No changes to the codebase between v0.7.0 and v0.8.0.
Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify compatibility for `golang.org/x/sync` v0.8.0.

# Test: Search for the usage of `sync` package. Expect: No breaking changes.
rg --type go 'sync' -A 5

Length of output: 269876


Script:

#!/bin/bash
# Fetch the changelog or release notes for `golang.org/x/sync` version v0.8.0 to verify if there are any breaking changes or deprecations.
curl -s https://api.github.com/repos/golang/sync/releases | jq '.[] | select(.tag_name == "v0.8.0") | .body'

Length of output: 110


Script:

#!/bin/bash
# Fetch the diff between versions v0.7.0 and v0.8.0 for golang.org/x/sync to identify any breaking changes or deprecations.
curl -s https://api.github.com/repos/golang/sync/compare/v0.7.0...v0.8.0 | jq '.files[] | {filename, status, changes, patch}'

Length of output: 947


305-305: Verify compatibility for golang.org/x/oauth2 v0.22.0.

Ensure that the new version does not introduce breaking changes and is compatible with the existing codebase.


18-18: Verify compatibility for code.cloudfoundry.org/bytefmt v0.0.0-20240804182054-0a63f33a903d.

Ensure that the new commit does not introduce breaking changes and is compatible with the existing codebase.

charts/vald-helm-operator/crds/valdrelease.yaml (9)

7891-7897: Add validation constraints for addrs.

Ensure that the addrs array contains valid URLs or IP addresses.

addrs:
  type: array
  items:
    type: string
    format: uri

7898-7914: Add default values for backoff properties.

Consider adding default values for backoff properties to ensure consistent behavior.

backoff:
  type: object
  properties:
    backoff_factor:
      type: number
      default: 2.0
    backoff_time_limit:
      type: string
      default: "10s"
    enable_error_log:
      type: boolean
      default: true
    initial_duration:
      type: string
      default: "1s"
    jitter_limit:
      type: string
      default: "1s"
    maximum_duration:
      type: string
      default: "30s"
    retry_count:
      type: integer
      default: 5

7918-7930: Add default values for circuit_breaker properties.

Consider adding default values for circuit_breaker properties to ensure consistent behavior.

circuit_breaker:
  type: object
  properties:
    closed_error_rate:
      type: number
      default: 0.1
    closed_refresh_timeout:
      type: string
      default: "10s"
    half_open_error_rate:
      type: number
      default: 0.5
    min_samples:
      type: integer
      default: 10
    open_timeout:
      type: string
      default: "30s"

7931-7943: Add default values for connection_pool properties.

Consider adding default values for connection_pool properties to ensure consistent behavior.

connection_pool:
  type: object
  properties:
    enable_dns_resolver:
      type: boolean
      default: true
    enable_rebalance:
      type: boolean
      default: true
    old_conn_close_duration:
      type: string
      default: "1m"
    rebalance_duration:
      type: string
      default: "5m"
    size:
      type: integer
      default: 10

7944-7967: Add default values for dial_option properties.

Consider adding default values for dial_option properties to ensure consistent behavior.

dial_option:
  type: object
  properties:
    backoff_base_delay:
      type: string
      default: "1s"
    backoff_jitter:
      type: number
      default: 0.2
    backoff_max_delay:
      type: string
      default: "10s"
    backoff_multiplier:
      type: number
      default: 1.5
    enable_backoff:
      type: boolean
      default: true
    initial_connection_window_size:
      type: integer
      default: 65536
    initial_window_size:
      type: integer
      default: 65536
    insecure:
      type: boolean
      default: false
    interceptors:
      type: array
      items:
        type: string
        enum:
          - TraceInterceptor
    keepalive:
      type: object
      properties:
        permit_without_stream:
          type: boolean
          default: true
        time:
          type: string
          default: "30s"
        timeout:
          type: string
          default: "20s"
    max_msg_size:
      type: integer
      default: 4194304
    min_connection_timeout:
      type: string
      default: "20s"
    net:
      type: object
      properties:
        dialer:
          type: object
          properties:
            dual_stack_enabled:
              type: boolean
              default: true
            keepalive:
              type: string
              default: "30s"
            timeout:
              type: string
              default: "30s"
        dns:
          type: object
          properties:
            cache_enabled:
              type: boolean
              default: true
            cache_expiration:
              type: string
              default: "5m"
            refresh_duration:
              type: string
              default: "10m"
        socket_option:
          type: object
          properties:
            ip_recover_destination_addr:
              type: boolean
              default: true
            ip_transparent:
              type: boolean
              default: false
            reuse_addr:
              type: boolean
              default: true
            reuse_port:
              type: boolean
              default: true
            tcp_cork:
              type: boolean
              default: false
            tcp_defer_accept:
              type: boolean
              default: true
            tcp_fast_open:
              type: boolean
              default: true
            tcp_no_delay:
              type: boolean
              default: true
            tcp_quick_ack:
              type: boolean
              default: true
    read_buffer_size:
      type: integer
      default: 4096
    timeout:
      type: string
      default: "30s"
    write_buffer_size:
      type: integer
      default: 4096

8045-8050: Add default values for message size properties.

Consider adding default values for max_recv_msg_size, max_retry_rpc_buffer_size, and max_send_msg_size to ensure consistent behavior.

max_recv_msg_size:
  type: integer
  default: 4194304
max_retry_rpc_buffer_size:
  type: integer
  default: 8388608
max_send_msg_size:
  type: integer
  default: 4194304

8051-8065: Add default values for tls properties.

Consider adding default values for tls properties to ensure consistent behavior.

tls:
  type: object
  properties:
    ca:
      type: string
      default: "/path/to/ca.crt"
    cert:
      type: string
      default: "/path/to/cert.crt"
    enabled:
      type: boolean
      default: true
    insecure_skip_verify:
      type: boolean
      default: false
    key:
      type: string
      default: "/path/to/key.key"

8084-8085: Add validation constraints for kvs_background_compaction_interval.

Ensure the kvs_background_compaction_interval property has a valid duration format.

kvs_background_compaction_interval:
  type: string
  pattern: ^[0-9]+(ns|us|ms|s|m|h|d)$

8086-8087: Add validation constraints for kvs_background_sync_interval.

Ensure the kvs_background_sync_interval property has a valid duration format.

kvs_background_sync_interval:
  type: string
  pattern: ^[0-9]+(ns|us|ms|s|m|h|d)$

internal/db/kvs/pogreb/options_test.go Show resolved Hide resolved
internal/db/kvs/pogreb/options_test.go Show resolved Hide resolved
pkg/index/job/correction/service/corrector.go Outdated Show resolved Hide resolved
pkg/index/job/correction/service/corrector.go Outdated Show resolved Hide resolved
@kpango kpango force-pushed the bugfix/index-correction/refactor-and-bugfix-index-correction branch from 31556bd to 9f8bc40 Compare August 5, 2024 21:21
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 13

Outside diff range, codebase verification and nitpick comments (3)
Makefile.d/docker.mk (1)

23-27: Ensure consistency in Docker build targets.

The Dockerfiles for the following build targets are missing required instructions (FROM, RUN, COPY, CMD/ENTRYPOINT):

  • dockers/binfmt/Dockerfile
  • dockers/buildbase/Dockerfile
  • dockers/buildkit/Dockerfile

Please review and update these Dockerfiles to include the necessary instructions.

Analysis chain

Ensure consistency in Docker build targets.

The new build targets docker/build/benchmark-job, docker/build/benchmark-operator, docker/build/binfmt, docker/build/buildbase, and docker/build/buildkit are correctly added. Verify that the corresponding Dockerfiles exist and are correctly configured.

Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify that the Dockerfiles for the new build targets exist and are correctly configured.

# Test: Search for the Dockerfiles. Expect: Dockerfiles should exist at the specified paths.
DOCKERFILES=(
  "dockers/tools/benchmark/job/Dockerfile"
  "dockers/tools/benchmark/operator/Dockerfile"
  "dockers/binfmt/Dockerfile"
  "dockers/buildbase/Dockerfile"
  "dockers/buildkit/Dockerfile"
)

for file in "${DOCKERFILES[@]}"; do
  if [ ! -f "$file" ]; then
    echo "Dockerfile not found: $file"
  else
    echo "Dockerfile exists: $file"
  fi
done

Length of output: 1179


Script:

#!/bin/bash
# Description: Verify that the Dockerfiles for the new build targets are correctly configured.

# Test: Check for basic Dockerfile instructions. Expect: Each Dockerfile should contain FROM, RUN, COPY, and CMD/ENTRYPOINT instructions.
DOCKERFILES=(
  "dockers/tools/benchmark/job/Dockerfile"
  "dockers/tools/benchmark/operator/Dockerfile"
  "dockers/binfmt/Dockerfile"
  "dockers/buildbase/Dockerfile"
  "dockers/buildkit/Dockerfile"
)

for file in "${DOCKERFILES[@]}"; do
  echo "Checking Dockerfile: $file"
  if grep -q -E '^\s*FROM\s+' "$file" && \
     grep -q -E '^\s*RUN\s+' "$file" && \
     grep -q -E '^\s*COPY\s+' "$file" && \
     grep -q -E '^\s*(CMD|ENTRYPOINT)\s+' "$file"; then
    echo "Dockerfile is correctly configured: $file"
  else
    echo "Dockerfile is missing required instructions: $file"
  fi
done

Length of output: 2634

pkg/index/job/correction/service/options_test.go (2)

Line range hint 528-605:
Implement the TestWithKVSCompactionInterval function.

The function is not implemented and contains TODO comments for test cases.

Do you want me to implement the test cases for this function or open a GitHub issue to track this task?


Line range hint 102-172:
Implement the TestWithIndexReplica function.

The function is not implemented and contains TODO comments for test cases.

Do you want me to implement the test cases for this function or open a GitHub issue to track this task?

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 31556bd and 9f8bc40.

Files ignored due to path filters (2)
  • go.sum is excluded by !**/*.sum
  • rust/Cargo.lock is excluded by !**/*.lock
Files selected for processing (53)
  • .gitfiles (3 hunks)
  • .github/helm/values/values-correction.yaml (1 hunks)
  • .github/workflows/dockers-binfmt-image.yaml (1 hunks)
  • .github/workflows/dockers-buildkit-image.yaml (1 hunks)
  • Makefile (2 hunks)
  • Makefile.d/dependencies.mk (1 hunks)
  • Makefile.d/docker.mk (2 hunks)
  • Makefile.d/e2e.mk (1 hunks)
  • Makefile.d/functions.mk (1 hunks)
  • Makefile.d/k8s.mk (2 hunks)
  • Makefile.d/proto.mk (2 hunks)
  • Makefile.d/test.mk (1 hunks)
  • charts/vald-helm-operator/crds/valdrelease.yaml (2 hunks)
  • charts/vald/README.md (1 hunks)
  • charts/vald/templates/gateway/lb/networkpolicy.yaml (2 hunks)
  • charts/vald/templates/index/job/correction/configmap.yaml (1 hunks)
  • charts/vald/templates/index/job/correction/networkpolicy.yaml (2 hunks)
  • charts/vald/values.schema.json (2 hunks)
  • charts/vald/values.yaml (1 hunks)
  • dockers/binfmt/Dockerfile (1 hunks)
  • dockers/buildkit/Dockerfile (1 hunks)
  • example/client/go.mod (1 hunks)
  • go.mod (8 hunks)
  • internal/config/corrector.go (2 hunks)
  • internal/config/corrector_test.go (4 hunks)
  • internal/db/kvs/pogreb/options.go (2 hunks)
  • internal/db/kvs/pogreb/options_test.go (2 hunks)
  • internal/db/kvs/pogreb/pogreb.go (2 hunks)
  • internal/db/kvs/pogreb/pogreb_test.go (16 hunks)
  • internal/errors/corrector.go (1 hunks)
  • internal/servers/servers.go (2 hunks)
  • k8s/index/job/correction/configmap.yaml (1 hunks)
  • k8s/index/job/correction/cronjob.yaml (1 hunks)
  • k8s/index/job/creation/configmap.yaml (1 hunks)
  • k8s/index/job/creation/cronjob.yaml (1 hunks)
  • k8s/index/job/save/configmap.yaml (1 hunks)
  • k8s/index/job/save/cronjob.yaml (1 hunks)
  • k8s/index/operator/configmap.yaml (1 hunks)
  • k8s/index/operator/deployment.yaml (1 hunks)
  • k8s/index/operator/priorityclass.yaml (1 hunks)
  • k8s/operator/helm/crds/valdrelease.yaml (2 hunks)
  • pkg/agent/core/ngt/service/ngt_test.go (3 hunks)
  • pkg/gateway/lb/handler/grpc/handler_test.go (3 hunks)
  • pkg/index/job/correction/service/corrector.go (3 hunks)
  • pkg/index/job/correction/service/corrector_test.go (26 hunks)
  • pkg/index/job/correction/service/options.go (3 hunks)
  • pkg/index/job/correction/service/options_test.go (6 hunks)
  • pkg/index/job/correction/usecase/corrector.go (5 hunks)
  • tests/e2e/crud/crud_test.go (1 hunks)
  • versions/CMAKE_VERSION (1 hunks)
  • versions/PROMETHEUS_STACK_VERSION (1 hunks)
  • versions/YQ_VERSION (1 hunks)
  • versions/actions/ACTIONS_UPLOAD_ARTIFACT (1 hunks)
Files skipped from review due to trivial changes (7)
  • .gitfiles
  • dockers/binfmt/Dockerfile
  • dockers/buildkit/Dockerfile
  • internal/errors/corrector.go
  • k8s/index/job/creation/cronjob.yaml
  • versions/CMAKE_VERSION
  • versions/actions/ACTIONS_UPLOAD_ARTIFACT
Files skipped from review as they are similar to previous changes (32)
  • .github/helm/values/values-correction.yaml
  • .github/workflows/dockers-binfmt-image.yaml
  • .github/workflows/dockers-buildkit-image.yaml
  • Makefile
  • Makefile.d/dependencies.mk
  • Makefile.d/e2e.mk
  • Makefile.d/functions.mk
  • Makefile.d/proto.mk
  • Makefile.d/test.mk
  • charts/vald/templates/gateway/lb/networkpolicy.yaml
  • charts/vald/templates/index/job/correction/networkpolicy.yaml
  • charts/vald/values.yaml
  • example/client/go.mod
  • go.mod
  • internal/config/corrector_test.go
  • internal/db/kvs/pogreb/options.go
  • internal/db/kvs/pogreb/options_test.go
  • internal/db/kvs/pogreb/pogreb.go
  • internal/db/kvs/pogreb/pogreb_test.go
  • internal/servers/servers.go
  • k8s/index/job/correction/configmap.yaml
  • k8s/index/job/correction/cronjob.yaml
  • k8s/index/job/save/configmap.yaml
  • k8s/index/job/save/cronjob.yaml
  • k8s/index/operator/configmap.yaml
  • k8s/index/operator/deployment.yaml
  • k8s/operator/helm/crds/valdrelease.yaml
  • pkg/agent/core/ngt/service/ngt_test.go
  • pkg/gateway/lb/handler/grpc/handler_test.go
  • pkg/index/job/correction/usecase/corrector.go
  • versions/PROMETHEUS_STACK_VERSION
  • versions/YQ_VERSION
Additional context used
Learnings (1)
charts/vald-helm-operator/crds/valdrelease.yaml (1)
Learnt from: kpango
PR: vdaas/vald#2564
File: charts/vald-helm-operator/crds/valdrelease.yaml:8084-8085
Timestamp: 2024-08-05T14:46:41.089Z
Learning: The `kvs_background_compaction_interval` property in the `valdrelease.yaml` file should use the pattern `^[0-9]+(ns|us|ms|s|m|h|d)$` to validate durations specified in nanoseconds, microseconds, milliseconds, seconds, minutes, hours, and days.
Additional comments not posted (37)
k8s/index/operator/priorityclass.yaml (1)

16-30: LGTM! Ensure alignment with the cluster's scheduling strategy.

The new PriorityClass manifest is well-structured and follows Kubernetes best practices. Ensure that the priority class name and value align with the overall scheduling strategy of the cluster.

pkg/index/job/correction/service/options.go (4)

33-40: LGTM! Ensure proper error handling.

The WithErrGroup function correctly sets the error group. Ensure that the error group is properly utilized in the codebase.


65-74: LGTM! Ensure proper error handling.

The WithGateway function correctly sets the gateway client and handles nil values. Ensure that the gateway client is properly utilized in the codebase.


87-100: LGTM! Ensure valid duration strings.

The WithKVSSyncInterval function correctly parses and sets the synchronization interval. Ensure that valid duration strings are provided in the configuration.


102-112: LGTM! Ensure valid duration strings.

The WithKVSCompactionInterval function correctly parses and sets the compaction interval. Ensure that valid duration strings are provided in the configuration.

charts/vald/templates/index/job/correction/configmap.yaml (2)

54-55: LGTM! Ensure valid interval values.

The new configuration settings for kvs_background_sync_interval and kvs_background_compaction_interval are correctly added. Ensure that valid interval values are provided in the configuration.


57-75: LGTM! Ensure the conditional logic is correct.

The conditional logic for the gateway configuration is correctly implemented. Ensure that the gateway and agent configurations are correctly set based on the deployment context.

Makefile.d/docker.mk (4)

200-214: New Docker name targets added.

The new Docker name targets docker/name/buildkit and docker/name/binfmt are correctly added and follow the same pattern as existing targets.


Line range hint 443-501:
New Docker name targets added.

The new Docker name targets docker/name/benchmark-job and docker/name/benchmark-operator are correctly added and follow the same pattern as existing targets.


204-220: New Docker build targets added.

The new Docker build targets docker/build/buildkit and docker/build/binfmt are correctly added and follow the same pattern as existing targets. Verify that the corresponding Dockerfiles exist and are correctly configured.

Verification successful

New Docker build targets added.

The new Docker build targets docker/build/buildkit and docker/build/binfmt are correctly added and follow the same pattern as existing targets. The corresponding Dockerfiles exist and are correctly configured.

  • dockers/buildkit/Dockerfile uses FROM moby/buildkit:master AS builder.
  • dockers/binfmt/Dockerfile uses FROM tonistiigi/binfmt:master AS builder.
Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify that the Dockerfiles for the new build targets exist and are correctly configured.

# Test: Search for the Dockerfiles. Expect: Dockerfiles should exist at the specified paths.
DOCKERFILES=(
  "dockers/buildkit/Dockerfile"
  "dockers/binfmt/Dockerfile"
)

for file in "${DOCKERFILES[@]}"; do
  if [ ! -f "$file" ]; then
    echo "Dockerfile not found: $file"
  else
    echo "Dockerfile exists: $file"
  fi
done

Length of output: 431


Script:

#!/bin/bash
# Description: Inspect the contents of the Dockerfiles for the new build targets to ensure they are correctly configured.

# Paths to the Dockerfiles
DOCKERFILES=(
  "dockers/buildkit/Dockerfile"
  "dockers/binfmt/Dockerfile"
)

# Display the contents of each Dockerfile
for file in "${DOCKERFILES[@]}"; do
  echo "Contents of $file:"
  cat "$file"
  echo
done

Length of output: 1779


19-41: Ensure consistency in Docker build image function.

The modifications to the Docker build image function correctly include the new targets. Verify that the new targets are correctly integrated and follow the same pattern as existing targets.

Verification successful

The new Docker build targets are correctly integrated and follow the same pattern as the existing targets.

  • The new targets have corresponding .PHONY declarations.
  • Each target has an echo statement for the image name.
  • The build commands for the new targets are consistent with the existing ones.
Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify that the new Docker build targets are correctly integrated and follow the same pattern as existing targets.

# Test: Search for the Docker build targets. Expect: The new targets should be included in the Docker build image function.
TARGETS=(
  "docker/build/benchmark-job"
  "docker/build/benchmark-operator"
  "docker/build/binfmt"
  "docker/build/buildbase"
  "docker/build/buildkit"
)

for target in "${TARGETS[@]}"; do
  if ! grep -q "$target" Makefile.d/docker.mk; then
    echo "Target not found: $target"
  else
    echo "Target exists: $target"
  fi
done

Length of output: 1027


Script:

#!/bin/bash
# Description: Extract and compare the definitions and usage patterns of both new and existing Docker build targets in the Makefile.

# Define the new and a few existing Docker build targets for comparison.
NEW_TARGETS=(
  "docker/build/benchmark-job"
  "docker/build/benchmark-operator"
  "docker/build/binfmt"
  "docker/build/buildbase"
  "docker/build/buildkit"
)

EXISTING_TARGETS=(
  "docker/build/agent"
  "docker/build/agent-faiss"
  "docker/build/agent-ngt"
  "docker/build/agent-sidecar"
)

# Extract the lines where these targets are defined or used in the Makefile.
for target in "${NEW_TARGETS[@]}" "${EXISTING_TARGETS[@]}"; do
  echo "Checking target: $target"
  grep -A 5 -B 5 "$target" Makefile.d/docker.mk
done

Length of output: 8801

k8s/index/job/creation/configmap.yaml (5)

36-78: Ensure server configuration is correctly defined.

The server configuration section is correctly defined with detailed parameters for each server instance. Verify that the parameters are consistent with the expected configuration.

Verification successful

Ensure server configuration is correctly defined.

The server configuration parameters appear in multiple files (configmap.yaml and cronjob.yaml). Verify that the parameters are consistently defined and correctly used across these files.


Ensure server configuration is correctly defined.

The server configuration parameters in configmap.yaml and cronjob.yaml are consistent and correctly defined. The detailed parameters in configmap.yaml align with the expected configuration, and the simpler configuration in cronjob.yaml appears appropriate for its context.

  • configmap.yaml contains comprehensive server configurations.
  • cronjob.yaml includes necessary port configurations for grpc.
Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify that the server configuration parameters are consistent with the expected configuration.

# Test: Search for the server configuration parameters in the project. Expect: The parameters should be consistent.
grep -r "grpc" k8s/index/job/creation/
grep -r "health_check_servers" k8s/index/job/creation/

Length of output: 443


Script:

#!/bin/bash
# Description: Verify the consistency of server configuration parameters across identified files.

# Display the relevant sections in configmap.yaml and cronjob.yaml
grep -A 20 "grpc" k8s/index/job/creation/configmap.yaml
grep -A 20 "grpc" k8s/index/job/creation/cronjob.yaml
grep -A 20 "health_check_servers" k8s/index/job/creation/configmap.yaml

Length of output: 2891


18-26: Ensure metadata is correctly configured.

The metadata section is correctly configured with appropriate labels and version information. Verify that the version and labels are consistent with the rest of the project.


79-155: Ensure health check and metrics servers are correctly defined.

The health check and metrics servers are correctly defined with detailed parameters. Verify that the parameters are consistent with the expected configuration.


156-165: Ensure startup and shutdown strategies are correctly defined.

The startup and shutdown strategies are correctly defined for controlled service management. Verify that the strategies are consistent with the expected configuration.

Verification successful

Ensure startup and shutdown strategies are correctly defined.

The startup and shutdown strategies are consistently used across multiple configuration files in the project. The configurations in the provided snippet are consistent with the expected patterns observed in other files.

  • k8s/index/job/creation/configmap.yaml
  • k8s/agent/ngt/configmap.yaml
  • k8s/discoverer/configmap.yaml
  • k8s/gateway/gateway/lb/configmap.yaml

These configurations follow the expected structure and order for controlled service management.

Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify that the startup and shutdown strategies are consistent with the expected configuration.

# Test: Search for the startup and shutdown strategies in the project. Expect: The strategies should be consistent.
grep -r "startup_strategy" k8s/index/job/creation/
grep -r "shutdown_strategy" k8s/index/job/creation/

Length of output: 227


Script:

#!/bin/bash
# Description: Verify the usage of startup and shutdown strategies throughout the project.

# Search for the usage of startup_strategy in the entire project
grep -r "startup_strategy" .

# Search for the usage of shutdown_strategy in the entire project
grep -r "shutdown_strategy" .

Length of output: 50666


173-292: Ensure observability settings are correctly defined.

The observability settings are correctly defined with options for tracing and metrics collection. Verify that the settings are consistent with the expected configuration.

Verification successful

Observability settings are correctly defined.

The observability settings in k8s/index/job/creation/configmap.yaml are comprehensive and correctly formatted, covering all necessary aspects such as tracing, metrics collection, and relevant attributes.

  • The otlp section includes configurations for collector endpoint, trace batch timeout, export timeout, max export batch size, and max queue size.
  • The metrics section includes configurations for enabling various metrics and version info labels.
  • The trace section includes an enabled flag.

These settings are consistent with the expected configuration.

Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify that the observability settings are consistent with the expected configuration.

# Test: Search for the observability settings in the project. Expect: The settings should be consistent.
grep -r "observability" k8s/index/job/creation/
grep -r "metrics" k8s/index/job/creation/
grep -r "trace" k8s/index/job/creation/

Length of output: 799


Script:

#!/bin/bash
# Extract and display the observability settings from the configmap.yaml file for detailed review.
awk '/observability:/, /creator:/' k8s/index/job/creation/configmap.yaml

Length of output: 936

pkg/index/job/correction/service/options_test.go (1)

Line range hint 443-501:
Ensure consistency in renaming and internal logic updates.

The function TestWithKvsAsyncWriteConcurrency has been renamed to TestWithKVSSyncInterval. Ensure that the renaming is consistent and the internal logic is correctly updated to reflect the new functionality.

Makefile.d/k8s.mk (2)

40-43: LGTM! Verify compatibility with Helm charts.

The new Helm template options to enable specific features of the manager index are correctly integrated.

Ensure these options are compatible with the Helm charts and properly tested.


543-563: LGTM! Verify correctness of variable usage.

The changes to use the variable $(REPO) for repository paths in telepresence commands improve flexibility and maintainability.

Ensure the variable $(REPO) is correctly defined and used.

tests/e2e/crud/crud_test.go (1)

80-80: LGTM! Verify impact on performance.

The change to the default value for the correctionInsertNum flag from 3000 to 10000 is correctly implemented.

Ensure this change does not introduce performance issues during tests.

pkg/index/job/correction/service/corrector.go (5)

102-130: LGTM! But add test coverage for the StartClient function.

The initialization of the gateway and discoverer clients is not covered by tests.

Do you want me to implement the test cases for this function or open a GitHub issue to track this task?


685-686: LGTM!

The NumberOfCheckedIndex function is straightforward and does not require any changes.


689-690: LGTM!

The NumberOfCorrectedOldIndex function is straightforward and does not require any changes.


693-694: LGTM!

The NumberOfCorrectedReplication function is straightforward and does not require any changes.


680-682: Ensure proper cleanup and error handling.

The PreStop method closes the checkedList database. Ensure that any errors during the close operation are handled properly.

-  return c.checkedList.Close(true)
+  if err := c.checkedList.Close(true); err != nil {
+    log.Errorf("failed to close checkedList: %v", err)
+    return err
+  }
+  return nil

Likely invalid or redundant comment.

pkg/index/job/correction/service/corrector_test.go (2)

155-165: Reminder: Implement test cases for correct.StartClient.

The test cases for the correct.StartClient method are currently commented out and not implemented. Ensure that these test cases are added to verify the functionality.

Do you want me to help implement these test cases or open a GitHub issue to track this task?


293-303: Reminder: Implement test cases for correct.Start.

The test cases for the correct.Start method are currently commented out and not implemented. Ensure that these test cases are added to verify the functionality.

Do you want me to help implement these test cases or open a GitHub issue to track this task?

charts/vald-helm-operator/crds/valdrelease.yaml (10)

7891-7897: Add validation constraints for addrs.

Ensure that the addrs array contains valid URLs or IP addresses.

addrs:
  type: array
  items:
    type: string
    format: uri

7898-7914: Add default values for backoff properties.

Consider adding default values for backoff properties to ensure consistent behavior.

backoff:
  type: object
  properties:
    backoff_factor:
      type: number
      default: 2.0
    backoff_time_limit:
      type: string
      default: "10s"
    enable_error_log:
      type: boolean
      default: true
    initial_duration:
      type: string
      default: "1s"
    jitter_limit:
      type: string
      default: "1s"
    maximum_duration:
      type: string
      default: "30s"
    retry_count:
      type: integer
      default: 5

7918-7930: Add default values for circuit_breaker properties.

Consider adding default values for circuit_breaker properties to ensure consistent behavior.

circuit_breaker:
  type: object
  properties:
    closed_error_rate:
      type: number
      default: 0.1
    closed_refresh_timeout:
      type: string
      default: "10s"
    half_open_error_rate:
      type: number
      default: 0.5
    min_samples:
      type: integer
      default: 10
    open_timeout:
      type: string
      default: "30s"

7931-7943: Add default values for connection_pool properties.

Consider adding default values for connection_pool properties to ensure consistent behavior.

connection_pool:
  type: object
  properties:
    enable_dns_resolver:
      type: boolean
      default: true
    enable_rebalance:
      type: boolean
      default: true
    old_conn_close_duration:
      type: string
      default: "1m"
    rebalance_duration:
      type: string
      default: "5m"
    size:
      type: integer
      default: 10

7944-7967: Add default values for dial_option properties.

Consider adding default values for dial_option properties to ensure consistent behavior.

dial_option:
  type: object
  properties:
    backoff_base_delay:
      type: string
      default: "1s"
    backoff_jitter:
      type: number
      default: 0.2
    backoff_max_delay:
      type: string
      default: "10s"
    backoff_multiplier:
      type: number
      default: 1.5
    enable_backoff:
      type: boolean
      default: true
    initial_connection_window_size:
      type: integer
      default: 65536
    initial_window_size:
      type: integer
      default: 65536
    insecure:
      type: boolean
      default: false
    interceptors:
      type: array
      items:
        type: string
        enum:
          - TraceInterceptor
    keepalive:
      type: object
      properties:
        permit_without_stream:
          type: boolean
          default: true
        time:
          type: string
          default: "30s"
        timeout:
          type: string
          default: "20s"
    max_msg_size:
      type: integer
      default: 4194304
    min_connection_timeout:
      type: string
      default: "20s"
    net:
      type: object
      properties:
        dialer:
          type: object
          properties:
            dual_stack_enabled:
              type: boolean
              default: true
            keepalive:
              type: string
              default: "30s"
            timeout:
              type: string
              default: "30s"
        dns:
          type: object
          properties:
            cache_enabled:
              type: boolean
              default: true
            cache_expiration:
              type: string
              default: "5m"
            refresh_duration:
              type: string
              default: "10m"
        socket_option:
          type: object
          properties:
            ip_recover_destination_addr:
              type: boolean
              default: true
            ip_transparent:
              type: boolean
              default: false
            reuse_addr:
              type: boolean
              default: true
            reuse_port:
              type: boolean
              default: true
            tcp_cork:
              type: boolean
              default: false
            tcp_defer_accept:
              type: boolean
              default: true
            tcp_fast_open:
              type: boolean
              default: true
            tcp_no_delay:
              type: boolean
              default: true
            tcp_quick_ack:
              type: boolean
              default: true
    read_buffer_size:
      type: integer
      default: 4096
    timeout:
      type: string
      default: "30s"
    write_buffer_size:
      type: integer
      default: 4096

8045-8050: Add default values for message size properties.

Consider adding default values for max_recv_msg_size, max_retry_rpc_buffer_size, and max_send_msg_size to ensure consistent behavior.

max_recv_msg_size:
  type: integer
  default: 4194304
max_retry_rpc_buffer_size:
  type: integer
  default: 8388608
max_send_msg_size:
  type: integer
  default: 4194304

8051-8065: Add default values for tls properties.

Consider adding default values for tls properties to ensure consistent behavior.

tls:
  type: object
  properties:
    ca:
      type: string
      default: "/path/to/ca.crt"
    cert:
      type: string
      default: "/path/to/cert.crt"
    enabled:
      type: boolean
      default: true
    insecure_skip_verify:
      type: boolean
      default: false
    key:
      type: string
      default: "/path/to/key.key"

8084-8085: Add validation constraints for kvs_background_compaction_interval.

Ensure the kvs_background_compaction_interval property has a valid duration format.

kvs_background_compaction_interval:
  type: string
  pattern: ^[0-9]+(ns|us|ms|s|m|h|d)$

8086-8087: Add validation constraints for kvs_background_sync_interval.

Ensure the kvs_background_sync_interval property has a valid duration format.

kvs_background_sync_interval:
  type: string
  pattern: ^[0-9]+(ns|us|ms|s|m|h|d)$

8084-8087: Add validation constraints for kvs_background_compaction_interval and kvs_background_sync_interval.

Ensure the kvs_background_compaction_interval and kvs_background_sync_interval properties have a valid duration format.

kvs_background_compaction_interval:
  type: string
  pattern: ^[0-9]+(ns|us|ms|s|m|h|d)$
kvs_background_sync_interval:
  type: string
  pattern: ^[0-9]+(ns|us|ms|s|m|h|d)$

@kpango
Copy link
Collaborator Author

kpango commented Aug 5, 2024

@coderabbitai full-summary

Copy link
Contributor

coderabbitai bot commented Aug 5, 2024

@kpango: Here's a detailed summary of the changes made in this PR:

Summary

  1. Internal Configuration:

    • Updated internal/config/corrector.go to include new fields KVSBackgroundSyncInterval and KVSBackgroundCompactionInterval.
    • Added a new Gateway configuration.
    • Updated the corresponding test file corrector_test.go to reflect these changes.
  2. Helm Charts:

    • Updated charts/vald-helm-operator/crds/valdrelease.yaml to include new configuration options for the gateway and KVS intervals.
    • Modified charts/vald/templates/index/job/correction/configmap.yaml to integrate the new configuration options.
    • Updated charts/vald/values.schema.json and charts/vald/values.yaml to support the new configuration settings.
  3. Dockerfiles:

    • Minor adjustments in dockers/agent/core/agent/Dockerfile and dockers/dev/Dockerfile to ensure consistency.
  4. Kubernetes Configurations:

    • Added and updated several Kubernetes configuration files for index correction, creation, and save jobs, as well as the index operator.
    • These changes ensure that the new configuration options are properly integrated and utilized.

These changes collectively address the bug fix related to the index correction process and ensure that the new configuration options are properly integrated across the system.

Analysis chain
Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Show diffs for the internal/config directory
git diff origin/main -- internal/config/corrector.go internal/config/corrector_test.go

# Show diffs for the Helm charts
git diff origin/main -- charts/vald-helm-operator/crds/valdrelease.yaml charts/vald/README.md charts/vald/templates/index/job/correction/configmap.yaml charts/vald/values.schema.json charts/vald/values.yaml

# Show diffs for the Dockerfiles
git diff origin/main -- dockers/agent/core/agent/Dockerfile dockers/dev/Dockerfile

# Show diffs for the Kubernetes configurations
git diff origin/main -- k8s/index/job/correction/configmap.yaml k8s/index/job/correction/cronjob.yaml k8s/index/job/creation/configmap.yaml k8s/index/job/creation/cronjob.yaml k8s/index/job/save/configmap.yaml k8s/index/job/save/cronjob.yaml k8s/index/operator/configmap.yaml k8s/index/operator/deployment.yaml k8s/index/operator/priorityclass.yaml k8s/operator/helm/crds/valdrelease.yaml

Length of output: 173560

Actions performed

Comments resolved and changes approved.

coderabbitai[bot]
coderabbitai bot previously approved these changes Aug 5, 2024
@kpango kpango force-pushed the bugfix/index-correction/refactor-and-bugfix-index-correction branch 3 times, most recently from 78e9871 to 53bd7f2 Compare August 5, 2024 23:44
deepsource-autofix bot added a commit that referenced this pull request Aug 5, 2024
This commit fixes the style issues introduced in 53bd7f2 according to the output
from Gofumpt and Prettier.

Details: #2564
@kpango kpango force-pushed the bugfix/index-correction/refactor-and-bugfix-index-correction branch 2 times, most recently from b805b56 to ffd2754 Compare August 5, 2024 23:45
@kpango kpango closed this Aug 5, 2024
@kpango kpango deleted the bugfix/index-correction/refactor-and-bugfix-index-correction branch August 5, 2024 23:48
@kpango kpango restored the bugfix/index-correction/refactor-and-bugfix-index-correction branch August 5, 2024 23:48
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Caution

Inline review comments failed to post

Actionable comments posted: 12

Outside diff range, codebase verification and nitpick comments (7)
pkg/index/job/correction/service/corrector_test.go (7)

Line range hint 1-111:
Implement test cases for the New function.

The test cases for the New function are currently commented out and not implemented. Ensure that these test cases are added to verify the functionality.

Do you want me to help implement these test cases or open a GitHub issue to track this task?


Line range hint 112-253:
Implement test cases for the StartClient function.

The test cases for the StartClient function are currently commented out and not implemented. Ensure that these test cases are added to verify the functionality.

Do you want me to help implement these test cases or open a GitHub issue to track this task?


Line range hint 254-391:
Implement test cases for the Start function.

The test cases for the Start function are currently commented out and not implemented. Ensure that these test cases are added to verify the functionality.

Do you want me to help implement these test cases or open a GitHub issue to track this task?


Line range hint 392-503:
Implement test cases for the PreStop function.

The test cases for the PreStop function are currently commented out and not implemented. Ensure that these test cases are added to verify the functionality.

Do you want me to help implement these test cases or open a GitHub issue to track this task?


Line range hint 504-654:
Implement test cases for the NumberOfCheckedIndex function.

The test cases for the NumberOfCheckedIndex function are currently commented out and not implemented. Ensure that these test cases are added to verify the functionality.

Do you want me to help implement these test cases or open a GitHub issue to track this task?


Line range hint 655-782:
Implement test cases for the NumberOfCorrectedOldIndex function.

The test cases for the NumberOfCorrectedOldIndex function are currently commented out and not implemented. Ensure that these test cases are added to verify the functionality.

Do you want me to help implement these test cases or open a GitHub issue to track this task?


Line range hint 783-899:
Implement test cases for the NumberOfCorrectedReplication function.

The test cases for the NumberOfCorrectedReplication function are currently commented out and not implemented. Ensure that these test cases are added to verify the functionality.

Do you want me to help implement these test cases or open a GitHub issue to track this task?

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 9f8bc40 and 78e9871.

Files ignored due to path filters (2)
  • go.sum is excluded by !**/*.sum
  • rust/Cargo.lock is excluded by !**/*.lock
Files selected for processing (53)
  • .gitfiles (3 hunks)
  • .github/helm/values/values-correction.yaml (1 hunks)
  • .github/workflows/dockers-binfmt-image.yaml (1 hunks)
  • .github/workflows/dockers-buildkit-image.yaml (1 hunks)
  • Makefile (2 hunks)
  • Makefile.d/dependencies.mk (1 hunks)
  • Makefile.d/docker.mk (2 hunks)
  • Makefile.d/e2e.mk (1 hunks)
  • Makefile.d/functions.mk (1 hunks)
  • Makefile.d/k8s.mk (2 hunks)
  • Makefile.d/proto.mk (2 hunks)
  • Makefile.d/test.mk (1 hunks)
  • charts/vald-helm-operator/crds/valdrelease.yaml (2 hunks)
  • charts/vald/README.md (1 hunks)
  • charts/vald/templates/gateway/lb/networkpolicy.yaml (2 hunks)
  • charts/vald/templates/index/job/correction/configmap.yaml (1 hunks)
  • charts/vald/templates/index/job/correction/networkpolicy.yaml (2 hunks)
  • charts/vald/values.schema.json (2 hunks)
  • charts/vald/values.yaml (1 hunks)
  • dockers/binfmt/Dockerfile (1 hunks)
  • dockers/buildkit/Dockerfile (1 hunks)
  • example/client/go.mod (1 hunks)
  • go.mod (8 hunks)
  • internal/config/corrector.go (2 hunks)
  • internal/config/corrector_test.go (4 hunks)
  • internal/db/kvs/pogreb/options.go (2 hunks)
  • internal/db/kvs/pogreb/options_test.go (2 hunks)
  • internal/db/kvs/pogreb/pogreb.go (2 hunks)
  • internal/db/kvs/pogreb/pogreb_test.go (16 hunks)
  • internal/errors/corrector.go (1 hunks)
  • internal/servers/servers.go (2 hunks)
  • k8s/index/job/correction/configmap.yaml (1 hunks)
  • k8s/index/job/correction/cronjob.yaml (1 hunks)
  • k8s/index/job/creation/configmap.yaml (1 hunks)
  • k8s/index/job/creation/cronjob.yaml (1 hunks)
  • k8s/index/job/save/configmap.yaml (1 hunks)
  • k8s/index/job/save/cronjob.yaml (1 hunks)
  • k8s/index/operator/configmap.yaml (1 hunks)
  • k8s/index/operator/deployment.yaml (1 hunks)
  • k8s/index/operator/priorityclass.yaml (1 hunks)
  • k8s/operator/helm/crds/valdrelease.yaml (2 hunks)
  • pkg/agent/core/ngt/service/ngt_test.go (3 hunks)
  • pkg/gateway/lb/handler/grpc/handler_test.go (3 hunks)
  • pkg/index/job/correction/service/corrector.go (3 hunks)
  • pkg/index/job/correction/service/corrector_test.go (26 hunks)
  • pkg/index/job/correction/service/options.go (3 hunks)
  • pkg/index/job/correction/service/options_test.go (6 hunks)
  • pkg/index/job/correction/usecase/corrector.go (5 hunks)
  • tests/e2e/crud/crud_test.go (1 hunks)
  • versions/CMAKE_VERSION (1 hunks)
  • versions/PROMETHEUS_STACK_VERSION (1 hunks)
  • versions/YQ_VERSION (1 hunks)
  • versions/actions/ACTIONS_UPLOAD_ARTIFACT (1 hunks)
Files skipped from review due to trivial changes (6)
  • .github/workflows/dockers-binfmt-image.yaml
  • dockers/binfmt/Dockerfile
  • dockers/buildkit/Dockerfile
  • internal/errors/corrector.go
  • k8s/index/job/save/configmap.yaml
  • versions/CMAKE_VERSION
Files skipped from review as they are similar to previous changes (34)
  • .gitfiles
  • .github/helm/values/values-correction.yaml
  • .github/workflows/dockers-buildkit-image.yaml
  • Makefile
  • Makefile.d/dependencies.mk
  • Makefile.d/docker.mk
  • Makefile.d/e2e.mk
  • Makefile.d/functions.mk
  • Makefile.d/k8s.mk
  • Makefile.d/proto.mk
  • Makefile.d/test.mk
  • charts/vald/templates/gateway/lb/networkpolicy.yaml
  • charts/vald/templates/index/job/correction/configmap.yaml
  • charts/vald/templates/index/job/correction/networkpolicy.yaml
  • charts/vald/values.schema.json
  • example/client/go.mod
  • go.mod
  • internal/db/kvs/pogreb/pogreb.go
  • internal/db/kvs/pogreb/pogreb_test.go
  • internal/servers/servers.go
  • k8s/index/job/correction/configmap.yaml
  • k8s/index/job/creation/cronjob.yaml
  • k8s/index/job/save/cronjob.yaml
  • k8s/index/operator/configmap.yaml
  • k8s/index/operator/deployment.yaml
  • k8s/operator/helm/crds/valdrelease.yaml
  • pkg/agent/core/ngt/service/ngt_test.go
  • pkg/gateway/lb/handler/grpc/handler_test.go
  • pkg/index/job/correction/service/options.go
  • pkg/index/job/correction/usecase/corrector.go
  • tests/e2e/crud/crud_test.go
  • versions/PROMETHEUS_STACK_VERSION
  • versions/YQ_VERSION
  • versions/actions/ACTIONS_UPLOAD_ARTIFACT
Additional context used
Learnings (1)
charts/vald-helm-operator/crds/valdrelease.yaml (1)
Learnt from: kpango
PR: vdaas/vald#2564
File: charts/vald-helm-operator/crds/valdrelease.yaml:8084-8085
Timestamp: 2024-08-05T14:46:41.089Z
Learning: The `kvs_background_compaction_interval` property in the `valdrelease.yaml` file should use the pattern `^[0-9]+(ns|us|ms|s|m|h|d)$` to validate durations specified in nanoseconds, microseconds, milliseconds, seconds, minutes, hours, and days.
Additional comments not posted (30)
charts/vald/README.md (2)

Line range hint 1-1:
Ensure new configuration options are documented.

Verify that the new properties manager.index.corrector.gateway, manager.index.corrector.kvs_background_compaction_interval, and manager.index.corrector.kvs_background_sync_interval are correctly documented and integrated within the file.


Line range hint 1-1:
Verify removal of old property.

Ensure that the property manager.index.corrector.kvs_async_write_concurrency has been removed from all relevant sections.

k8s/index/operator/priorityclass.yaml (1)

16-30: LGTM! Ensure proper integration of the new PriorityClass.

The new PriorityClass resource for the Vald index operator is correctly defined. Verify that it is properly integrated within the Kubernetes environment.

internal/db/kvs/pogreb/options.go (3)

24-24: Verify the update of default options variable.

Ensure that the default options variable deafultOpts is correctly updated to use time.Duration for WithBackgroundSyncInterval.


43-48: LGTM! Ensure proper integration of WithBackgroundSyncInterval.

The changes to WithBackgroundSyncInterval enhance type safety and simplify the function. Verify that it is properly integrated within the codebase.


55-60: LGTM! Ensure proper integration of WithBackgroundCompactionInterval.

The changes to WithBackgroundCompactionInterval enhance type safety and simplify the function. Verify that it is properly integrated within the codebase.

k8s/index/job/correction/cronjob.yaml (2)

54-75: Ensure readiness checks for init containers are reliable.

The readiness checks for the wait-for-agent and wait-for-discoverer init containers rely on HTTP status codes. Ensure these services provide reliable readiness endpoints.


84-112: Ensure probes are correctly configured.

The liveness, readiness, and startup probes should be correctly configured to monitor the operational status of the main container.

Verification successful

Probes are correctly configured.

The liveness, readiness, and startup probes in k8s/index/job/correction/cronjob.yaml are properly set up with appropriate paths, ports, and parameters.

  • Liveness Probe:

    • Path: /liveness
    • Port: liveness
    • Initial Delay: 5 seconds
    • Period: 3 seconds
    • Timeout: 2 seconds
    • Failure Threshold: 2
    • Success Threshold: 1
  • Readiness Probe:

    • Path: /readiness
    • Port: readiness
    • Initial Delay: 10 seconds
    • Period: 3 seconds
    • Timeout: 2 seconds
    • Failure Threshold: 2
    • Success Threshold: 1
  • Startup Probe:

    • Path: /liveness
    • Port: liveness
    • Initial Delay: 5 seconds
    • Period: 5 seconds
    • Timeout: 2 seconds
    • Failure Threshold: 30
    • Success Threshold: 1
Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify probe endpoints for the main container.

# Test: Check liveness, readiness, and startup probe endpoints. Expect: HTTP status code 200.
curl -s -o /dev/null -w "%{http_code}" http://localhost:3000/liveness
curl -s -o /dev/null -w "%{http_code}" http://localhost:3001/readiness
curl -s -o /dev/null -w "%{http_code}" http://localhost:3000/liveness

Length of output: 226


Script:

#!/bin/bash
# Extract and display the probe configurations from the cronjob.yaml file

# Find the cronjob.yaml file
cronjob_file=$(fd cronjob.yaml)

# Display the probe configurations
echo "Liveness Probe Configuration:"
sed -n '/livenessProbe:/,/readinessProbe:/p' "$cronjob_file"

echo "Readiness Probe Configuration:"
sed -n '/readinessProbe:/,/startupProbe:/p' "$cronjob_file"

echo "Startup Probe Configuration:"
sed -n '/startupProbe:/,/resources:/p' "$cronjob_file"

Length of output: 2850


Script:

#!/bin/bash
# Extract and display the probe configurations from the specific cronjob.yaml file

# Define the specific file path
cronjob_file="k8s/index/job/correction/cronjob.yaml"

# Display the probe configurations
echo "Liveness Probe Configuration:"
sed -n '/livenessProbe:/,/readinessProbe:/p' "$cronjob_file"

echo "Readiness Probe Configuration:"
sed -n '/readinessProbe:/,/startupProbe:/p' "$cronjob_file"

echo "Startup Probe Configuration:"
sed -n '/startupProbe:/,/resources:/p' "$cronjob_file"

Length of output: 2648

internal/db/kvs/pogreb/options_test.go (2)

94-177: Complete the TestWithBackgroundSyncInterval function implementation.

The TestWithBackgroundSyncInterval function template is commented out. Ensure that this test function is implemented to validate the background sync interval configuration.

Do you want me to help implement this test function or open a GitHub issue to track this task?


180-263: Complete the TestWithBackgroundCompactionInterval function implementation.

The TestWithBackgroundCompactionInterval function template is commented out. Ensure that this test function is implemented to validate the background compaction interval configuration.

Do you want me to help implement this test function or open a GitHub issue to track this task?

k8s/index/job/creation/configmap.yaml (2)

167-172: Verify the TLS configuration paths.

Ensure that the paths to the CA, certificate, and key files are correctly specified and accessible within the Kubernetes environment.


174-204: Verify the observability settings.

Ensure that the observability settings, including the OTLP collector endpoint and trace configurations, are correctly specified and functional.

pkg/index/job/correction/service/options_test.go (2)

18-101: Implement the TestWithErrGroup function.

The function is not implemented and contains TODO comments for test cases.

Do you want me to implement the test cases for this function or open a GitHub issue to track this task?


273-356: Implement the TestWithGateway function.

The function is not implemented and contains TODO comments for test cases.

Do you want me to implement the test cases for this function or open a GitHub issue to track this task?

pkg/index/job/correction/service/corrector.go (3)

698-699: LGTM!

The NumberOfCheckedIndex function is straightforward and does not require changes.


702-703: LGTM!

The NumberOfCorrectedOldIndex function is straightforward and does not require changes.


706-707: LGTM!

The NumberOfCorrectedReplication function is straightforward and does not require changes.

charts/vald/values.yaml (3)

3251-3253: Verify the correctness and integration of kvs_background_sync_interval.

Ensure that the new parameter kvs_background_sync_interval is correctly documented and integrated into the system.


3254-3256: Verify the correctness and integration of kvs_background_compaction_interval.

Ensure that the new parameter kvs_background_compaction_interval is correctly documented and integrated into the system.


3263-3265: Verify the correctness and integration of gateway configuration.

Ensure that the new gateway configuration is correctly documented and integrated into the system.

charts/vald-helm-operator/crds/valdrelease.yaml (10)

7891-7897: Add validation constraints for addrs.

Ensure that the addrs array contains valid URLs or IP addresses.

addrs:
  type: array
  items:
    type: string
    format: uri

7898-7914: Add default values for backoff properties.

Consider adding default values for backoff properties to ensure consistent behavior.

backoff:
  type: object
  properties:
    backoff_factor:
      type: number
      default: 2.0
    backoff_time_limit:
      type: string
      default: "10s"
    enable_error_log:
      type: boolean
      default: true
    initial_duration:
      type: string
      default: "1s"
    jitter_limit:
      type: string
      default: "1s"
    maximum_duration:
      type: string
      default: "30s"
    retry_count:
      type: integer
      default: 5

7918-7930: Add default values for circuit_breaker properties.

Consider adding default values for circuit_breaker properties to ensure consistent behavior.

circuit_breaker:
  type: object
  properties:
    closed_error_rate:
      type: number
      default: 0.1
    closed_refresh_timeout:
      type: string
      default: "10s"
    half_open_error_rate:
      type: number
      default: 0.5
    min_samples:
      type: integer
      default: 10
    open_timeout:
      type: string
      default: "30s"

7931-7943: Add default values for connection_pool properties.

Consider adding default values for connection_pool properties to ensure consistent behavior.

connection_pool:
  type: object
  properties:
    enable_dns_resolver:
      type: boolean
      default: true
    enable_rebalance:
      type: boolean
      default: true
    old_conn_close_duration:
      type: string
      default: "1m"
    rebalance_duration:
      type: string
      default: "5m"
    size:
      type: integer
      default: 10

7944-7967: Add default values for dial_option properties.

Consider adding default values for dial_option properties to ensure consistent behavior.

dial_option:
  type: object
  properties:
    backoff_base_delay:
      type: string
      default: "1s"
    backoff_jitter:
      type: number
      default: 0.2
    backoff_max_delay:
      type: string
      default: "10s"
    backoff_multiplier:
      type: number
      default: 1.5
    enable_backoff:
      type: boolean
      default: true
    initial_connection_window_size:
      type: integer
      default: 65536
    initial_window_size:
      type: integer
      default: 65536
    insecure:
      type: boolean
      default: false
    interceptors:
      type: array
      items:
        type: string
        enum:
          - TraceInterceptor
    keepalive:
      type: object
      properties:
        permit_without_stream:
          type: boolean
          default: true
        time:
          type: string
          default: "30s"
        timeout:
          type: string
          default: "20s"
    max_msg_size:
      type: integer
      default: 4194304
    min_connection_timeout:
      type: string
      default: "20s"
    net:
      type: object
      properties:
        dialer:
          type: object
          properties:
            dual_stack_enabled:
              type: boolean
              default: true
            keepalive:
              type: string
              default: "30s"
            timeout:
              type: string
              default: "30s"
        dns:
          type: object
          properties:
            cache_enabled:
              type: boolean
              default: true
            cache_expiration:
              type: string
              default: "5m"
            refresh_duration:
              type: string
              default: "10m"
        socket_option:
          type: object
          properties:
            ip_recover_destination_addr:
              type: boolean
              default: true
            ip_transparent:
              type: boolean
              default: false
            reuse_addr:
              type: boolean
              default: true
            reuse_port:
              type: boolean
              default: true
            tcp_cork:
              type: boolean
              default: false
            tcp_defer_accept:
              type: boolean
              default: true
            tcp_fast_open:
              type: boolean
              default: true
            tcp_no_delay:
              type: boolean
              default: true
            tcp_quick_ack:
              type: boolean
              default: true
    read_buffer_size:
      type: integer
      default: 4096
    timeout:
      type: string
      default: "30s"
    write_buffer_size:
      type: integer
      default: 4096

8045-8050: Add default values for message size properties.

Consider adding default values for max_recv_msg_size, max_retry_rpc_buffer_size, and max_send_msg_size to ensure consistent behavior.

max_recv_msg_size:
  type: integer
  default: 4194304
max_retry_rpc_buffer_size:
  type: integer
  default: 8388608
max_send_msg_size:
  type: integer
  default: 4194304

8051-8065: Add default values for tls properties.

Consider adding default values for tls properties to ensure consistent behavior.

tls:
  type: object
  properties:
    ca:
      type: string
      default: "/path/to/ca.crt"
    cert:
      type: string
      default: "/path/to/cert.crt"
    enabled:
      type: boolean
      default: true
    insecure_skip_verify:
      type: boolean
      default: false
    key:
      type: string
      default: "/path/to/key.key"

8084-8085: Add validation constraints for kvs_background_compaction_interval.

Ensure the kvs_background_compaction_interval property has a valid duration format.

kvs_background_compaction_interval:
  type: string
  pattern: ^[0-9]+(ns|us|ms|s|m|h|d)$

8086-8087: Add validation constraints for kvs_background_sync_interval.

Ensure the kvs_background_sync_interval property has a valid duration format.

kvs_background_sync_interval:
  type: string
  pattern: ^[0-9]+(ns|us|ms|s|m|h|d)$

8084-8087: Add validation constraints for kvs_background_compaction_interval and kvs_background_sync_interval.

Ensure the kvs_background_compaction_interval and kvs_background_sync_interval properties have a valid duration format.

kvs_background_compaction_interval:
  type: string
  pattern: ^[0-9]+(ns|us|ms|s|m|h|d)$
kvs_background_sync_interval:
  type: string
  pattern: ^[0-9]+(ns|us|ms|s|m|h|d)$
Comments failed to post (12)
internal/config/corrector.go

53-54: Add tests for Gateway field in Bind method.

The new Gateway field should be covered by tests to ensure its correctness.

Do you want me to generate the unit testing code or open a GitHub issue to track this task?


63-64: Add tests for new fields in Bind method.

The new fields KVSBackgroundCompactionInterval and KVSBackgroundSyncInterval should be covered by tests to ensure their correctness.

Do you want me to generate the unit testing code or open a GitHub issue to track this task?


69-70: Add tests for Gateway field in Bind method.

The new Gateway field should be covered by tests to ensure its correctness.

Do you want me to generate the unit testing code or open a GitHub issue to track this task?


41-45: Fix syntax for struct tag value.

The struct tags for KVSBackgroundSyncInterval and KVSBackgroundCompactionInterval are missing closing quotes.

-	KVSBackgroundSyncInterval string `json:"kvs_background_sync_interval" yaml:"kvs_background_sync_interval`
+	KVSBackgroundSyncInterval string `json:"kvs_background_sync_interval" yaml:"kvs_background_sync_interval"`
-	KVSBackgroundCompactionInterval string `json:"kvs_background_compaction_interval" yaml:"kvs_background_compaction_interval`
+	KVSBackgroundCompactionInterval string `json:"kvs_background_compaction_interval" yaml:"kvs_background_compaction_interval"`
Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

	// KVSBackgroundSyncInterval represents interval for checked id list kvs sync duration
	KVSBackgroundSyncInterval string `json:"kvs_background_sync_interval" yaml:"kvs_background_sync_interval"`

	// KVSBackgroundCompactionInterval represents interval for checked id list kvs compaction duration
	KVSBackgroundCompactionInterval string `json:"kvs_background_compaction_interval" yaml:"kvs_background_compaction_interval"`
internal/config/corrector_test.go

20-30: Add test cases for new fields in Corrector struct.

The new fields KVSBackgroundSyncInterval, KVSBackgroundCompactionInterval, and Gateway should be covered in test cases to ensure they are correctly initialized and utilized.

Do you want me to generate the test cases for these new fields or open a GitHub issue to track this task?


61-65: Add test cases for Corrector struct with new fields.

The new fields should be included in the test cases to verify their correct initialization and usage.

Do you want me to generate the test cases for these new fields or open a GitHub issue to track this task?


90-94: Add test cases for Corrector struct with new fields.

The new fields should be included in the test cases to verify their correct initialization and usage.

Do you want me to generate the test cases for these new fields or open a GitHub issue to track this task?

pkg/index/job/correction/service/corrector.go

102-130: Ensure test coverage for the StartClient function.

The StartClient function should be thoroughly tested to verify its functionality.

Do you want me to implement the test cases for this function or open a GitHub issue to track this task?


133-686: Ensure test coverage for the Start function.

The Start function should be thoroughly tested to verify its functionality.

Do you want me to implement the test cases for this function or open a GitHub issue to track this task?


278-344: Optimize nested loops and error handling.

The nested loops and error handling in the Start function can be optimized for better performance and readability.

  for _, daddr := range addrs {
    if diff <= 0 || daddr == addr {
      continue
    }
    _, err := c.discoverer.GetClient().Do(grpc.WithGRPCMethod(egctx, vald.PackageName+"."+vald.InsertRPCServiceName+"/"+vald.InsertRPCName), daddr, func(ctx context.Context,
      conn *grpc.ClientConn,
      copts ...grpc.CallOption,
    ) (any, error) {
      client := vald.NewValdClient(conn)
      _, err := client.Insert(ctx, req, copts...)
      if err != nil {
        if st, ok := status.FromError(err); ok {
          switch st.Code() {
          case codes.AlreadyExists:
            obj, err := client.GetObject(ctx, &payload.Object_VectorRequest{
              Id: &payload.Object_ID{
                Id: id,
              },
            }, copts...)
            if err != nil {
              return handleGRPCError(st, err)
            }
            if obj.GetTimestamp() < vec.GetTimestamp() {
              _, err = client.Update(ctx, &payload.Update_Request{
                Vector: vec,
                Config: &payload.Update_Config{
                  Timestamp: vec.GetTimestamp() - 1,
                },
              }, copts...)
              if err != nil {
                return handleGRPCError(st, err)
              }
              c.correctedOldIndexCount.Add(1)
            }
            diff--
            c.correctedReplicationCount.Add(1)
            return nil, nil
          case codes.Canceled:
            return nil, nil
          }
        }
        return nil, err
      }
      diff--
      c.correctedReplicationCount.Add(1)
      return nil, nil
    })
    if err != nil {
      log.Error(fmt.Errorf("failed to insert object to agent(%s): %w", daddr, err))
    }
  }

Committable suggestion was skipped due to low confidence.


693-695: Handle potential errors more gracefully.

Ensure that any errors during the close operation are handled properly.

  if err := c.checkedList.Close(true); err != nil {
    log.Errorf("failed to close checkedList: %v", err)
    return err
  }
  return nil
Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

func (c *correct) PreStop(_ context.Context) error {
	log.Info("removing persistent cache files...")
	if err := c.checkedList.Close(true); err != nil {
		log.Errorf("failed to close checkedList: %v", err)
		return err
	}
	return nil

84-98: Enhance error handling for database initialization.

Consider adding retry mechanisms for the pogreb database initialization to handle transient errors more gracefully.

  db, err := pogreb.New(pogreb.WithPath(path),
    pogreb.WithBackgroundCompactionInterval(c.backgroundCompactionInterval),
    pogreb.WithBackgroundSyncInterval(c.backgroundSyncInterval))
  if err != nil {
    log.Errorf("failed to open checked List kvs DB %s", path)
-   return nil, err
+   // Retry mechanism
+   for i := 0; i < 3; i++ {
+     time.Sleep(2 * time.Second)
+     db, err = pogreb.New(pogreb.WithPath(path),
+       pogreb.WithBackgroundCompactionInterval(c.backgroundCompactionInterval),
+       pogreb.WithBackgroundSyncInterval(c.backgroundSyncInterval))
+     if err == nil {
+       break
+     }
+     log.Errorf("retrying to open checked List kvs DB %s, attempt %d", path, i+1)
+   }
+   if err != nil {
+     return nil, err
+   }
  }
  c.checkedList = db
Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

	dir := file.Join(os.TempDir(), "checked")
	err = file.MkdirAll(dir, os.ModePerm)
	if (err != nil) {
		log.Errorf("failed to create dir %s", dir)
		return nil, err
	}
	path := file.Join(dir, "checkedid.db")
	db, err := pogreb.New(pogreb.WithPath(path),
		pogreb.WithBackgroundCompactionInterval(c.backgroundCompactionInterval),
		pogreb.WithBackgroundSyncInterval(c.backgroundSyncInterval))
	if err != nil {
		log.Errorf("failed to open checked List kvs DB %s", path)
		// Retry mechanism
		for i := 0; i < 3; i++ {
			time.Sleep(2 * time.Second)
			db, err = pogreb.New(pogreb.WithPath(path),
				pogreb.WithBackgroundCompactionInterval(c.backgroundCompactionInterval),
				pogreb.WithBackgroundSyncInterval(c.backgroundSyncInterval))
			if err == nil {
				break
			}
			log.Errorf("retrying to open checked List kvs DB %s, attempt %d", path, i+1)
		}
		if err != nil {
			return nil, err
		}
	}
	c.checkedList = db

},
}
for _, daddr := range addrs {
if diff > 0 && daddr != addr {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚫 [golangci] reported by reviewdog 🐶
282-349 lines are duplicate of pkg/index/job/correction/service/corrector.go:567-634 (dupl)

for _, daddr := range addrs {
if diff > 0 && daddr != addr {
_, ok := found[daddr]
if !ok {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚫 [golangci] reported by reviewdog 🐶
567-634 lines are duplicate of pkg/index/job/correction/service/corrector.go:282-349 (dupl)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants