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

[patch] fix duplicated search result #729

Merged
merged 1 commit into from
Sep 28, 2020

Conversation

kpango
Copy link
Collaborator

@kpango kpango commented Sep 25, 2020

Signed-off-by: kpango [email protected]

Description:

fix duplicated search result

Related Issue:

How Has This Been Tested?:

Environment:

  • Go Version: 1.15.2
  • Docker Version: 19.03.8
  • Kubernetes Version: 1.18.2
  • NGT Version: 1.12.1

Types of changes:

  • Bug fix [type/bug]
  • New feature [type/feature]
  • Add tests [type/test]
  • Security related changes [type/security]
  • Add documents [type/documentation]
  • Refactoring [type/refactoring]
  • Update dependencies [type/dependency]
  • Update benchmarks and performances [type/bench]
  • Update CI [type/ci]

Changes to Core Features:

  • Have you added an explanation of what your changes do and why you'd like us to include them?
  • Have you written new tests for your core changes, as applicable?
  • Have you successfully ran tests with your changes locally?

Checklist:

  • I have read the CONTRIBUTING document.
  • I have checked open Pull Requests for the similar feature or fixes?
  • I have added tests and benchmarks to cover my changes.
  • I have ensured all new and existing tests passed.
  • I have commented my code, particularly in hard-to-understand areas
  • I have updated the documentation accordingly.

@vdaas-ci
Copy link
Collaborator

[CHATOPS:HELP] ChatOps commands.

  • 🙆‍♀️ /approve - approve
  • 💌 /changelog - add changelog comment
  • 🍱 /format - format codes and add licenses
  • /gen-test - generate test codes
  • 🏷️ /label - add labels
  • /rebase - rebase master

@pull-assistant
Copy link

pull-assistant bot commented Sep 25, 2020

Score: 1.00

Best reviewed: commit by commit


Optimal code review plan

     [patch] fix duplicated search result

Powered by Pull Assistant. Last update 0c72ab7 ... 0c72ab7. Read the comment docs.

@github-actions github-actions bot added size/S type/bug Something isn't working priority/medium labels Sep 25, 2020
@kpango kpango force-pushed the bugfix/gateway/fix-duplicated-search-result branch from 5aae231 to 0c72ab7 Compare September 25, 2020 11:56
@codecov
Copy link

codecov bot commented Sep 25, 2020

Codecov Report

Merging #729 into master will increase coverage by 0.01%.
The diff coverage is 0.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #729      +/-   ##
==========================================
+ Coverage   14.31%   14.32%   +0.01%     
==========================================
  Files         419      419              
  Lines       19420    19420              
==========================================
+ Hits         2780     2782       +2     
+ Misses      16406    16403       -3     
- Partials      234      235       +1     
Impacted Files Coverage Δ
pkg/gateway/vald/handler/grpc/handler.go 0.00% <0.00%> (ø)
internal/worker/worker.go 83.33% <0.00%> (+2.08%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 583f275...0c72ab7. Read the comment docs.

@rinx rinx self-requested a review September 28, 2020 01:12
@@ -161,15 +161,13 @@ func (s *server) search(ctx context.Context, cfg *payload.Search_Config,
return nil
}
id := dist.GetId()
mu.RLock()
mu.Lock()
Copy link
Contributor

Choose a reason for hiding this comment

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

i'm not sure but how about to use sync.Map as visited?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

we already tried sync.Map implementation, at https://github.com/vdaas/vald/pull/729/files#diff-320187c6fd3d930cdcd5999eb7192ed5R150 and https://github.com/vdaas/vald/pull/729/files#diff-320187c6fd3d930cdcd5999eb7192ed5R172-R175
if we change this logic to sync.Map we have to re-check accuracy.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I think if we change mutex to lockfree we should make another PR, this PR is for current bug fix.

Copy link
Contributor

Choose a reason for hiding this comment

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

aha, i see.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

But I wanted to use sync.Map for this block, I'll make proposal PR for it.

@rinx
Copy link
Contributor

rinx commented Sep 28, 2020

/approve

Copy link
Collaborator

@vdaas-ci vdaas-ci left a comment

Choose a reason for hiding this comment

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

[APPROVED] This PR is approved by rinx.

@kpango kpango merged commit d591597 into master Sep 28, 2020
@kpango kpango deleted the bugfix/gateway/fix-duplicated-search-result branch September 28, 2020 02:52
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.

3 participants